feat(frontend): i18n common + nav + auth (Layout, LoginPage, ProtectedRoute)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Knacky
2026-06-21 23:23:36 +02:00
parent 3723bd009b
commit fe597e9be3
4 changed files with 19 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
import { useEffect } from 'react';
import { Navigate, Outlet, useLocation } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { useAuth } from '@/hooks/useAuth';
import { useToast } from '@/hooks/useToast';
import type { Role } from '@/api/types';
@@ -23,6 +24,7 @@ export function ProtectedRoute({
}: ProtectedRouteProps): JSX.Element {
const { user, status } = useAuth();
const { push } = useToast();
const { t } = useTranslation();
const location = useLocation();
const roleDenied = Boolean(
@@ -31,12 +33,12 @@ export function ProtectedRoute({
useEffect(() => {
if (roleDenied) {
push('Accès refusé', 'error');
push(t('auth.forbidden'), 'error');
}
}, [roleDenied, push]);
}, [roleDenied, push, t]);
if (status === 'loading') {
return <LoadingState label="Loading session…" />;
return <LoadingState label={t('auth.loadingSession')} />;
}
if (status === 'unauthenticated' || !user) {