feat: let the list ignore, submit and undo events from Nextcloud

Each row now shows its shared status and carries the matching gesture. Nothing
is displayed before Nextcloud confirms it: on failure the status stays put and
the reason is spelled out. Ignored events are greyed and pushed to the end,
never hidden.
This commit is contained in:
Pierre Martin
2026-08-13 16:50:16 +02:00
parent 058229dce3
commit 69c10abbd7
4 changed files with 265 additions and 14 deletions
+20
View File
@@ -5,6 +5,7 @@
// config.js n'exporte rien : il pose globalThis.EchoConfig (cf. DECISIONS.md
// 2026-07-17). L'import ne sert qu'à son effet de bord.
import "./config.js";
import { lireStatut } from "./statut-mairie.js";
const LOCALE = "fr-FR";
const FUSEAU = "Europe/Paris";
@@ -85,3 +86,22 @@ function formaterHorodate({ debut, fin }) {
export function formaterLieu(evenement) {
return evenement.lieu.trim() || LIEU_PAR_DEFAUT;
}
// Statut mairie en clair. Le jour du tag est une date NUE (« AAAA-MM-JJ »),
// jamais un instant : on la découpe, on ne la convertit pas — un Date la ferait
// glisser d'un jour selon le fuseau de la machine.
export function formaterStatut(statut) {
if (statut.type === "ignoré") return "Ignoré";
if (statut.type !== "soumis") return "";
if (!statut.jour) return "Soumis";
const [, mois, jour] = statut.jour.split("-");
return `Soumis le ${jour}/${mois}`;
}
// Les ignorés restent VISIBLES (on doit pouvoir les dé-ignorer) mais cessent
// d'encombrer : ils passent en fin de liste, chaque groupe gardant son ordre.
export function repousserIgnores(evenements) {
const ignore = (evenement) => lireStatut(evenement.categories).type === "ignoré";
return [...evenements.filter((e) => !ignore(e)), ...evenements.filter(ignore)];
}