chore: remove agent-oriented comments from the codebase #25
+29
-25
@@ -3,6 +3,7 @@ import { Spinner } from "./ui/index.js";
|
||||
import { useSession } from "./lib/session.js";
|
||||
import { AppShell } from "./components/AppShell.js";
|
||||
import { AuthLayout } from "./components/AuthLayout.js";
|
||||
import { DocumentTitle } from "./components/DocumentTitle.js";
|
||||
import { Login } from "./pages/Login.js";
|
||||
import { ForgotPassword } from "./pages/ForgotPassword.js";
|
||||
import { ResetPassword } from "./pages/ResetPassword.js";
|
||||
@@ -42,39 +43,42 @@ const RequireAdmin = () => {
|
||||
};
|
||||
|
||||
export const App = () => (
|
||||
<Routes>
|
||||
<Route element={<AuthLayout />}>
|
||||
<Route path="/login" element={<Login />} />
|
||||
<Route path="/forgot-password" element={<ForgotPassword />} />
|
||||
<Route path="/reset-password" element={<ResetPassword />} />
|
||||
<Route path="/confirm-email" element={<ConfirmEmail />} />
|
||||
</Route>
|
||||
|
||||
<Route element={<RequireAuth />}>
|
||||
<>
|
||||
<DocumentTitle />
|
||||
<Routes>
|
||||
<Route element={<AuthLayout />}>
|
||||
<Route path="/change-password" element={<ChangePassword />} />
|
||||
<Route path="/login" element={<Login />} />
|
||||
<Route path="/forgot-password" element={<ForgotPassword />} />
|
||||
<Route path="/reset-password" element={<ResetPassword />} />
|
||||
<Route path="/confirm-email" element={<ConfirmEmail />} />
|
||||
</Route>
|
||||
|
||||
<Route element={<RequireReady />}>
|
||||
<Route element={<AppShell />}>
|
||||
<Route path="/files" element={<Browser />} />
|
||||
<Route path="/favorites" element={<Favorites />} />
|
||||
<Route path="/search" element={<Search />} />
|
||||
<Route path="/gallery" element={<Gallery />} />
|
||||
<Route path="/trash" element={<Trash />} />
|
||||
<Route path="/profile" element={<Profile />} />
|
||||
<Route element={<RequireAuth />}>
|
||||
<Route element={<AuthLayout />}>
|
||||
<Route path="/change-password" element={<ChangePassword />} />
|
||||
</Route>
|
||||
|
||||
<Route element={<RequireAdmin />}>
|
||||
<Route element={<RequireReady />}>
|
||||
<Route element={<AppShell />}>
|
||||
<Route path="/admin/comptes" element={<AdminUsers />} />
|
||||
<Route path="/admin/stockage" element={<AdminStorage />} />
|
||||
<Route path="/admin/audit" element={<AdminAudit />} />
|
||||
<Route path="/files" element={<Browser />} />
|
||||
<Route path="/favorites" element={<Favorites />} />
|
||||
<Route path="/search" element={<Search />} />
|
||||
<Route path="/gallery" element={<Gallery />} />
|
||||
<Route path="/trash" element={<Trash />} />
|
||||
<Route path="/profile" element={<Profile />} />
|
||||
</Route>
|
||||
|
||||
<Route element={<RequireAdmin />}>
|
||||
<Route element={<AppShell />}>
|
||||
<Route path="/admin/comptes" element={<AdminUsers />} />
|
||||
<Route path="/admin/stockage" element={<AdminStorage />} />
|
||||
<Route path="/admin/audit" element={<AdminAudit />} />
|
||||
</Route>
|
||||
</Route>
|
||||
</Route>
|
||||
</Route>
|
||||
</Route>
|
||||
|
||||
<Route path="*" element={<Navigate to="/files" replace />} />
|
||||
</Routes>
|
||||
<Route path="*" element={<Navigate to="/files" replace />} />
|
||||
</Routes>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
import { useEffect } from "react";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import { useI18n } from "../lib/i18n.js";
|
||||
|
||||
const BRAND = "CoHaiSe Cloud";
|
||||
|
||||
/**
|
||||
* Clef i18n (chaine source) par section. Le titre de l'onglet devient
|
||||
* « <Section> | CoHaiSe Cloud », dans la langue courante. Les chemins sont
|
||||
* compares en prefixe afin de couvrir les eventuels sous-chemins.
|
||||
*/
|
||||
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