Add synthesis refresh countdown display

Show a live countdown (15→0s) in the synthesis header indicating when the
next auto-refresh will occur. Resets on every successful synthesis fetch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-23 16:47:45 +02:00
parent b25fd5da49
commit f2d51fe21a
+9 -1
View File
@@ -134,6 +134,14 @@ export default function Home() {
query: { refetchInterval: 15000 }, query: { refetchInterval: 15000 },
}); });
const [countdown, setCountdown] = React.useState(15);
React.useEffect(() => { setCountdown(15); }, [synthesis]);
React.useEffect(() => {
if (countdown <= 0) return;
const t = setTimeout(() => setCountdown(c => c - 1), 1000);
return () => clearTimeout(t);
}, [countdown]);
// Soumission effective après confirmation du consentement (ou si déjà consenti) // Soumission effective après confirmation du consentement (ou si déjà consenti)
const doActualSubmit = (data: SubmitIdeaValues) => { const doActualSubmit = (data: SubmitIdeaValues) => {
if (captchaToken) { if (captchaToken) {
@@ -544,7 +552,7 @@ export default function Home() {
<Users className="h-3.5 w-3.5" /> Synthèse des contributions <Users className="h-3.5 w-3.5" /> Synthèse des contributions
</h2> </h2>
<p className="text-xs text-muted-foreground mt-0.5"> <p className="text-xs text-muted-foreground mt-0.5">
Mise à jour à chaque nouvelle contribution Mise à jour à chaque nouvelle contribution · <span className="font-mono">{countdown}s</span>
</p> </p>
</div> </div>
<div className="flex items-center gap-2 flex-shrink-0"> <div className="flex items-center gap-2 flex-shrink-0">