Page d'accueil ok

This commit is contained in:
Michel Roux 2023-01-04 15:43:20 +01:00
parent c5279e26f8
commit cbf978c9ea
6 changed files with 40 additions and 12 deletions

View File

@ -13,11 +13,17 @@ app.config["SECRET_KEY"] = token_hex()
@app.context_processor @app.context_processor
def utility_processor(): def utility_processor():
current_date = datetime.now() current_date = datetime.now()
next_year = current_date.year + 5 - (current_date.year % 5) apocalypse_left = (
datetime(current_date.year + 5 - (current_date.year % 5), 6, 4, 0, 1)
- current_date
)
print(next_year) return dict(
_=i18n,
return dict(_=i18n, current_lang=current_lang(), search_form=SearchForm()) current_lang=current_lang(),
search_form=SearchForm(),
apocalypse_left=apocalypse_left,
)
@app.route("/") @app.route("/")

View File

@ -0,0 +1,3 @@
.title {
letter-spacing: 0.5rem;
}

View File

@ -1,8 +1,8 @@
{% extends "layout.html.j2" %} {% extends "layout.html.j2" %}
{% block body %} {% block body %}
<section class="hero is-fullheight-with-navbar"> <section class="hero is-fullheight-with-navbar">
<div class="hero-body m-auto is-flex-direction-column"> <div class="hero-body m-auto is-flex-direction-column is-justify-content-center">
<p class="title mb-6 is-size-1" style="letter-spacing:0.5rem">{{ _("𝚷😼た") }}</p> <p class="title mb-6 is-size-1">{{ _("𝚷😼た") }}</p>
<form action="{{ url_for('index') }}" class="subtitle"> <form action="{{ url_for('index') }}" class="subtitle">
<div class="field has-addons"> <div class="field has-addons">
<div class="control"> <div class="control">

View File

@ -48,8 +48,26 @@
{% endif %} {% endif %}
{% block body %} {% block body %}
{% endblock body %} {% endblock body %}
<footer> <footer class="has-text-centered is-size-7">
lol <span class="mr-2">
<i class="fa fa-user-plus"></i>
<a href="https://discord.com/users/133305654512320513" target="_blank">{{ _("Discord") }}</a>
</span>
<span class="mr-2">
<i class="fa fa-book"></i>
{# djlint:off H022 #}<a href="http://www.wtfpl.net" target="_blank">{{ _("Licence") }}</a>{# djlint:on #}
</span>
<span class="mr-2">
<i class="fa fa-code-fork"></i>
<a href="https://git.crystalyx.net/Xefir/PyNyaaTa" target="_blank">{{ _("Code") }}</a>
</span>
<span class="mr-2">
<i class="fa fa-cubes"></i>
<a href="https://hub.docker.com/r/xefir/pynyaata" target="_blank">{{ _("Docker") }}</a>
</span>
<br />
<i class="fa fa-heartbeat"></i>
{{ _("Next castastrophic life failure in about %s days", apocalypse_left.days) }}
</footer> </footer>
</body> </body>
</html> </html>

View File

@ -10,7 +10,7 @@ def current_lang():
return request.accept_languages.best_match(["en", "fr"]) return request.accept_languages.best_match(["en", "fr"])
def i18n(string: str) -> str: def i18n(string: str, *args: str) -> str:
lang = current_lang() lang = current_lang()
if lang != "en" and lang not in CATALOG_CACHE: if lang != "en" and lang not in CATALOG_CACHE:
@ -21,6 +21,6 @@ def i18n(string: str) -> str:
CATALOG_CACHE[lang] = catalog CATALOG_CACHE[lang] = catalog
if lang in CATALOG_CACHE and string in CATALOG_CACHE[lang]: if lang in CATALOG_CACHE and string in CATALOG_CACHE[lang]:
return CATALOG_CACHE[lang][string] return CATALOG_CACHE[lang][string] % args
return string return string % args

View File

@ -1,3 +1,4 @@
{ {
"Search animes ...": "Recherche d'animes ..." "Search animes ...": "Recherche d'animes ...",
"Next castastrophic life failure in about %s days": "%s jours avant la prochaine catastrophe"
} }