spb/trouve-ka Public
Trouve-KA — moteur de recherche web indépendant, Québec-first. Crawler distribué, index OpenSearch, ranking bilingue, galerie d'images. En prod : www.trouve-ka.com
Python 76.8%
TypeScript 15.7%
SQL 3.9%
Shell 1.4%
CSS 1.3%
Dockerfile 0.7%
1/**2 * Trouve-KA — compteur vivant des pages indexées (homepage)3 * Author: Simon-Pierre Boucher4 * Contact: contact@spboucher.ai5 */67"use client";89import { useEffect, useState } from "react";10import { formatNumber } from "@/lib/format";11import type { StatusResponse } from "@/lib/types";1213const REFRESH_MS = 30_000;1415export function IndexCounter() {16 const [status, setStatus] = useState<StatusResponse | null>(null);1718 useEffect(() => {19 let active = true;2021 async function load() {22 try {23 const res = await fetch("/api/status");24 if (!res.ok) return;25 const data = (await res.json()) as StatusResponse;26 if (active) setStatus(data);27 } catch {28 // Backend injoignable : le compteur reste simplement absent.29 }30 }3132 load();33 const id = setInterval(load, REFRESH_MS);34 return () => {35 active = false;36 clearInterval(id);37 };38 }, []);3940 // Espace réservé pour éviter tout saut de mise en page.41 if (!status) {42 return (43 <span aria-hidden="true" className="stat-chip invisible">44 <span className="pulse-dot" />45 46 </span>47 );48 }4950 return (51 <span className="stat-chip">52 <span className="pulse-dot" aria-hidden="true" />53 {formatNumber(status.pages_indexed)} pages indexées54 </span>55 );56}57