diff --git a/apps/web/src/components/header.tsx b/apps/web/src/components/header.tsx index c809782..fe5d466 100644 --- a/apps/web/src/components/header.tsx +++ b/apps/web/src/components/header.tsx @@ -4,31 +4,13 @@ import { ModeToggle } from "./mode-toggle"; import UserMenu from "./user-menu"; export default function Header() { - const links = [ - { to: "/", label: "Home" }, - { to: "/dashboard", label: "Dashboard" }, - { to: "/dashboard/servers", label: "Servers" }, - { to: "/dashboard/services", label: "Services" }, - { to: "/dashboard/domains", label: "Domains" }, - { to: "/dashboard/notes", label: "Notes" }, - ] as const; - return (
- + minmon -
diff --git a/apps/web/src/components/sign-in-form.tsx b/apps/web/src/components/sign-in-form.tsx index 2c3060e..119a020 100644 --- a/apps/web/src/components/sign-in-form.tsx +++ b/apps/web/src/components/sign-in-form.tsx @@ -129,8 +129,8 @@ export default function SignInForm() {

Student demo flow uses administrator sign-in only.

- - Return to homepage + + Open dashboard after sign in
diff --git a/apps/web/src/routes/index.tsx b/apps/web/src/routes/index.tsx index 4ba9b8f..1ef3955 100644 --- a/apps/web/src/routes/index.tsx +++ b/apps/web/src/routes/index.tsx @@ -1,51 +1,14 @@ -import { useQuery } from "@tanstack/react-query"; -import { createFileRoute } from "@tanstack/react-router"; +import { createFileRoute, redirect } from "@tanstack/react-router"; -import { trpc } from "@/utils/trpc"; +import { authClient } from "@/lib/auth-client"; export const Route = createFileRoute("/")({ - component: HomeComponent, + beforeLoad: async () => { + const session = await authClient.getSession(); + + throw redirect({ + to: session.data ? "/dashboard" : "/login", + }); + }, + component: () => null, }); - -const TITLE_TEXT = ` - ██████╗ ███████╗████████╗████████╗███████╗██████╗ - ██╔══██╗██╔════╝╚══██╔══╝╚══██╔══╝██╔════╝██╔══██╗ - ██████╔╝█████╗ ██║ ██║ █████╗ ██████╔╝ - ██╔══██╗██╔══╝ ██║ ██║ ██╔══╝ ██╔══██╗ - ██████╔╝███████╗ ██║ ██║ ███████╗██║ ██║ - ╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═╝ - - ████████╗ ███████╗████████╗ █████╗ ██████╗██╗ ██╗ - ╚══██╔══╝ ██╔════╝╚══██╔══╝██╔══██╗██╔════╝██║ ██╔╝ - ██║ ███████╗ ██║ ███████║██║ █████╔╝ - ██║ ╚════██║ ██║ ██╔══██║██║ ██╔═██╗ - ██║ ███████║ ██║ ██║ ██║╚██████╗██║ ██╗ - ╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ - `; - -function HomeComponent() { - const healthCheck = useQuery(trpc.healthCheck.queryOptions()); - - return ( -
-
{TITLE_TEXT}
-
-
-

API Status

-
-
- - {healthCheck.isLoading - ? "Checking..." - : healthCheck.data - ? "Connected" - : "Disconnected"} - -
-
-
-
- ); -}