Author SHA1 Message Date
Romulus21andClaude Opus 5.5 9e136bd208 Merge branch 'feat/favicon-enregistrement'
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 18:54:34 +01:00
Romulus21andClaude Opus 5.5 0c9b9c5823 Fait clignoter le favicon en rouge pendant un enregistrement
Favicon par défaut (static/favicon.svg) ; tant que /api/timer renvoie
une entrée en cours, il alterne chaque seconde entre un point rouge plein
et pâle, sur toutes les pages. État relu au chargement, après chaque
requête htmx, au retour sur l'onglet et toutes les 20 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 18:54:34 +01:00
Romulus21andClaude Opus 5.5 aa4f5aeb0a Versionne les URL de app.css et app.js
Un hash du contenu est ajouté en ?v= : après un déploiement, le
navigateur recharge le CSS/JS au lieu de garder l'ancien en cache
(max-age=3600).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 18:39:05 +01:00
Romulus21andClaude Opus 5.5 b4702fdf71 Merge branch 'feat/clients-pictos'
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 18:36:44 +01:00
Romulus21andClaude Opus 5.5 d2d8e94aba Met des pictos sur la page clients et aligne les contrôles
Ajouter / Enregistrer (primary), Réinitialiser la couleur, Archiver /
Réactiver et Supprimer deviennent des icônes groupées ; les SVG sont
centralisés dans la macro _icons.html. Hauteurs communes (--control,
--control-sm) pour champs, pastilles de couleur et boutons-icônes ; les
pastilles ne s'étirent plus. Tiret devant les projets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 18:36:44 +01:00
Romulus21andClaude Opus 5.5 80d22caea8 Merge branch 'feat/pictos-livereload-accueil'
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 18:27:36 +01:00
8 changed files with 124 additions and 32 deletions

No files matched your search

+19 -6
View File
@@ -44,18 +44,31 @@ pub fn app(pool: SqlitePool) -> Router {
)
}),
)
.route("/static/app.js", get(|| asset("text/javascript", APP_JS)))
.route("/static/app.css", get(|| asset("text/css", APP_CSS)))
.route(
"/static/app.js",
get(|| asset("text/javascript", include_str!("../../static/app.js"))),
)
.route(
"/static/app.css",
get(|| asset("text/css", include_str!("../../static/app.css"))),
"/static/favicon.svg",
get(|| asset("image/svg+xml", include_str!("../../static/favicon.svg"))),
)
.layer(TraceLayer::new_for_http())
.with_state(pool)
}
const APP_CSS: &str = include_str!("../../static/app.css");
const APP_JS: &str = include_str!("../../static/app.js");
/// Hash of app.css + app.js, appended as `?v=` to their URLs so a deploy
/// bypasses the browser cache.
pub fn asset_version() -> &'static str {
static VERSION: std::sync::LazyLock<String> = std::sync::LazyLock::new(|| {
use std::hash::{Hash, Hasher};
let mut h = std::collections::hash_map::DefaultHasher::new();
(APP_CSS, APP_JS).hash(&mut h);
format!("{:x}", h.finish())
});
&VERSION
}
// En livereload, le CSS/JS doit être relu à chaque rechargement.
const CACHE_CONTROL: &str = if cfg!(feature = "livereload") {
"no-cache"
+16 -6
View File
@@ -1,4 +1,7 @@
:root {
/* Hauteur commune des champs, pastilles de couleur et boutons-icônes. */
--control: 2.5rem;
--control-sm: 1.9rem;
--bg: #f6f5f2;
--surface: #ffffff;
--text: #1d1d1f;
@@ -64,7 +67,8 @@ main { max-width: 960px; margin: 1.5rem auto; padding: 0 16px; display: grid; ga
.row { display: flex; gap: .5rem; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.row.grow input { flex: 1; min-width: 0; }
.row.grow input:not([type="color"]) { flex: 1; min-width: 0; }
.row input, .row select { height: var(--control); }
.stack { display: grid; gap: .35rem; }
.muted, .empty { color: var(--muted); }
.empty { margin: .25rem 0; }
@@ -87,13 +91,17 @@ label { display: flex; align-items: center; gap: .35rem; color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn.danger { color: var(--danger); }
.btn.small { padding: .2rem .55rem; font-size: .85rem; }
.btn.icon { display: inline-flex; align-items: center; justify-content: center; padding: .3rem; line-height: 0; }
.btn.icon {
display: inline-flex; align-items: center; justify-content: center; flex: none;
width: var(--control); height: var(--control); padding: 0; line-height: 0;
}
.btn.small.icon { width: var(--control-sm); height: var(--control-sm); }
.btn.icon svg { display: block; }
.btn-group { display: inline-flex; }
.btn-group > .btn { border-radius: 0; }
.btn-group > .btn + .btn { margin-left: -1px; }
.btn-group > .btn:first-child { border-radius: 8px 0 0 8px; }
.btn-group > .btn:last-child { border-radius: 0 8px 8px 0; }
.btn-group > .btn:first-child { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
.btn-group > .btn:last-child { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
.btn-group > .btn:hover { position: relative; z-index: 1; }
.htmx-request .btn, .btn.htmx-request { opacity: .6; }
@@ -133,9 +141,10 @@ td.actions { text-align: right; white-space: nowrap; }
}
.client-card { border-left: 6px solid var(--color); }
input[type="color"] {
width: 2.2rem; height: 2.2rem; padding: .15rem; flex: none; cursor: pointer;
width: var(--control); height: var(--control); padding: .15rem; flex: none; cursor: pointer;
}
.projects input[type="color"] { width: 1.8rem; height: 1.8rem; }
.projects input { height: var(--control-sm); padding-block: 0; }
.projects input[type="color"] { width: var(--control-sm); padding: .1rem; }
/* Projects list */
.projects { list-style: none; margin: 0 0 1rem; padding: 0; }
@@ -144,6 +153,7 @@ input[type="color"] {
padding: .4rem 0; border-bottom: 1px solid var(--border);
}
.projects li.archived { opacity: .6; }
.projects li > form::before { content: "-"; color: var(--muted); flex: none; }
/* Periods & reports */
.presets { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .75rem; }
+41
View File
@@ -61,3 +61,44 @@ function removeRow(button) {
for (const input of row.querySelectorAll("input")) input._flatpickr?.destroy();
row.remove();
}
// Favicon : point rouge clignotant tant qu'un enregistrement est en cours,
// sur toutes les pages (état lu sur /api/timer).
const favicon = document.getElementById("favicon");
const IDLE_ICON = favicon.href;
const recIcon = (opacity) =>
"data:image/svg+xml," +
encodeURIComponent(
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><circle cx="16" cy="16" r="13" fill="#e5322d" fill-opacity="${opacity}"/></svg>`,
);
const REC_ON = recIcon(1);
const REC_OFF = recIcon(0.2);
let recording = false;
let blinkOn = false;
function setRecording(value) {
if (value === recording) return;
recording = value;
blinkOn = true;
favicon.href = recording ? REC_ON : IDLE_ICON;
}
setInterval(() => {
if (!recording) return;
blinkOn = !blinkOn;
favicon.href = blinkOn ? REC_ON : REC_OFF;
}, 1000);
async function refreshRecording() {
try {
const res = await fetch("/api/timer", { headers: { accept: "application/json" } });
if (res.ok) setRecording((await res.json()) !== null);
} catch {
// Serveur injoignable : on garde l'état connu.
}
}
refreshRecording();
setInterval(refreshRecording, 20000);
document.addEventListener("visibilitychange", () => {
if (!document.hidden) refreshRecording();
});
document.body.addEventListener("htmx:afterRequest", refreshRecording);
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><circle cx="16" cy="16" r="12" fill="none" stroke="#2f6f5e" stroke-width="4"/><path d="M16 9v7l4 3" fill="none" stroke="#2f6f5e" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/></svg>

After

Width:  |  Height:  |  Size: 261 B

+4 -3
View File
@@ -1,3 +1,4 @@
{% import "_icons.html" as icons %}
<tr id="entry-{{ e.id }}"{% if e.running() %} class="running"{% endif %}>
<td class="time">
{{ e.start_time() }} – {{ e.end_time() }}
@@ -8,9 +9,9 @@
<td class="num">{{ e.duration() }}</td>
<td class="actions">
<div class="btn-group">
<button class="btn small icon primary" title="Modifier" aria-label="Modifier" hx-get="/ui/entries/{{ e.id }}/edit" hx-target="closest tr" hx-swap="outerHTML"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"/></svg></button>
<button class="btn small icon" title="Dupliquer" aria-label="Dupliquer" hx-get="/ui/entries/{{ e.id }}/dupliquer" hx-target="closest tr" hx-swap="afterend"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg></button>
<button class="btn small icon danger" title="Supprimer" aria-label="Supprimer" hx-delete="/ui/entries/{{ e.id }}" hx-target="closest tr" hx-swap="outerHTML" hx-confirm="Supprimer cette entrée ?"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 6h18"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/><path d="M10 11v6"/><path d="M14 11v6"/></svg></button>
<button class="btn small icon primary" title="Modifier" aria-label="Modifier" hx-get="/ui/entries/{{ e.id }}/edit" hx-target="closest tr" hx-swap="outerHTML">{% call icons::icon("edit") %}{% endcall %}</button>
<button class="btn small icon" title="Dupliquer" aria-label="Dupliquer" hx-get="/ui/entries/{{ e.id }}/dupliquer" hx-target="closest tr" hx-swap="afterend">{% call icons::icon("copy") %}{% endcall %}</button>
<button class="btn small icon danger" title="Supprimer" aria-label="Supprimer" hx-delete="/ui/entries/{{ e.id }}" hx-target="closest tr" hx-swap="outerHTML" hx-confirm="Supprimer cette entrée ?">{% call icons::icon("trash") %}{% endcall %}</button>
</div>
</td>
</tr>
+12
View File
@@ -0,0 +1,12 @@
{# Icônes SVG (tracés Lucide), en couleur du texte. #}
{% macro icon(name) %}<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
{%- if name == "edit" -%}<path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"/>
{%- else if name == "copy" -%}<rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
{%- else if name == "trash" -%}<path d="M3 6h18"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/><path d="M10 11v6"/><path d="M14 11v6"/>
{%- 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 == "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"/>
{%- endif -%}
</svg>{% endmacro %}
+3 -2
View File
@@ -4,12 +4,13 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}Tempus{% endblock %} · Tempus</title>
<link rel="icon" id="favicon" type="image/svg+xml" href="/static/favicon.svg">
<link rel="stylesheet" href="/static/flatpickr/flatpickr.min.css">
<link rel="stylesheet" href="/static/app.css">
<link rel="stylesheet" href="/static/app.css?v={{ crate::routes::asset_version() }}">
<script src="/static/htmx.min.js" defer></script>
<script src="/static/flatpickr/flatpickr.min.js" defer></script>
<script src="/static/flatpickr/fr.min.js" defer></script>
<script src="/static/app.js" defer></script>
<script src="/static/app.js?v={{ crate::routes::asset_version() }}" defer></script>
</head>
<body>
<header class="topbar">
+28 -15
View File
@@ -1,4 +1,5 @@
{% extends "base.html" %}
{% import "_icons.html" as icons %}
{% block title %}Clients{% endblock %}
{% block content %}
<section class="card">
@@ -6,7 +7,7 @@
<form method="post" action="/ui/clients" class="row">
<input type="color" name="color" value="{{ next_color }}" aria-label="Couleur du client">
<input name="name" required placeholder="Nom du client" aria-label="Nom du client" class="grow">
<button class="btn primary">Ajouter</button>
<button class="btn icon primary" title="Ajouter le client" aria-label="Ajouter le client">{% call icons::icon("plus") %}{% endcall %}</button>
</form>
</section>
@@ -20,17 +21,22 @@
<form method="post" action="/ui/clients/{{ c.client.id }}" class="row grow">
<input type="color" name="color" value="{{ c.client.color }}" aria-label="Couleur du client">
<input name="name" value="{{ c.client.name }}" required aria-label="Nom du client" class="title-input">
<button class="btn">Enregistrer</button>
<button class="btn icon primary" title="Enregistrer" aria-label="Enregistrer">{% call icons::icon("check") %}{% endcall %}</button>
</form>
<div class="row">
{% if c.client.archived %}<span class="badge">archivé</span>{% endif %}
<form method="post" action="/ui/clients/{{ c.client.id }}/archive">
<form id="archive-client-{{ c.client.id }}" method="post" action="/ui/clients/{{ c.client.id }}/archive" hidden>
<input type="hidden" name="archived" value="{{ !c.client.archived }}">
<button class="btn">{% if c.client.archived %}Réactiver{% else %}Archiver{% endif %}</button>
</form>
<form method="post" action="/ui/clients/{{ c.client.id }}/delete" data-confirm="Supprimer ce client, ses projets et tout le temps saisi ?">
<button class="btn danger">Supprimer</button>
</form>
<form id="delete-client-{{ c.client.id }}" method="post" action="/ui/clients/{{ c.client.id }}/delete" data-confirm="Supprimer ce client, ses projets et tout le temps saisi ?" hidden></form>
<div class="btn-group">
{% if c.client.archived %}
<button class="btn icon" form="archive-client-{{ c.client.id }}" title="Réactiver" aria-label="Réactiver">{% call icons::icon("unarchive") %}{% endcall %}</button>
{% else %}
<button class="btn icon" form="archive-client-{{ c.client.id }}" title="Archiver" aria-label="Archiver">{% call icons::icon("archive") %}{% endcall %}</button>
{% endif %}
<button class="btn icon danger" form="delete-client-{{ c.client.id }}" title="Supprimer" aria-label="Supprimer">{% call icons::icon("trash") %}{% endcall %}</button>
</div>
</div>
</div>
@@ -41,20 +47,27 @@
<input type="color" name="color" value="{{ p.effective_color }}" aria-label="Couleur du projet"
title="{% if p.color.is_some() %}Couleur propre au projet{% else %}Couleur du client{% endif %}">
<input name="name" value="{{ p.name }}" required aria-label="Nom du projet">
<button class="btn small">Enregistrer</button>
<div class="btn-group">
<button class="btn small icon primary" title="Enregistrer" aria-label="Enregistrer">{% call icons::icon("check") %}{% endcall %}</button>
{% if p.color.is_some() %}
<button class="btn small" name="inherit" value="true" title="Reprendre la couleur du client">↺</button>
<button class="btn small icon" name="inherit" value="true" title="Reprendre la couleur du client" aria-label="Reprendre la couleur du client">{% call icons::icon("reset") %}{% endcall %}</button>
{% endif %}
</div>
</form>
<div class="row">
{% if p.archived %}<span class="badge">archivé</span>{% endif %}
<form method="post" action="/ui/projects/{{ p.id }}/archive">
<form id="archive-project-{{ p.id }}" method="post" action="/ui/projects/{{ p.id }}/archive" hidden>
<input type="hidden" name="archived" value="{{ !p.archived }}">
<button class="btn small">{% if p.archived %}Réactiver{% else %}Archiver{% endif %}</button>
</form>
<form method="post" action="/ui/projects/{{ p.id }}/delete" data-confirm="Supprimer ce projet et tout le temps saisi dessus ?">
<button class="btn small danger">Supprimer</button>
</form>
<form id="delete-project-{{ p.id }}" method="post" action="/ui/projects/{{ p.id }}/delete" data-confirm="Supprimer ce projet et tout le temps saisi dessus ?" hidden></form>
<div class="btn-group">
{% if p.archived %}
<button class="btn small icon" form="archive-project-{{ p.id }}" title="Réactiver" aria-label="Réactiver">{% call icons::icon("unarchive") %}{% endcall %}</button>
{% else %}
<button class="btn small icon" form="archive-project-{{ p.id }}" title="Archiver" aria-label="Archiver">{% call icons::icon("archive") %}{% endcall %}</button>
{% endif %}
<button class="btn small icon danger" form="delete-project-{{ p.id }}" title="Supprimer" aria-label="Supprimer">{% call icons::icon("trash") %}{% endcall %}</button>
</div>
</div>
</li>
{% endfor %}
@@ -63,7 +76,7 @@
<form method="post" action="/ui/clients/{{ c.client.id }}/projects" class="row">
<input type="color" name="color" value="{{ c.client.color }}" aria-label="Couleur du projet" title="Garder la couleur du client ou en choisir une autre">
<input name="name" required placeholder="Nouveau projet" aria-label="Nouveau projet" class="grow">
<button class="btn">Ajouter le projet</button>
<button class="btn icon primary" title="Ajouter le projet" aria-label="Ajouter le projet">{% call icons::icon("plus") %}{% endcall %}</button>
</form>
</section>
{% endfor %}