From 6894be2d417b55c78d5641734a944ecb7c849e0b Mon Sep 17 00:00:00 2001 From: jyswee Date: Thu, 23 Jul 2026 22:10:41 +0000 Subject: [PATCH] Seed: dashboard template (24 files) --- src/App.tsx | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 src/App.tsx diff --git a/src/App.tsx b/src/App.tsx new file mode 100644 index 0000000..6459711 --- /dev/null +++ b/src/App.tsx @@ -0,0 +1,73 @@ +import { useState } from "react"; +import { BrowserRouter, Routes, Route } from "react-router-dom"; +import { Activity } from "lucide-react"; +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; +import { useAuth } from "@/hooks/use-tygarun"; +import IndexPage from "@/pages/Index"; +import AnalyticsPage from "@/pages/Analytics"; +import UsersPage from "@/pages/Users"; +import SettingsPage from "@/pages/Settings"; +import ReportsPage from "@/pages/Reports"; +import ProfilePage from "@/pages/Profile"; + +// Auth gate: when tyga.run is connected, require a real sign-in before the +// dashboard renders. In demo/seed mode (not connected) the dashboard stays +// fully walkable so the template previews without a backend. +function AuthGate({ children }: { children: React.ReactNode }) { + const { isSignedIn, connected, signin, loading, error } = useAuth(); + const [email, setEmail] = useState(""); + const [password, setPassword] = useState(""); + + if (!connected || isSignedIn) return <>{children}; + + const handleSignin = async (e: React.FormEvent) => { + e.preventDefault(); + try { await signin(email, password); } catch { /* error surfaced below */ } + }; + + return ( +
+
+
+
+ +
+

Sign in to continue

+
+
+ + setEmail(e.target.value)} placeholder="you@example.com" /> +
+
+ + setPassword(e.target.value)} placeholder="••••••••" /> +
+ {error &&

{error}

} + +
+
+ ); +} + +function App() { + return ( + + + + } /> + } /> + } /> + } /> + } /> + } /> + + + + ); +} + +export default App;