-
Notifications
You must be signed in to change notification settings - Fork 0
Dev #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dev #2
Changes from all commits
fc3d721
6c67b2d
1d6eab4
60d277b
8abd964
416e9ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>Townhall</title> | ||
| <meta name="description" content="Community chat. Nothing else." /> | ||
| <link rel="icon" href="/favicon.ico" /> | ||
| </head> | ||
| <body> | ||
| <div id="root"></div> | ||
| <script type="module" src="/src/main.tsx"></script> | ||
| </body> | ||
| </html> |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,10 +4,10 @@ | |
| "type": "module", | ||
| "private": true, | ||
| "scripts": { | ||
| "dev": "next dev --port 3000", | ||
| "build": "next build", | ||
| "start": "next start -p ${PORT:-3000}", | ||
| "check-types": "next typegen && tsc --noEmit" | ||
| "dev": "vite --port 3000", | ||
| "build": "vite build", | ||
| "start": "vite preview --port 3000", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
🤖 Prompt for AI Agents |
||
| "check-types": "tsc --noEmit" | ||
| }, | ||
| "dependencies": { | ||
| "@repo/api-client": "workspace:*", | ||
|
|
@@ -16,11 +16,10 @@ | |
| "@repo/ui": "workspace:*", | ||
| "@tailwindcss/postcss": "^4.1.18", | ||
| "@tanstack/react-query": "^5.90.21", | ||
| "@tanstack/react-router": "^1.120.3", | ||
| "class-variance-authority": "^0.7.1", | ||
| "clsx": "^2.1.1", | ||
| "dotenv": "^17.2.4", | ||
| "lucide-react": "^0.563.0", | ||
| "next": "16.1.6", | ||
| "next-themes": "^0.4.6", | ||
| "postcss": "^8.5.6", | ||
| "radix-ui": "^1.4.3", | ||
|
|
@@ -32,8 +31,13 @@ | |
| }, | ||
| "devDependencies": { | ||
| "@repo/typescript-config": "workspace:*", | ||
| "@tanstack/react-query-devtools": "^5.91.3", | ||
| "@tanstack/react-router-devtools": "^1.120.3", | ||
| "@tanstack/router-plugin": "^1.120.3", | ||
| "@types/react": "19.2.13", | ||
| "@types/react-dom": "19.2.3", | ||
| "tw-animate-css": "^1.4.0" | ||
| "@vitejs/plugin-react": "^4.5.2", | ||
| "tw-animate-css": "^1.4.0", | ||
| "vite": "^6.3.5" | ||
| } | ||
| } | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import { QueryClient, QueryClientProvider } from "@tanstack/react-query" | ||
| import { ReactQueryDevtools } from "@tanstack/react-query-devtools" | ||
| import { createRouter, RouterProvider } from "@tanstack/react-router" | ||
| import { ThemeProvider } from "next-themes" | ||
| import { StrictMode } from "react" | ||
| import { createRoot } from "react-dom/client" | ||
| import "@repo/ui/globals.css" | ||
| import "./styles/fonts.css" | ||
| import { routeTree } from "./routeTree.gen" | ||
|
|
||
| const queryClient = new QueryClient({ | ||
| defaultOptions: { | ||
| queries: { | ||
| staleTime: 60 * 1000, | ||
| }, | ||
| }, | ||
| }) | ||
|
|
||
| const router = createRouter({ routeTree }) | ||
|
|
||
| declare module "@tanstack/react-router" { | ||
| interface Register { | ||
| router: typeof router | ||
| } | ||
| } | ||
|
|
||
| const rootElement = document.getElementById("root") | ||
| if (!rootElement) throw new Error("Root element not found") | ||
|
|
||
| createRoot(rootElement).render( | ||
| <StrictMode> | ||
| <QueryClientProvider client={queryClient}> | ||
| <ThemeProvider | ||
| attribute="class" | ||
| defaultTheme="dark" | ||
| enableSystem | ||
| disableTransitionOnChange | ||
| > | ||
| <RouterProvider router={router} /> | ||
| </ThemeProvider> | ||
| <ReactQueryDevtools initialIsOpen={false} buttonPosition="bottom-right" /> | ||
| </QueryClientProvider> | ||
| </StrictMode> | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { createRootRoute, Outlet } from "@tanstack/react-router" | ||
| import { lazy, Suspense } from "react" | ||
|
|
||
| const TanStackRouterDevtools = import.meta.env.DEV | ||
| ? lazy(() => | ||
| import("@tanstack/react-router-devtools").then((mod) => ({ | ||
| default: mod.TanStackRouterDevtools, | ||
| })) | ||
| ) | ||
| : () => null | ||
|
|
||
| export const Route = createRootRoute({ | ||
| component: () => ( | ||
| <> | ||
| <Outlet /> | ||
| <Suspense> | ||
| <TanStackRouterDevtools /> | ||
| </Suspense> | ||
| </> | ||
| ), | ||
| }) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import { authClient } from "@repo/auth/client" | ||
| import { createFileRoute, Outlet, useNavigate } from "@tanstack/react-router" | ||
| import { useEffect } from "react" | ||
|
|
||
| export const Route = createFileRoute("/_authenticated")({ | ||
| component: AuthenticatedLayout, | ||
| }) | ||
|
|
||
| function AuthenticatedLayout() { | ||
| const navigate = useNavigate() | ||
| const { data: session, isPending } = authClient.useSession() | ||
|
|
||
| useEffect(() => { | ||
| if (!isPending && !session) { | ||
| navigate({ to: "/login" }) | ||
| } | ||
| }, [isPending, session, navigate]) | ||
|
|
||
| if (isPending) { | ||
| return ( | ||
| <div className="flex h-screen items-center justify-center"> | ||
| <div className="text-muted-foreground text-sm">Loading...</div> | ||
| </div> | ||
| ) | ||
| } | ||
|
|
||
| if (!session) { | ||
| return null | ||
| } | ||
|
|
||
| return <Outlet /> | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import { authClient } from "@repo/auth/client" | ||
| import { Button } from "@repo/ui/components/button" | ||
| import { createFileRoute } from "@tanstack/react-router" | ||
|
|
||
| export const Route = createFileRoute("/_authenticated/")({ | ||
| component: Home, | ||
| }) | ||
|
|
||
| function Home() { | ||
| const { data: session } = authClient.useSession() | ||
|
|
||
| return ( | ||
| <div className="flex h-screen flex-col items-center justify-center gap-4"> | ||
| <h1 className="text-2xl font-bold">Townhall</h1> | ||
| {session && ( | ||
| <p className="text-muted-foreground text-sm"> | ||
| Welcome, {session.user.name} | ||
| </p> | ||
| )} | ||
| <Button variant="outline" size="sm" onClick={() => authClient.signOut()}> | ||
| Sign out | ||
| </Button> | ||
| </div> | ||
| ) | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.