Files
website/src/AppRouter.tsx
highperfocused 3f9676a2df feat: rework the app as a windowed desktop-OS shell (#10)
Introduces a macOS-like desktop metaphor at /os: a wallpaper, menu bar
(wordmark/window-switcher, live relay-status indicator, clock, login),
and a dock. Explore, Dashboard, My Events, Export Following and
Messages are ported into windowed apps sharing one window-manager
(drag/resize via Pointer Events, focus/z-order, minimize/maximize/
close, layout persisted to localStorage). Legacy routes now redirect
into the shell with the matching app opened, so existing links keep
working.

On screens under 768px the same window-manager state renders as a
phone-OS-style shell instead: a home-screen app grid, one full-screen
app at a time, and the dock as a bottom tab bar — "going home" just
minimizes the active app, so switching apps never loses state.

Also: a Nostr-key lock screen gates the shell for logged-out users
(with a guest bypass), Cmd/Ctrl+` cycles window focus, windows are
role="dialog" with managed focus, and the previously-unrouted Messages
app is wired up (it was missing its DMProvider, so it crashed on
mount — fixed by scoping DMProvider to the Messages app).

See docs/DESKTOP_OS.md for the architecture.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BYiUtZMQeA5RHggQw73wto
2026-09-05 21:41:31 +02:00

36 lines
1.7 KiB
TypeScript

import { BrowserRouter, Navigate, Route, Routes } from "react-router-dom";
import { ScrollToTop } from "./components/ScrollToTop";
import Index from "./pages/Index";
import { Desktop } from "./os/Desktop";
import { NIP19Page } from "./pages/NIP19Page";
import { Terms } from "./pages/Terms";
import { Privacy } from "./pages/Privacy";
import NotFound from "./pages/NotFound";
export function AppRouter() {
return (
<BrowserRouter basename={import.meta.env.BASE_URL}>
<ScrollToTop />
<Routes>
<Route path="/" element={<Index />} />
{/* The desktop-OS shell (see docs/DESKTOP_OS.md). /os/<app-path> deep-links
into the shell with that app already open, then normalizes to /os. */}
<Route path="/os/*" element={<Desktop />} />
{/* Legacy page routes now open their app inside the desktop shell. */}
<Route path="/explore" element={<Navigate to="/os/explore" replace />} />
<Route path="/dashboard" element={<Navigate to="/os/dashboard" replace />} />
<Route path="/dashboard/events" element={<Navigate to="/os/dashboard/events" replace />} />
<Route path="/dashboard/export" element={<Navigate to="/os/dashboard/export" replace />} />
<Route path="/messages" element={<Navigate to="/os/messages" replace />} />
<Route path="/terms" element={<Terms />} />
<Route path="/privacy" element={<Privacy />} />
{/* NIP-19 route for npub1, note1, naddr1, nevent1, nprofile1 */}
<Route path="/:nip19" element={<NIP19Page />} />
{/* ADD ALL CUSTOM ROUTES ABOVE THE CATCH-ALL "*" ROUTE */}
<Route path="*" element={<NotFound />} />
</Routes>
</BrowserRouter>
);
}
export default AppRouter;