e69553af02
Backend: - Auth: split routes into RegisterPublicRoutes + RegisterProtectedRoutes - Auth: PATCH /me for profile updates (display_name, bio, accent_color, status_text) - Auth: Gravatar fallback for avatars on register - DB: users table now has bio, accent_color, status_text columns - giphy/client.go: Search() and GetTrending() against Giphy API - upload/handlers.go: MinIO file upload + serve - config: added GiphyConfig and MinIO config - cmd/server: wired giphy (/gifs/search, /gifs/trending), upload (/upload), files (/files/*) routes Frontend: - auth store: updated User interface with new profile fields, added updateProfile() - UserSettings.tsx: terminal-styled profile editor (display_name, bio, accent_color, status_text, avatar upload) - GiphyPicker.tsx: terminal-styled GIF picker with search + trending - ChatArea.tsx: integrated [GIF] button into message input - App.tsx: imports UserSettings, added /settings route
53 lines
1.7 KiB
TypeScript
53 lines
1.7 KiB
TypeScript
import { BrowserRouter, Routes, Route, Navigate, Link } from 'react-router-dom';
|
|
import { LoginForm } from './components/LoginForm.tsx';
|
|
import { Layout } from './components/Layout.tsx';
|
|
import { ChatArea } from './components/ChatArea.tsx';
|
|
import { UserSettings } from './components/UserSettings.tsx';
|
|
import { useAuthStore } from './stores/auth.ts';
|
|
|
|
function ProtectedRoute({ children }: { children: React.ReactNode }) {
|
|
const isAuthenticated = useAuthStore((state) => state.isAuthenticated);
|
|
return isAuthenticated ? <>{children}</> : <Navigate to="/login" replace />;
|
|
}
|
|
|
|
function App() {
|
|
return (
|
|
<BrowserRouter>
|
|
<Routes>
|
|
<Route path="/login" element={<LoginForm />} />
|
|
<Route
|
|
path="/settings"
|
|
element={
|
|
<ProtectedRoute>
|
|
<div className="h-full w-full flex flex-col bg-gb-bg">
|
|
<header className="flex items-center gap-4 px-4 py-2 border-b border-gb-bg-t bg-gb-bg-s">
|
|
<Link to="/" className="text-gb-fg-f hover:text-gb-aqua font-mono text-sm">
|
|
← [BACK]
|
|
</Link>
|
|
<span className="text-gb-orange font-mono text-sm">SETTINGS</span>
|
|
</header>
|
|
<div className="flex-1 overflow-hidden">
|
|
<UserSettings />
|
|
</div>
|
|
</div>
|
|
</ProtectedRoute>
|
|
}
|
|
/>
|
|
<Route
|
|
path="/"
|
|
element={
|
|
<ProtectedRoute>
|
|
<Layout />
|
|
</ProtectedRoute>
|
|
}
|
|
>
|
|
<Route index element={<ChatArea />} />
|
|
<Route path="channels/:channelId" element={<ChatArea />} />
|
|
</Route>
|
|
</Routes>
|
|
</BrowserRouter>
|
|
);
|
|
}
|
|
|
|
export default App;
|