Files
CoHaiSe-CLOUD/frontend/src/components/DocumentTitle.tsx
T
Gitea ActionsandEsiah d837817bcb
CD — Deployment / deploy (push) Successful in 23s
chore: remove agent-oriented comments from the codebase (#25)
PR automatique de chore/code-cleanup vers main.

---------

Co-authored-by: xEsiah <[email protected]>
Reviewed-on: #25
Reviewed-by: Esiah <[email protected]>
Co-authored-by: Gitea Actions <-[email protected]>
2026-11-04 15:04:00 +00:00

42 lines
1.1 KiB
TypeScript

import { useEffect } from "react";
import { useLocation } from "react-router-dom";
import { useI18n } from "../lib/i18n.js";
const BRAND = "CoHaiSe Cloud";
const SECTIONS: Array<[string, string]> = [
["/files", "Fichiers"],
["/favorites", "Favoris"],
["/search", "Recherche"],
["/gallery", "Galerie"],
["/trash", "Corbeille"],
["/profile", "Mon compte"],
["/admin/comptes", "Comptes"],
["/admin/stockage", "Stockage"],
["/admin/audit", "Journal"],
["/login", "Connexion"],
["/forgot-password", "Mot de passe oublié"],
["/reset-password", "Réinitialisation"],
["/confirm-email", "Confirmation"],
["/change-password", "Changement requis"],
];
const sectionFor = (pathname: string): string | undefined => {
const found = SECTIONS.find(
([path]) => pathname === path || pathname.startsWith(`${path}/`),
);
return found?.[1];
};
export const DocumentTitle = () => {
const { pathname } = useLocation();
const { t } = useI18n();
useEffect(() => {
const section = sectionFor(pathname);
document.title = section ? `${t(section)} | ${BRAND}` : BRAND;
}, [pathname, t]);
return null;
};