Keep landing page public for signed-in users.
Remove the home-page auto-redirect so `/` stays a marketing page while app entry and onboarding gates remain unchanged.
This commit is contained in:
20
app/page.tsx
20
app/page.tsx
@@ -1,10 +1,8 @@
|
|||||||
import Link from "next/link";
|
|
||||||
import { Suspense } from "react";
|
import { Suspense } from "react";
|
||||||
|
|
||||||
import { PixelAvatar } from "@/components/avatar/pixel-avatar";
|
import { PixelAvatar } from "@/components/avatar/pixel-avatar";
|
||||||
import { LoggedInRedirect } from "@/components/layout/logged-in-redirect";
|
import { LandingHeroActions } from "@/components/layout/landing-hero-actions";
|
||||||
import { SiteFooter, SiteHeader } from "@/components/layout/site-header";
|
import { SiteFooter, SiteHeader } from "@/components/layout/site-header";
|
||||||
import { Button } from "@/components/ui/button";
|
|
||||||
import {
|
import {
|
||||||
Card,
|
Card,
|
||||||
CardContent,
|
CardContent,
|
||||||
@@ -12,15 +10,10 @@ import {
|
|||||||
CardHeader,
|
CardHeader,
|
||||||
CardTitle,
|
CardTitle,
|
||||||
} from "@/components/ui/card";
|
} from "@/components/ui/card";
|
||||||
import { routes } from "@/lib/routes";
|
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
return (
|
return (
|
||||||
<main className="flex min-h-svh flex-col">
|
<main className="flex min-h-svh flex-col">
|
||||||
<Suspense fallback={null}>
|
|
||||||
<LoggedInRedirect />
|
|
||||||
</Suspense>
|
|
||||||
|
|
||||||
<SiteHeader />
|
<SiteHeader />
|
||||||
|
|
||||||
<div className="mx-auto flex w-full max-w-5xl flex-1 flex-col gap-12 px-5 py-12">
|
<div className="mx-auto flex w-full max-w-5xl flex-1 flex-col gap-12 px-5 py-12">
|
||||||
@@ -37,14 +30,9 @@ export default function Home() {
|
|||||||
into a simple game. Keep streaks alive, take your once-per-day
|
into a simple game. Keep streaks alive, take your once-per-day
|
||||||
quiz, and watch your pet change with you.
|
quiz, and watch your pet change with you.
|
||||||
</p>
|
</p>
|
||||||
<div className="flex flex-wrap gap-3">
|
<Suspense fallback={null}>
|
||||||
<Button asChild size="lg">
|
<LandingHeroActions />
|
||||||
<Link href={routes.signUp}>Get started</Link>
|
</Suspense>
|
||||||
</Button>
|
|
||||||
<Button asChild size="lg" variant="outline">
|
|
||||||
<Link href={routes.login}>Sign in</Link>
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Card className="border-dashed">
|
<Card className="border-dashed">
|
||||||
|
|||||||
30
components/layout/landing-hero-actions.tsx
Normal file
30
components/layout/landing-hero-actions.tsx
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import Link from "next/link";
|
||||||
|
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { getSessionUser } from "@/lib/auth-helpers";
|
||||||
|
import { routes } from "@/lib/routes";
|
||||||
|
|
||||||
|
export async function LandingHeroActions() {
|
||||||
|
const user = await getSessionUser();
|
||||||
|
|
||||||
|
if (user) {
|
||||||
|
return (
|
||||||
|
<div className="flex flex-wrap gap-3">
|
||||||
|
<Button asChild size="lg">
|
||||||
|
<Link href={routes.avatar}>Go to your pet</Link>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex flex-wrap gap-3">
|
||||||
|
<Button asChild size="lg">
|
||||||
|
<Link href={routes.signUp}>Get started</Link>
|
||||||
|
</Button>
|
||||||
|
<Button asChild size="lg" variant="outline">
|
||||||
|
<Link href={routes.login}>Sign in</Link>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
import { redirect } from "next/navigation";
|
|
||||||
|
|
||||||
import { getOnboardingRedirectPath, getSessionUser } from "@/lib/auth-helpers";
|
|
||||||
|
|
||||||
export async function LoggedInRedirect() {
|
|
||||||
const user = await getSessionUser();
|
|
||||||
|
|
||||||
if (user) {
|
|
||||||
redirect(await getOnboardingRedirectPath());
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user