Reformat
Django CI/CD / test (push) Successful in 55s Details
Django CI/CD / build-and-push (push) Successful in 1m33s Details

This commit is contained in:
Lukáš Kucharczyk 2024-02-10 09:50:53 +01:00
parent 6a5457191a
commit c747cd1fd8
Signed by: lukas
SSH Key Fingerprint: SHA256:vMuSwvwAvcT6htVAioMP7rzzwMQNi3roESyhv+nAxeg
10 changed files with 192 additions and 154 deletions

View File

@ -910,6 +910,18 @@ select {
height: 1.5rem; height: 1.5rem;
} }
.h-24 {
height: 6rem;
}
.h-screen {
height: 100vh;
}
.min-h-24 {
min-height: 6rem;
}
.min-h-screen { .min-h-screen {
min-height: 100vh; min-height: 100vh;
} }
@ -946,6 +958,10 @@ select {
max-width: 20rem; max-width: 20rem;
} }
.flex-1 {
flex: 1 1 0%;
}
@keyframes spin { @keyframes spin {
to { to {
transform: rotate(360deg); transform: rotate(360deg);
@ -1082,6 +1098,22 @@ select {
padding-top: 0.25rem; padding-top: 0.25rem;
} }
.pt-8 {
padding-top: 2rem;
}
.pb-4 {
padding-bottom: 1rem;
}
.pb-8 {
padding-bottom: 2rem;
}
.pb-16 {
padding-bottom: 4rem;
}
.text-center { .text-center {
text-align: center; text-align: center;
} }

View File

@ -18,8 +18,8 @@
<td></td> <td></td>
<td> <td>
<input type="submit" <input type="submit"
name="submit_and_redirect" name="submit_and_redirect"
value="Submit & Create Purchase" /> value="Submit & Create Purchase" />
</td> </td>
</tr> </tr>
</table> </table>

View File

@ -18,8 +18,8 @@
<td></td> <td></td>
<td> <td>
<input type="submit" <input type="submit"
name="submit_and_redirect" name="submit_and_redirect"
value="Submit & Create Edition" /> value="Submit & Create Edition" />
</td> </td>
</tr> </tr>
</table> </table>

View File

@ -18,8 +18,8 @@
<td></td> <td></td>
<td> <td>
<input type="submit" <input type="submit"
name="submit_and_redirect" name="submit_and_redirect"
value="Submit & Create Session" /> value="Submit & Create Session" />
</td> </td>
</tr> </tr>
</table> </table>

View File

@ -19,8 +19,8 @@
<div class="basic-button-container" hx-boost="false"> <div class="basic-button-container" hx-boost="false">
<button class="basic-button" data-target="{{ field.name }}" data-type="now">Set to now</button> <button class="basic-button" data-target="{{ field.name }}" data-type="now">Set to now</button>
<button class="basic-button" <button class="basic-button"
data-target="{{ field.name }}" data-target="{{ field.name }}"
data-type="toggle">Toggle text</button> data-type="toggle">Toggle text</button>
<button class="basic-button" data-target="{{ field.name }}" data-type="copy">Copy</button> <button class="basic-button" data-target="{{ field.name }}" data-type="copy">Copy</button>
</div> </div>
</td> </td>

View File

@ -18,21 +18,21 @@
</head> </head>
<body class="dark" hx-indicator="#indicator"> <body class="dark" hx-indicator="#indicator">
<img id="indicator" <img id="indicator"
src="{% static 'icons/loading.png' %}" src="{% static 'icons/loading.png' %}"
class="absolute right-3 top-3 animate-spin htmx-indicator" class="absolute right-3 top-3 animate-spin htmx-indicator"
height="24" height="24"
width="24" width="24"
alt="loading indicator" /> alt="loading indicator" />
<div class="dark:bg-gray-800 min-h-screen"> <div class="flex flex-col min-h-screen">
<nav class="mb-4 bg-white dark:bg-gray-900 border-gray-200 rounded"> <nav class="dark:bg-gray-900 border-gray-200 h-24 flex items-center">
<div class="container flex flex-wrap items-center justify-between mx-auto"> <div class="container flex flex-wrap items-center justify-between mx-auto">
<a href="{% url 'list_sessions_recent' %}" class="flex items-center"> <a href="{% url 'list_sessions_recent' %}" class="flex items-center">
<span class="text-4xl"> <span class="text-4xl">
<img src="{% static 'icons/schedule.png' %}" <img src="{% static 'icons/schedule.png' %}"
height="48" height="48"
width="48" width="48"
alt="Timetracker Logo" alt="Timetracker Logo"
class="mr-4" /> class="mr-4" />
</span> </span>
<span class="self-center text-xl font-semibold whitespace-nowrap text-white">Timetracker</span> <span class="self-center text-xl font-semibold whitespace-nowrap text-white">Timetracker</span>
</a> </a>
@ -40,77 +40,79 @@
<ul class="flex flex-col md:flex-row p-4 mt-4 dark:text-white"> <ul class="flex flex-col md:flex-row p-4 mt-4 dark:text-white">
<li class="relative group"> <li class="relative group">
{% if user.is_authenticated %} {% if user.is_authenticated %}
<a class="block py-2 pl-3 pr-4 hover:underline"
href="{% url 'add_game' %}">New</a>
<ul class="absolute hidden text-gray-700 pt-1 group-hover:block w-auto whitespace-nowrap">
{% if purchase_available %}
<li>
<a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap"
href="{% url 'add_device' %}">Device</a>
</li>
{% endif %}
<li>
<a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap"
href="{% url 'add_game' %}">Game</a>
</li>
{% if game_available and platform_available %}
<li>
<a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap"
href="{% url 'add_edition' %}">Edition</a>
</li>
{% endif %}
<li>
<a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap"
href="{% url 'add_platform' %}">Platform</a>
</li>
{% if edition_available %}
<li>
<a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap"
href="{% url 'add_purchase' %}">Purchase</a>
</li>
{% endif %}
{% if purchase_available %}
<li>
<a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap"
href="{% url 'add_session' %}">Session</a>
</li>
{% endif %}
</ul>
</li>
{% if session_count > 0 %}
<li class="relative group">
<a class="block py-2 pl-3 pr-4 hover:underline" <a class="block py-2 pl-3 pr-4 hover:underline"
href="{% url 'stats_current_year' %}">Stats</a> href="{% url 'add_game' %}">New</a>
<ul class="absolute hidden text-gray-700 pt-1 group-hover:block"> <ul class="absolute hidden text-gray-700 pt-1 group-hover:block w-auto whitespace-nowrap">
{% for year in stats_dropdown_year_range %} {% if purchase_available %}
<li> <li>
<a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap" <a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap"
href="{% url 'stats_by_year' year %}">{{ year }}</a> href="{% url 'add_device' %}">Device</a>
</li> </li>
{% endfor %} {% endif %}
<li>
<a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap"
href="{% url 'add_game' %}">Game</a>
</li>
{% if game_available and platform_available %}
<li>
<a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap"
href="{% url 'add_edition' %}">Edition</a>
</li>
{% endif %}
<li>
<a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap"
href="{% url 'add_platform' %}">Platform</a>
</li>
{% if edition_available %}
<li>
<a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap"
href="{% url 'add_purchase' %}">Purchase</a>
</li>
{% endif %}
{% if purchase_available %}
<li>
<a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap"
href="{% url 'add_session' %}">Session</a>
</li>
{% endif %}
</ul> </ul>
</li> </li>
<li> {% if session_count > 0 %}
<a class="block py-2 pl-3 pr-4 hover:underline" <li class="relative group">
href="{% url 'list_sessions' %}">All Sessions</a> <a class="block py-2 pl-3 pr-4 hover:underline"
</li> href="{% url 'stats_current_year' %}">Stats</a>
<li> <ul class="absolute hidden text-gray-700 pt-1 group-hover:block">
<a class="block py-2 pl-3 pr-4 hover:underline" {% for year in stats_dropdown_year_range %}
href="{% url 'logout' %}">Log Out</a> <li>
</li> <a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap"
href="{% url 'stats_by_year' year %}">{{ year }}</a>
</li>
{% endfor %}
</ul>
</li>
<li>
<a class="block py-2 pl-3 pr-4 hover:underline"
href="{% url 'list_sessions' %}">All Sessions</a>
</li>
<li>
<a class="block py-2 pl-3 pr-4 hover:underline"
href="{% url 'logout' %}">Log Out</a>
</li>
{% endif %}
{% endif %} {% endif %}
{% endif %} </ul>
</ul> </div>
</div> </div>
</nav>
<div class="flex flex-1 dark:bg-gray-800 justify-center pt-8 pb-16">
{% block content %}
No content here.
{% endblock content %}
</div> </div>
</nav> {% load version %}
{% block content %} <span class="fixed left-2 bottom-2 text-xs text-slate-300 dark:text-slate-600">{% version %} ({% version_date %})</span>
No content here. </div>
{% endblock content %} {% block scripts %}
</div> {% endblock scripts %}
{% load version %} </body>
<span class="fixed left-2 bottom-2 text-xs text-slate-300 dark:text-slate-600">{% version %} ({% version_date %})</span> </html>
{% block scripts %}
{% endblock scripts %}
</body>
</html>

View File

@ -4,32 +4,33 @@
{{ title }} {{ title }}
{% endblock title %} {% endblock title %}
{% block content %} {% block content %}
{% if dataset_count >= 1 %} <div class="flex-col">
{% url 'list_sessions_start_session_from_session' last.id as start_session_url %} {% if dataset_count >= 1 %}
<div class="mx-auto text-center my-4"> {% url 'list_sessions_start_session_from_session' last.id as start_session_url %}
<a id="last-session-start" <div class="mx-auto text-center my-4">
href="{{ start_session_url }}" <a id="last-session-start"
hx-get="{{ start_session_url }}" href="{{ start_session_url }}"
hx-swap="afterbegin" hx-get="{{ start_session_url }}"
hx-target=".responsive-table tbody" hx-swap="afterbegin"
onClick="document.querySelector('#last-session-start').classList.add('invisible')" hx-target=".responsive-table tbody"
class="{% if last.timestamp_end == null %}invisible{% endif %}"> onClick="document.querySelector('#last-session-start').classList.add('invisible')"
{% include 'components/button_start.html' with text=last.purchase title="Start session of last played game" only %} class="{% if last.timestamp_end == null %}invisible{% endif %}">
</a> {% include 'components/button_start.html' with text=last.purchase title="Start session of last played game" only %}
</div> </a>
{% endif %} </div>
{% if dataset_count != 0 %} {% endif %}
<table class="responsive-table"> {% if dataset_count != 0 %}
<thead> <table class="responsive-table">
<tr> <thead>
<th class="px-2 sm:px-4 md:px-6 md:py-2">Name</th> <tr>
<th class="hidden sm:table-cell px-2 sm:px-4 md:px-6 md:py-2">Start</th> <th class="px-2 sm:px-4 md:px-6 md:py-2">Name</th>
<th class="hidden lg:table-cell px-2 sm:px-4 md:px-6 md:py-2">End</th> <th class="hidden sm:table-cell px-2 sm:px-4 md:px-6 md:py-2">Start</th>
<th class="px-2 sm:px-4 md:px-6 md:py-2">Duration</th> <th class="hidden lg:table-cell px-2 sm:px-4 md:px-6 md:py-2">End</th>
</tr> <th class="px-2 sm:px-4 md:px-6 md:py-2">Duration</th>
</thead> </tr>
<tbody> </thead>
{% for session in dataset %} <tbody>
{% for session in dataset %}
{% partialdef session-row inline=True %} {% partialdef session-row inline=True %}
<tr> <tr>
<td class="px-2 sm:px-4 md:px-6 md:py-2 purchase-name truncate max-w-20char md:max-w-40char"> <td class="px-2 sm:px-4 md:px-6 md:py-2 purchase-name truncate max-w-20char md:max-w-40char">
@ -43,7 +44,7 @@
</td> </td>
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono hidden lg:table-cell"> <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono hidden lg:table-cell">
{% if not session.timestamp_end %} {% if not session.timestamp_end %}
{% url 'list_sessions_end_session' session.id as end_session_url %} {% url 'list_sessions_end_session' session.id as end_session_url %}
<a href="{{ end_session_url }}" <a href="{{ end_session_url }}"
hx-get="{{ end_session_url }}" hx-get="{{ end_session_url }}"
hx-target="closest tr" hx-target="closest tr"
@ -61,10 +62,11 @@
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ session.duration_formatted }}</td> <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ session.duration_formatted }}</td>
</tr> </tr>
{% endpartialdef %} {% endpartialdef %}
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
{% else %} {% else %}
<div class="mx-auto text-center text-slate-300 text-xl">No sessions found.</div> <div class="mx-auto text-center text-slate-300 text-xl">No sessions found.</div>
{% endif %} {% endif %}
</div>
{% endblock content %} {% endblock content %}

View File

@ -5,17 +5,19 @@
Login Login
{% endblock title %} {% endblock title %}
{% block content %} {% block content %}
<h2 class="text-3xl text-white mb-8 mx-auto text-center">Please log in to continue</h2> <div class="flex items-center flex-col">
<form method="post"> <h2 class="text-3xl text-white mb-8">Please log in to continue</h2>
<table class="mx-auto"> <form method="post">
{% csrf_token %} <table>
{{ form.as_table }} {% csrf_token %}
<tr> {{ form.as_table }}
<td></td> <tr>
<td> <td></td>
<input type="submit" value="Login" /> <td>
</td> <input type="submit" value="Login" />
</tr> </td>
</form> </tr>
</table> </form>
</table>
</div>
{% endblock content %} {% endblock content %}

View File

@ -9,9 +9,9 @@
<form method="get" class="text-center"> <form method="get" class="text-center">
<label class="text-5xl text-center inline-block mb-10" for="yearSelect">Stats for:</label> <label class="text-5xl text-center inline-block mb-10" for="yearSelect">Stats for:</label>
<select name="year" <select name="year"
id="yearSelect" id="yearSelect"
onchange="this.form.submit();" onchange="this.form.submit();"
class="mx-2"> class="mx-2">
{% for year_item in stats_dropdown_year_range %} {% for year_item in stats_dropdown_year_range %}
<option value="{{ year_item }}" {% if year == year_item %}selected{% endif %}>{{ year_item }}</option> <option value="{{ year_item }}" {% if year == year_item %}selected{% endif %}>{{ year_item }}</option>
{% endfor %} {% endfor %}
@ -115,7 +115,7 @@
<tr> <tr>
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono"> <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">
<a class="underline decoration-slate-500 sm:decoration-2" <a class="underline decoration-slate-500 sm:decoration-2"
href="{% url 'view_game' game.id %}">{{ game.name }}</a> href="{% url 'view_game' game.id %}">{{ game.name }}</a>
</td> </td>
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ game.formatted_playtime }}</td> <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ game.formatted_playtime }}</td>
</tr> </tr>
@ -152,7 +152,7 @@
<tr> <tr>
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono"> <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">
<a class="underline decoration-slate-500 sm:decoration-2" <a class="underline decoration-slate-500 sm:decoration-2"
href="{% url 'edit_purchase' purchase.id %}"> href="{% url 'edit_purchase' purchase.id %}">
{% if purchase.type == 'dlc' %} {% if purchase.type == 'dlc' %}
{{ purchase.name }} ({{ purchase.edition.name }} DLC) {{ purchase.name }} ({{ purchase.edition.name }} DLC)
{% else %} {% else %}
@ -178,7 +178,7 @@
<tr> <tr>
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono"> <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">
<a class="underline decoration-slate-500 sm:decoration-2" <a class="underline decoration-slate-500 sm:decoration-2"
href="{% url 'edit_purchase' purchase.id %}">{{ purchase.edition.name }}</a> href="{% url 'edit_purchase' purchase.id %}">{{ purchase.edition.name }}</a>
</td> </td>
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ purchase.date_finished | date:"d/m/Y" }}</td> <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ purchase.date_finished | date:"d/m/Y" }}</td>
</tr> </tr>
@ -198,7 +198,7 @@
<tr> <tr>
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono"> <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">
<a class="underline decoration-slate-500 sm:decoration-2" <a class="underline decoration-slate-500 sm:decoration-2"
href="{% url 'edit_purchase' purchase.id %}">{{ purchase.edition.name }}</a> href="{% url 'edit_purchase' purchase.id %}">{{ purchase.edition.name }}</a>
</td> </td>
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ purchase.date_finished | date:"d/m/Y" }}</td> <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ purchase.date_finished | date:"d/m/Y" }}</td>
</tr> </tr>
@ -220,7 +220,7 @@
<tr> <tr>
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono"> <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">
<a class="underline decoration-slate-500 sm:decoration-2" <a class="underline decoration-slate-500 sm:decoration-2"
href="{% url 'edit_purchase' purchase.id %}"> href="{% url 'edit_purchase' purchase.id %}">
{{ purchase.edition.name }} {{ purchase.edition.name }}
{% if purchase.type == "dlc" %}({{ purchase.name }}, {{ purchase.get_type_display }}){% endif %} {% if purchase.type == "dlc" %}({{ purchase.name }}, {{ purchase.get_type_display }}){% endif %}
</a> </a>
@ -246,7 +246,7 @@
<tr> <tr>
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono"> <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">
<a class="underline decoration-slate-500 sm:decoration-2" <a class="underline decoration-slate-500 sm:decoration-2"
href="{% url 'edit_purchase' purchase.id %}"> href="{% url 'edit_purchase' purchase.id %}">
{{ purchase.edition.name }} {{ purchase.edition.name }}
{% if purchase.type != "game" %}({{ purchase.name }}, {{ purchase.get_type_display }}){% endif %} {% if purchase.type != "game" %}({{ purchase.name }}, {{ purchase.get_type_display }}){% endif %}
</a> </a>

View File

@ -80,20 +80,20 @@
{% url 'edit_session' session.id as edit_url %} {% url 'edit_session' session.id as edit_url %}
{% include 'components/edit_button.html' with edit_url=edit_url %} {% include 'components/edit_button.html' with edit_url=edit_url %}
{% if not session.timestamp_end %} {% if not session.timestamp_end %}
{% url 'view_game_end_session' session.id as end_session_url %} {% url 'view_game_end_session' session.id as end_session_url %}
<a <a
class="flex bg-green-600 rounded-full px-2 w-7 h-4 text-white justify-center items-center" class="flex bg-green-600 rounded-full px-2 w-7 h-4 text-white justify-center items-center"
href="{{ end_session_url }}" href="{{ end_session_url }}"
hx-get="{{ end_session_url }}" hx-get="{{ end_session_url }}"
hx-target="closest li" hx-target="closest li"
hx-swap="outerHTML" hx-swap="outerHTML"
hx-vals="js:{session_count:getSessionCount()}" hx-vals="js:{session_count:getSessionCount()}"
hx-indicator="#indicator" hx-indicator="#indicator"
> >
<svg xmlns="http://www.w3.org/2000/svg" fill="#ffffff" class="h-3" x="0px" y="0px" viewBox="0 0 24 24"> <svg xmlns="http://www.w3.org/2000/svg" fill="#ffffff" class="h-3" x="0px" y="0px" viewBox="0 0 24 24">
<path d="M 12 2 C 6.486 2 2 6.486 2 12 C 2 17.514 6.486 22 12 22 C 17.514 22 22 17.514 22 12 C 22 10.874 21.803984 9.7942031 21.458984 8.7832031 L 19.839844 10.402344 C 19.944844 10.918344 20 11.453 20 12 C 20 16.411 16.411 20 12 20 C 7.589 20 4 16.411 4 12 C 4 7.589 7.589 4 12 4 C 13.633 4 15.151922 4.4938906 16.419922 5.3378906 L 17.851562 3.90625 C 16.203562 2.71225 14.185 2 12 2 z M 21.292969 3.2929688 L 11 13.585938 L 7.7070312 10.292969 L 6.2929688 11.707031 L 11 16.414062 L 22.707031 4.7070312 L 21.292969 3.2929688 z"></path> <path d="M 12 2 C 6.486 2 2 6.486 2 12 C 2 17.514 6.486 22 12 22 C 17.514 22 22 17.514 22 12 C 22 10.874 21.803984 9.7942031 21.458984 8.7832031 L 19.839844 10.402344 C 19.944844 10.918344 20 11.453 20 12 C 20 16.411 16.411 20 12 20 C 7.589 20 4 16.411 4 12 C 4 7.589 7.589 4 12 4 C 13.633 4 15.151922 4.4938906 16.419922 5.3378906 L 17.851562 3.90625 C 16.203562 2.71225 14.185 2 12 2 z M 21.292969 3.2929688 L 11 13.585938 L 7.7070312 10.292969 L 6.2929688 11.707031 L 11 16.414062 L 22.707031 4.7070312 L 21.292969 3.2929688 z"></path>
</svg> </svg>
</a> </a>
{% endif %} {% endif %}
</li> </li>