diff --git a/CLAUDE.md b/CLAUDE.md index 271b8cb..0c3923c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -18,6 +18,7 @@ The Worker serves both the API (`/api/*`) and the compiled frontend, so there is pnpm dev # turbo: runs both worker dev + web dev concurrently pnpm build # turbo: typecheck + build web pnpm typecheck # turbo: tsc --noEmit on both packages +pnpm test # turbo: worker unit tests (node --test, apps/worker/test/*.test.ts) pnpm deploy # turbo: builds web then deploys worker ``` diff --git a/apps/web/src/App.tsx b/apps/web/src/App.tsx index 5cfb4ed..6f76da1 100644 --- a/apps/web/src/App.tsx +++ b/apps/web/src/App.tsx @@ -1,6 +1,8 @@ import { lazy, type ReactNode, Suspense } from 'react'; -import { Navigate, Route, Routes } from 'react-router-dom'; +import { Link, Navigate, Route, Routes } from 'react-router-dom'; +import { Button } from './components/ui/button.tsx'; import { useAuth } from './contexts/AuthContext.tsx'; +import { useTranslation } from './i18n/index.tsx'; const AdminLayout = lazy(() => import('./components/layout/AdminLayout.tsx')); const DashboardLayout = lazy( @@ -27,23 +29,45 @@ function PageFallback() { ); } +// FE-R1: Shown instead of the login redirect when the session could not be +// restored for a transient reason — the refresh cookie may still be valid. +function SessionRestoreFailed() { + const { retryRestore } = useAuth(); + const { t } = useTranslation(); + return ( +
+ {t('auth.sessionRestoreFailed')} +
+ + + {t('auth.signInLink')} + ++ {t('auth.configLoadFailed')}{' '} + +
+ )} {registrationEnabled && (
{t('auth.noAccount')}{' '}
diff --git a/apps/web/src/pages/auth/RegisterPage.tsx b/apps/web/src/pages/auth/RegisterPage.tsx
index 577b84b..e7769fe 100644
--- a/apps/web/src/pages/auth/RegisterPage.tsx
+++ b/apps/web/src/pages/auth/RegisterPage.tsx
@@ -24,8 +24,13 @@ type Step = 'form' | 'verify';
export default function RegisterPage() {
const { t } = useTranslation();
const navigate = useNavigate();
- const { registrationEnabled } = useAppConfig();
- const { refreshUser, broadcastRefresh } = useAuth();
+ const {
+ registrationEnabled,
+ isLoading: configLoading,
+ loadFailed: configLoadFailed,
+ reload: reloadConfig,
+ } = useAppConfig();
+ const { refreshUser, broadcastRefresh, setPendingState } = useAuth();
const [step, setStep] = useState
+ {t('common.loading')}
+
+ {t('auth.configLoadFailed')}
+
+
+ {t('auth.backToLogin')}
+
+