Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature 219 styling site landing page #221

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
92095ae
feat: add calendar picture and icon
ron-huberfeld Feb 2, 2021
5b1eecc
feat: styling landing page and add 404 page
ron-huberfeld Feb 2, 2021
eab932b
fix: remove commented code
ron-huberfeld Feb 2, 2021
1564b70
fix: 404 page naming convention
ron-huberfeld Feb 2, 2021
72c30ef
fix: use ionicons instead of svg
ron-huberfeld Feb 2, 2021
a1e46d4
Merge 'develop' changes to resolve conflicts
ron-huberfeld Feb 2, 2021
a6de077
Merge 'develop' changes 2
ron-huberfeld Feb 2, 2021
04101dc
Merge branch 'develop' into feature-219-styling-site-landing-page
ron-huberfeld Feb 2, 2021
c514590
fix: handle flake8 issue
ron-huberfeld Feb 2, 2021
f409729
Merge branch 'develop' of https://github.com/PythonFreeCourse/calenda…
ron-huberfeld Feb 2, 2021
30a82b0
Apply automatic translateable string changes
ron-huberfeld Feb 7, 2021
6679c32
Merge branch 'develop' of https://github.com/ron-huberfeld/calendar i…
ron-huberfeld Feb 2, 2021
18f779d
Apply automatic translateable string changes
ron-huberfeld Feb 7, 2021
5cf612a
fix merge issue
ron-huberfeld Feb 2, 2021
f9e29ec
Merge 'develop' changes
ron-huberfeld Feb 10, 2021
68a2706
Merge branch 'develop' of https://github.com/PythonFreeCourse/calenda…
ron-huberfeld Feb 10, 2021
51305a9
Merge branch 'develop' of https://github.com/PythonFreeCourse/calenda…
ron-huberfeld Feb 10, 2021
8c6a35c
Merge 'develop' changes
ron-huberfeld Feb 10, 2021
d07eb44
Merge branch 'develop' of https://github.com/PythonFreeCourse/calenda…
ron-huberfeld Feb 11, 2021
603523e
fix: remove tailwind
ron-huberfeld Feb 11, 2021
627ede5
fix: remove comments
ron-huberfeld Feb 11, 2021
5bf93be
Merge 'develop' changes
ron-huberfeld Feb 11, 2021
2b8e0d3
fix: remove genereted file
ron-huberfeld Feb 11, 2021
be9216b
fix: move style from tailwind to bootstrap
ron-huberfeld Feb 11, 2021
b096fbe
fix: remove tailwind related style
ron-huberfeld Feb 11, 2021
2b4e06b
fix: reorder routes
ron-huberfeld Feb 11, 2021
f61ec8c
fix: reorder again :)
ron-huberfeld Feb 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from app.internal import daily_quotes, json_data_loader
from app.routers import (
agenda, calendar, categories, dayview, email,
event, invitation, profile, search, telegram, whatsapp
event, invitation, profile, search, telegram, whatsapp, four_o_four
)
from app.telegram.bot import telegram_bot

Expand Down Expand Up @@ -41,6 +41,7 @@ def create_tables(engine, psql_environment):
dayview.router,
email.router,
event.router,
four_o_four.router,
invitation.router,
profile.router,
search.router,
Expand All @@ -60,7 +61,7 @@ def create_tables(engine, psql_environment):
@logger.catch()
async def home(request: Request, db: Session = Depends(get_db)):
quote = daily_quotes.quote_per_day(db)
return templates.TemplateResponse("home.html", {
return templates.TemplateResponse("index.html", {
"request": request,
"message": "Hello, World!",
"quote": quote
Expand Down
15 changes: 15 additions & 0 deletions app/routers/four_o_four.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from app.dependencies import templates
from fastapi import APIRouter
from starlette.requests import Request

router = APIRouter(
prefix="/404",
tags=["404"],
responses={404: {"description": "Not found"}},
)


@router.get("/")
async def not_implemented(request: Request):
return templates.TemplateResponse("four_o_four.j2",
{"request": request})
Binary file added app/static/images/calendar.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/static/images/icons/calendar-outline.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
81 changes: 52 additions & 29 deletions app/static/style.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
body {
background: #A1FFCE;
background: -webkit-linear-gradient(to right, #FAFFD1, #A1FFCE);
background: linear-gradient(to right, #FAFFD1, #A1FFCE);
}

.profile-image {
width: 7em;
}
Expand All @@ -20,43 +14,72 @@ body {
transform: scale(1.02);
}

.bg-gradient2 {
background: linear-gradient(
135deg,
rgba(0, 97, 215, 1) 0%,
rgba(0, 200, 255, 1) 100%
);
}

h2,
p {
display: flex;
align-items: center;
justify-content: space-around;
}

#inner:hover {
cursor: pointer;
padding: 50px;
background-color: linear-gradient(
135deg,
rgba(0, 97, 215, 1) 0%,
rgba(0, 200, 255, 1) 100%
);
}

#inner {
transition: background 0.2s ease, padding 0.8s linear;
}

.event-posted-time {
font-size: 0.7rem;
}

.no-border {
border: none;
border: none;
}

.profile-modal-fadeIn {
-webkit-animation-name: profile-modal-fadeIn;
animation-name: profile-modal-fadeIn;
-webkit-animation-name: profile-modal-fadeIn;
animation-name: profile-modal-fadeIn;

-webkit-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
-webkit-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}

@keyframes profile-modal-fadeIn {
from {
opacity: 0;
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
}

@keyframes profile-modal-fadeIn {
from {
opacity: 0;
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
}

to {
opacity: 1;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
to {
opacity: 1;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
}

.profile-modal-dialog {
margin: 0;
margin: 0;
}

.profile-modal-header {
border: none;
background-color:whitesmoke;
}
border: none;
background-color: whitesmoke;
}
99 changes: 55 additions & 44 deletions app/templates/base.html
Original file line number Diff line number Diff line change
@@ -1,68 +1,79 @@
<!DOCTYPE html>
<html lang="en">

<head>
{% block head %}
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
<!-- Tailwind CSS -->
<link href="https://unpkg.com/tailwindcss@1.9.5/dist/tailwind.min.css" rel="stylesheet">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use Tailwind in this project.
We won't add it 'cause it will make a mess of a code (Bootstrap + Tailwind mishmash) and will make the page much heavier than it should be. :(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issue, I'll remove it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, I will remove Bootstrap before removing Tailwind :)
image

Copy link
Member

@yammesicka yammesicka Feb 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's almost a valid point, but tailwind is harder to work with if you don't use React/Vue/Angular, especially for new users, and will create a bloated code which will load slower. ^^"

If I have to choose only one of them (and that's the case) - I take Bootstrap

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yammesicka - done - removed tailwind :)

<link rel="icon" href="{{ url_for('static', path='/images/icons/calendar-outline.svg') }}" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link to ionicons and use icons elements and not svg files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, sure, your wish is my command :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aviadamar - I didn't manage to find a way to do it in the page's tab icon.
Do you know how to do it in the page's tab icon?

<link href="{{ url_for('static', path='/style.css') }}" rel="stylesheet">

<title>Calendar</title>
<title>PyLendar {% block title %}{% endblock %}</title>
{% endblock %}
</head>

<body>
<nav class="navbar navbar-expand-lg bg-transparent">
<div class="container-fluid">
<a class="navbar-brand" href="/">Calendar</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarText"
aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarText">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="{{ url_for('home') }}">Home</a>
</li>
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="{{ url_for('profile') }}">Profile</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Sign In</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Sign Up</a>
</li>
<li class="nav-item">
<!-- new button for the agenda page. should be available after login
place will change later according to the web design -->
<a class="nav-link" href="{{ url_for('agenda') }}">Agenda</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('view_invitations') }}">Invitations</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/search">Search</a>
</li>
</ul>
</div>
<div class="bg-gradient2 h-1"></div>
<div class="relative overflow-hidden">
<div class="relative pt-6 px-4 sm:px-6 lg:px-8">
<nav class="navbar navbar-expand-md navbar-light">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggler"
aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-brand">
<a href="{{ url_for('home') }}" aria-label="Home">
<img class="h-8 w-auto sm:h-10"
src="{{ url_for('static', path='/images/icons/calendar-outline.svg') }}" alt="Logo">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use the ionicons element and not the svg file.

<ion-icon name="calendar-outline"></ion-icon>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, sure it will be done

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aviadamar was ionicons checked for performance?
and where are we using popover?
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the script is in the head as written ?
about the popover, I have no idea, if you find out let me know.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I modified the scripts to be in the head as stated and it solved the warning in console.
Nevertheless, it stores some items in cache which reduce performance.
I changed the icon in the logo (navbar-brand).
But I didn't manage to find a way to do it in the page's tab icon.
Do you know how to do it in the page's tab icon?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aviadamar - this change done
Please review

</a>
</div>
<div class="collapse navbar-collapse" id="navbarToggler">
<ul class="navbar-nav mr-auto mb-2 mb-lg-0 ">
<li class="nav-item">
<a class="nav-link" href="{{ url_for('profile') }}">Profile</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('not_implemented') }}">Sign In</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('not_implemented') }}">Sign Up</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('agenda') }}">Agenda</a>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agenda is not needs to appear in landing page.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comment.
@yammesicka do you approve removing existing links?

</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('view_invitations') }}">Invitations</a>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im not sure this sections needs to be in landing page.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comment.
@yammesicka do you approve removing existing links?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whatever you want ^^"

</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('search') }}">Search</a>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Search is not needs to appear in landing page.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comment.
@yammesicka do you approve removing existing links?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W/E you decide

</li>
</ul>
</div>
</nav>
</div>
</nav>
{% block content %}


{% endblock %}

{% block content %}{% endblock %}
</div>
<script defer src="https://use.fontawesome.com/releases/v5.0.8/js/all.js"
integrity="sha384-SlE991lGASHoBfWbelyBPLsUlwY1GwNDJo3jSJO04KZ33K2bwfV9YBauFfnzvynJ"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.min.js"
integrity="sha512-d9xgZrVZpmmQlfonhQUvTR7lMPtO7NkZMkA0ABN3PHCbKA5nqylQ/yWlFAyY6hYgdF1Qh6nYiuADWwKB4C2WSw=="
crossorigin="anonymous"></script>
<script type="text/javascript" src="{{ url_for('static', path='/popover.js') }}"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW"
crossorigin="anonymous"></script>
<!-- This bootstrap version is needed here because of the toggler bug in the beta version-->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job commenting about it

<script src="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha2/js/bootstrap.bundle.min.js"
integrity="sha384-BOsAfwzjNJHrJ8cZidOg56tcQWfp6y72vEJ8xQ9w6Quywb24iOsW913URv1IS4GD"
crossorigin="anonymous"></script>

</body>
</html>

</html>
13 changes: 13 additions & 0 deletions app/templates/four_o_four.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% extends "base.html" %}

{% block title %} - 404{% endblock %}

{% block content %}

<div class="container">
<h2 class="text-4xl tracking-tight leading-10 font-extrabold text-purple-900
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to adapt from tailwind

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

sm:text-5xl sm:leading-none md:text-6xl">
Not implemented</h2>
</div>

{% endblock %}
57 changes: 57 additions & 0 deletions app/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{% extends "base.html" %}

{% block content %}

<div class="max-w-screen-xl mx-auto">
<div class="relative z-10 pb-8 bg-white sm:pb-16 md:pb-20 lg:max-w-2xl lg:w-full lg:pb-28 xl:pb-32">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to adapt from tailwind

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

<!-- Angled image on the right -->
<svg class="hidden lg:block absolute right-0 inset-y-0 h-full w-48 text-white transform translate-x-1/2"
fill="currentColor" viewBox="0 0 100 100" preserveAspectRatio="none">
<polygon points="0,0 50,0 100,100 50,100" />
</svg>

<main class="mt-10 mx-auto max-w-screen-xl px-4 sm:mt-12 sm:px-6 md:mt-16 lg:mt-20 lg:px-8 xl:mt-28">
<div class="sm:text-center lg:text-center">
<h2
class="text-4xl tracking-tight leading-10 font-extrabold text-gray-900 sm:text-5xl sm:leading-none md:text-6xl">
PyLendar
<br class="xl:hidden">
</h2>
<p
class="mt-3 text-base text-gray-500 sm:mt-5 sm:text-lg sm:max-w-xl sm:mx-auto md:mt-5 md:text-xl lg:mx-0">
Open Source Calendar built with Python
</p>
<div class="mt-3 text-base text-gray-500 sm:mt-5 sm:text-lg sm:max-w-xl sm:mx-auto md:mt-5 md:text-xl lg:mx-0">
{% if quote %}
{% if not quote.author%}
<p><i>"{{ quote.text }}"</i></p>
{% else %}
<p><i>"{{ quote.text }}"</i> <span style="font-size: small;">&nbsp; \ {{quote.author}}</span></p>
{% endif %}
{% endif %}
</div>
<div class="mt-5 sm:mt-8 sm:flex sm:justify-center lg:justify-center">
<div class="mt-6 flex justify-center">
<a href="{{ url_for('calendar') }}"
class="flex rounded-full items-center py-2 px-6 bg-gradient2 focus:outline-none shadow-lg text-white text-2xl"
type="button">
<span>Get started</span>
</a>
</div>
</div>
</div>
</main>
</div>
<div class="lg:absolute lg:inset-y-0 lg:right-0 lg:w-1/2">
Copy link
Contributor

@aviadamar aviadamar Feb 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are 4 divs that capture only 1 img - maybe it can be simplify ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will be done

<div id="slidesCarousel" class="carousel slide carousel-fade" data-pause="false" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block w-100" src="{{ url_for('static', path='/images/calendar.jpg') }}"
alt="calendar image">
</div>
</div>
</div>
</div>
</div>

{% endblock %}