Affiche le timer en cours dans le header

Pastille à droite du header sur toutes les pages (fragment
/ui/timer/entete) : description ou projet, chrono et bouton stop, bordée
à la couleur du projet. L'arrêt émet timer-changed pour rafraîchir le
timer de l'accueil (GET /ui/timer).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Romulus21andClaude Opus 5.5 committed 2026-11-13 19:07:54 +01:00
1 parent cbc8ba8ce0
commit ef69462e06
7 files changed
+79 -2

No files matched your search

+1
View File
@@ -6,6 +6,7 @@
{%- else if name == "check" -%}<path d="M20 6 9 17l-5-5"/>
{%- else if name == "plus" -%}<path d="M5 12h14"/><path d="M12 5v14"/>
{%- else if name == "reset" -%}<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/>
{%- else if name == "stop" -%}<rect x="6" y="6" width="12" height="12" rx="1.5" fill="currentColor"/>
{%- else if name == "link" -%}<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>
{%- else if name == "archive" -%}<rect x="2" y="3" width="20" height="5" rx="1"/><path d="M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8"/><path d="M10 12h4"/>
{%- else if name == "unarchive" -%}<rect x="2" y="3" width="20" height="5" rx="1"/><path d="M4 8v11a2 2 0 0 0 2 2h2"/><path d="M20 8v11a2 2 0 0 1-2 2h-2"/><path d="m9 15 3-3 3 3"/><path d="M12 12v9"/>
+10
View File
@@ -0,0 +1,10 @@
{% import "_icons.html" as icons %}
<div id="mini-timer" hx-get="/ui/timer/entete" hx-trigger="entries-changed from:body, every 30s" hx-swap="outerHTML">
{% if let Some(e) = running %}
<div class="mini-timer" style="--color: {{ e.color }}" title="{{ e.client_name }} / {{ e.project_name }}">
<span class="mini-timer-label">{% if e.note.is_empty() %}{{ e.project_name }}{% else %}{{ e.note }}{% endif %}</span>
<span class="clock" data-started="{{ e.started_rfc3339() }}">{{ e.duration() }}</span>
<button class="btn small icon danger" hx-post="/ui/timer/stop" hx-swap="none" title="Arrêter" aria-label="Arrêter le timer">{% call icons::icon("stop") %}{% endcall %}</button>
</div>
{% endif %}
</div>
+1 -1
View File
@@ -1,4 +1,4 @@
<section id="timer" class="card timer{% if running.is_some() %} is-running{% endif %}"{% if let Some(e) = running %} style="--color: {{ e.color }}"{% endif %}>
<section id="timer" hx-get="/ui/timer" hx-trigger="timer-changed from:body" hx-swap="outerHTML" class="card timer{% if running.is_some() %} is-running{% endif %}"{% if let Some(e) = running %} style="--color: {{ e.color }}"{% endif %}>
{% if let Some(e) = running %}
<div class="current">
<div class="current-label">
+1
View File
@@ -21,6 +21,7 @@
<a href="/reports" {% if nav == "reports" %}aria-current="page"{% endif %}>Rapports</a>
<a href="/clients" {% if nav == "clients" %}aria-current="page"{% endif %}>Clients</a>
</nav>
<div id="mini-timer" hx-get="/ui/timer/entete" hx-trigger="load" hx-swap="outerHTML"></div>
</header>
<main>
{% block content %}{% endblock %}