chore: remove agent-oriented comments from the codebase (#25)
CD — Deployment / deploy (push) Successful in 23s
CD — Deployment / deploy (push) Successful in 23s
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]>
This commit was merged in pull request #25.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
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;
|
||||
};
|
||||
Reference in New Issue
Block a user