feat(frontend): scaffold Tailwind design system + routing + auth callback

- Tailwind v3 + PostCSS + autoprefixer
- BrowserRouter with Layout shell (Header, theme toggle dark/light)
- Pages: HomePage, CallbackPage (SuperOAuth callback handler)
- hooks/useAuth.ts + lib/api.ts (API client base)
- styles/index.css (Tailwind directives)
- Theme persisted in localStorage (od-theme)
This commit is contained in:
2026-03-14 07:15:19 +01:00
parent f3e392ff1b
commit 25733ee3db
15 changed files with 1304 additions and 4 deletions

View File

@@ -0,0 +1,31 @@
import { useState, useEffect } from 'react';
import { apiFetch } from '../lib/api';
export interface User {
id: number;
email: string;
nickname: string;
}
interface AuthState {
user: User | null;
loading: boolean;
}
export function useAuth(): AuthState {
const [user, setUser] = useState<User | null>(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
let cancelled = false;
apiFetch<User>('/profile')
.then((u) => { if (!cancelled) setUser(u); })
.catch(() => { if (!cancelled) setUser(null); })
.finally(() => { if (!cancelled) setLoading(false); });
return () => { cancelled = true; };
}, []);
return { user, loading };
}