Add homepage, link to it from the logo

This commit is contained in:
Lukáš Kucharczyk 2023-01-04 17:22:36 +01:00
parent d225856174
commit 4c642d97cb
Signed by: lukas
SSH Key Fingerprint: SHA256:vMuSwvwAvcT6htVAioMP7rzzwMQNi3roESyhv+nAxeg
5 changed files with 20 additions and 1 deletions

View File

@ -1,3 +1,4 @@
## Unreleased
* Hide navigation bar items if there are no games/purchases/sessions
* Set default version to "git-main" to indicate development environment
* Add homepage, link to it from the logo

View File

@ -15,7 +15,7 @@
<div class="dark:bg-gray-800 h-screen">
<nav class="mb-4 bg-white dark:bg-gray-900 border-gray-200 rounded">
<div class="container flex flex-wrap items-center justify-between mx-auto">
<a href="#" class="flex items-center">
<a href="{% url 'index' %}" class="flex items-center">
<span class="text-4xl"></span>
<span class="self-center text-xl font-semibold whitespace-nowrap text-white">Timetracker</span>
</a>

View File

@ -0,0 +1,13 @@
{% extends 'base.html' %}
{% block title %}{{ title }}{% endblock title %}
{% block content %}
<div class="text-slate-300 mx-auto max-w-screen-lg text-center">
{% if session_count > 0 %}
You have played a total of {{ session_count }} sessions.
{% else %}
Start by clicking the links at the top. To track playtime, you need to have at least 1 owned game.
{% endif %}
</div>
{% endblock content %}

View File

@ -3,6 +3,7 @@ from django.urls import path
from . import views
urlpatterns = [
path("", views.index, name="index"),
path("add-game/", views.add_game, name="add_game"),
path("add-session/", views.add_session, name="add_session"),
path("add-purchase/", views.add_purchase, name="add_purchase"),

View File

@ -65,3 +65,7 @@ def add_game(request):
context["form"] = form
context["title"] = "Add New Game"
return render(request, "add.html", context)
def index(request):
context = {}
return render(request, "index.html", context)