diff --git a/src/app/forgot-password/page.tsx b/src/app/forgot-password/page.tsx index ba571e6ad..00b43ea20 100644 --- a/src/app/forgot-password/page.tsx +++ b/src/app/forgot-password/page.tsx @@ -7,6 +7,7 @@ import { AuthFooterLink, AuthHeading, } from "@/components/auth/AuthShell"; import { postJson } from "@/lib/api/fetch"; +import { ROUTES } from "@/config/auth"; export default function ForgotPasswordPage() { const [email, setEmail] = useState(""); @@ -35,7 +36,7 @@ export default function ForgotPasswordPage() { title="Check your email" description={`If an account exists for ${email}, we've sent a reset link. Check your inbox (and spam folder).`} /> - ← Back to sign in + ← Back to sign in ); } @@ -74,7 +75,7 @@ export default function ForgotPasswordPage() {

Remember it?{" "} - + Sign in

diff --git a/src/app/invite/[token]/page.tsx b/src/app/invite/[token]/page.tsx index 7e710befd..0a0b1fc6c 100644 --- a/src/app/invite/[token]/page.tsx +++ b/src/app/invite/[token]/page.tsx @@ -5,6 +5,7 @@ import { useRouter } from "next/navigation"; import Link from "next/link"; import { signIn } from "next-auth/react"; import { getJson, postJson } from "@/lib/api/fetch"; +import { ROUTES } from "@/config/auth"; import { AuthShell, AuthCard, AuthField, AuthInput, AuthSubmitButton, AuthIconBadge, AuthHeading, } from "@/components/auth/AuthShell"; @@ -53,9 +54,9 @@ export default function InvitePage({ params }: { params: Promise<{ token: string const result = await signIn("user-password", { userId: data.userId, password, redirect: false }); if (result?.ok) { - router.push("/today"); + router.push(ROUTES.APP_HOME); } else { - router.push("/sign-in"); + router.push(ROUTES.SIGN_IN); } } catch { setError("Something went wrong."); @@ -88,7 +89,7 @@ export default function InvitePage({ params }: { params: Promise<{ token: string {isError && (

- Sign in{" "} + Sign in{" "} if you already have an account.

)} diff --git a/src/app/onboarding/page.tsx b/src/app/onboarding/page.tsx index 7dd77679a..9da587dc7 100644 --- a/src/app/onboarding/page.tsx +++ b/src/app/onboarding/page.tsx @@ -6,6 +6,7 @@ import { useSession } from "next-auth/react"; import { Loader2, GitBranch, Star, Lock } from "lucide-react"; import { normalizeUsername } from "@/lib/username"; import { postJson, patchJson, throwApiError } from "@/lib/api/fetch"; +import { ROUTES } from "@/config/auth"; import { AuthShell, AuthCard, @@ -137,7 +138,7 @@ export default function OnboardingPage() { if (orgsData.orgs && orgsData.orgs.length > 0) { await patchJson("/api/me", { onboardedAt: new Date().toISOString() }); await update(); - router.push("/today"); + router.push(ROUTES.APP_HOME); return; } @@ -168,7 +169,7 @@ export default function OnboardingPage() { } await patchJson("/api/me", { onboardedAt: new Date().toISOString() }); await update(); - router.push("/today"); + router.push(ROUTES.APP_HOME); } catch (e) { setError(e instanceof Error ? e.message : "Something went wrong"); } finally { diff --git a/src/app/page.tsx b/src/app/page.tsx index 68bb594a4..adf54b7f6 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -12,30 +12,25 @@ import { LANDING_WHITEPAPER_LABEL, } from "@/config/marketing"; import { isStripeReady } from "@/lib/stripe"; - -const NAV_LINKS = [ - { label: "Features", href: "#features" }, - { label: "Pricing", href: "#pricing" }, - { label: "Whitepaper", href: "/whitepaper" }, -]; +import { ROUTES, PUBLIC_NAV_LINKS } from "@/config/auth"; export default async function LandingPage() { if ((await getUserCount()) === 0) redirect("/setup"); const session = await auth(); - if (session?.user) redirect("/today"); + if (session?.user) redirect(ROUTES.APP_HOME); const stripeReady = isStripeReady(); return ( - + Sign in - + Get started → @@ -55,7 +50,7 @@ export default async function LandingPage() {

- + Get started → @@ -116,8 +111,8 @@ export default async function LandingPage() { }) { const { token } = use(params); @@ -30,7 +31,7 @@ export default function ResetPasswordPage({ params }: { params: Promise<{ token: const data = await res.json(); if (!res.ok) { setError(data.error ?? "Reset failed."); return; } setDone(true); - setTimeout(() => router.push("/sign-in"), 2000); + setTimeout(() => router.push(ROUTES.SIGN_IN), 2000); } catch { setError("Something went wrong. Please try again."); } finally { @@ -94,7 +95,7 @@ export default function ResetPasswordPage({ params }: { params: Promise<{ token:

Link expired?{" "} - + Request a new one

diff --git a/src/app/setup/page.tsx b/src/app/setup/page.tsx index 5bd65fc1e..cb7e6096f 100644 --- a/src/app/setup/page.tsx +++ b/src/app/setup/page.tsx @@ -4,6 +4,7 @@ import { useState } from "react"; import { useRouter } from "next/navigation"; import Link from "next/link"; import { postJson } from "@/lib/api/fetch"; +import { ROUTES } from "@/config/auth"; import { AuthShell, AuthCard, AuthField, AuthInput, AuthSubmitButton, AuthIconBadge, AuthHeading, } from "@/components/auth/AuthShell"; @@ -27,7 +28,7 @@ export default function SetupPage() { const res = await postJson("/api/setup", { name, password }); const data = await res.json(); if (!res.ok) { setError(data.error ?? "Setup failed."); return; } - router.push("/sign-in"); + router.push(ROUTES.SIGN_IN); } catch { setError("Something went wrong."); } finally { @@ -91,7 +92,7 @@ export default function SetupPage() {

Already have an account?{" "} - + Sign in

diff --git a/src/app/sign-up/page.tsx b/src/app/sign-up/page.tsx index f19050187..51bc7afe0 100644 --- a/src/app/sign-up/page.tsx +++ b/src/app/sign-up/page.tsx @@ -8,6 +8,7 @@ import { AuthFooterLink, AuthHeading, } from "@/components/auth/AuthShell"; import { postJson } from "@/lib/api/fetch"; +import { ROUTES } from "@/config/auth"; export default function SignUpPage() { const router = useRouter(); @@ -32,9 +33,9 @@ export default function SignUpPage() { const result = await signIn("email-password", { email, password, redirect: false }); if (result?.ok) { - router.push("/onboarding"); + router.push(ROUTES.ONBOARDING); } else { - router.push("/sign-in"); + router.push(ROUTES.SIGN_IN); } } catch { setError("Something went wrong. Please try again."); @@ -107,7 +108,7 @@ export default function SignUpPage() { - + Already have an account? Sign in → diff --git a/src/app/verify-email/page.tsx b/src/app/verify-email/page.tsx index d23e45bca..150431f88 100644 --- a/src/app/verify-email/page.tsx +++ b/src/app/verify-email/page.tsx @@ -8,6 +8,7 @@ import { AuthFooterLink, AuthHeading, } from "@/components/auth/AuthShell"; import { postJson } from "@/lib/api/fetch"; +import { ROUTES } from "@/config/auth"; function VerifyEmailInner() { const params = useSearchParams(); @@ -80,7 +81,7 @@ function VerifyEmailInner() { )} - ← Back to sign in + ← Back to sign in ); } @@ -122,7 +123,7 @@ function VerifyEmailInner() { )} - ← Back to sign in + ← Back to sign in ); } diff --git a/src/app/whitepaper/page.tsx b/src/app/whitepaper/page.tsx index 21d2310c0..794200a53 100644 --- a/src/app/whitepaper/page.tsx +++ b/src/app/whitepaper/page.tsx @@ -4,6 +4,7 @@ import Link from "next/link"; import type { Metadata } from "next"; import { PublicSurface } from "@/components/public/PublicSurface"; import { parseThoughtBlocks } from "@/lib/thoughts-content"; +import { ROUTES } from "@/config/auth"; export const metadata: Metadata = { title: "Whitepaper — Cockpit", @@ -44,7 +45,7 @@ export default function WhitepaperPage() { return ( + Get started → )} @@ -147,7 +148,7 @@ export default function WhitepaperPage() {

Ready to close the execution gap?

Start using Cockpit as your builder operating system.

- + Get started → diff --git a/src/components/auth/AuthShell.tsx b/src/components/auth/AuthShell.tsx index d9677b64e..b99fe4cd0 100644 --- a/src/components/auth/AuthShell.tsx +++ b/src/components/auth/AuthShell.tsx @@ -1,12 +1,7 @@ import Link from "next/link"; -import { PublicSurface, type NavLink } from "@/components/public/PublicSurface"; +import { PublicSurface } from "@/components/public/PublicSurface"; import { PUBLIC_SURFACE } from "@/config/ui"; - -const AUTH_NAV_LINKS: NavLink[] = [ - { label: "Features", href: "/#features" }, - { label: "Pricing", href: "/#pricing" }, - { label: "Whitepaper", href: "/whitepaper" }, -]; +import { PUBLIC_NAV_LINKS } from "@/config/auth"; export function AuthField({ label, @@ -92,7 +87,7 @@ export function AuthShell({ navRight?: React.ReactNode; }) { return ( - +
("email"); const [email, setEmail] = useState(""); @@ -200,7 +201,7 @@ function FormInner({ />
Forgot password? @@ -217,7 +218,7 @@ function FormInner({ />

No account?{" "} - + Create one free →

diff --git a/src/components/shell/sidebar/SidebarFooter.tsx b/src/components/shell/sidebar/SidebarFooter.tsx index 710713c21..4430caf94 100644 --- a/src/components/shell/sidebar/SidebarFooter.tsx +++ b/src/components/shell/sidebar/SidebarFooter.tsx @@ -5,6 +5,7 @@ import { signOut } from "next-auth/react"; import { ThemeToggle } from "../ThemeToggle"; import { cn } from "@/lib/utils"; import { usePrivateZone } from "@/hooks/use-private-zone"; +import { ROUTES } from "@/config/auth"; export function SidebarFooter({ collapsed, @@ -43,7 +44,7 @@ export function SidebarFooter({ )}