mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 05:05:38 -04:00
Improve fresh install flow and auth page routing
- Move /setup out of protected (pages) route group so it's accessible without auth (fixes fresh install redirect loop) - Redirect /login → /register when zero users exist - Add "Get Started" button on landing page for fresh installs - Hide register button/link when registration is closed - Add auth redirects: logged-in users on /login or /register → /dashboard - Convert register page to server component with server-side checks - Fix animation snap on auth form buttons (transition-all → scoped) - Update proxy middleware with /login and /register routes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+36
-14
@@ -40,7 +40,15 @@ const posterLayout = [
|
||||
{ x: "78%", y: "66%", rotate: 5, delay: 0.23 },
|
||||
];
|
||||
|
||||
export function LandingPage({ posterUrls }: { posterUrls: string[] }) {
|
||||
export function LandingPage({
|
||||
posterUrls,
|
||||
freshInstall,
|
||||
registrationOpen,
|
||||
}: {
|
||||
posterUrls: string[];
|
||||
freshInstall: boolean;
|
||||
registrationOpen: boolean;
|
||||
}) {
|
||||
const { data: session, isPending } = useSession();
|
||||
const router = useRouter();
|
||||
|
||||
@@ -169,19 +177,33 @@ export function LandingPage({ posterUrls }: { posterUrls: string[] }) {
|
||||
delay: 0.35,
|
||||
}}
|
||||
>
|
||||
<Link
|
||||
href="/login"
|
||||
className="group relative inline-flex h-12 items-center justify-center overflow-hidden rounded-lg bg-primary px-8 font-medium text-primary-foreground transition-all hover:shadow-lg hover:shadow-primary/20"
|
||||
>
|
||||
<span className="relative z-10">Sign In</span>
|
||||
<div className="absolute inset-0 bg-gradient-to-t from-black/10 to-transparent opacity-0 transition-opacity group-hover:opacity-100" />
|
||||
</Link>
|
||||
<Link
|
||||
href="/register"
|
||||
className="inline-flex h-12 items-center justify-center rounded-lg border border-border px-8 font-medium transition-all hover:border-primary/40 hover:bg-primary/5"
|
||||
>
|
||||
Register
|
||||
</Link>
|
||||
{freshInstall ? (
|
||||
<Link
|
||||
href="/register"
|
||||
className="group relative inline-flex h-12 items-center justify-center overflow-hidden rounded-lg bg-primary px-8 font-medium text-primary-foreground transition-all hover:shadow-lg hover:shadow-primary/20"
|
||||
>
|
||||
<span className="relative z-10">Get Started</span>
|
||||
<div className="absolute inset-0 bg-gradient-to-t from-black/10 to-transparent opacity-0 transition-opacity group-hover:opacity-100" />
|
||||
</Link>
|
||||
) : (
|
||||
<>
|
||||
<Link
|
||||
href="/login"
|
||||
className="group relative inline-flex h-12 items-center justify-center overflow-hidden rounded-lg bg-primary px-8 font-medium text-primary-foreground transition-all hover:shadow-lg hover:shadow-primary/20"
|
||||
>
|
||||
<span className="relative z-10">Sign In</span>
|
||||
<div className="absolute inset-0 bg-gradient-to-t from-black/10 to-transparent opacity-0 transition-opacity group-hover:opacity-100" />
|
||||
</Link>
|
||||
{registrationOpen && (
|
||||
<Link
|
||||
href="/register"
|
||||
className="inline-flex h-12 items-center justify-center rounded-lg border border-border px-8 font-medium transition-all hover:border-primary/40 hover:bg-primary/5"
|
||||
>
|
||||
Register
|
||||
</Link>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</motion.div>
|
||||
</main>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user