Files
portabase/app/(auth)/layout.tsx
T

42 lines
1.3 KiB
TypeScript
Raw Normal View History

2026-03-17 15:01:34 +01:00
import React from "react";
import { redirect } from "next/navigation";
import { currentUser } from "@/lib/auth/current-user";
2026-06-22 16:56:17 +02:00
import { isOnboardingDone } from "@/db/services/setting";
import { AuthLogoSection } from "@/features/auth/components/auth-logo-section";
2026-06-22 16:56:17 +02:00
import { env } from "@/env.mjs";
import { Heart } from "lucide-react";
2025-02-13 19:20:55 +01:00
export default async function Layout({
children,
}: {
children: React.ReactNode;
}) {
2026-06-22 16:56:17 +02:00
if (env.SKIP_ONBOARDING !== "true" && !(await isOnboardingDone())) {
redirect("/welcome");
}
const user = await currentUser();
2024-11-03 21:12:40 +01:00
if (user && !user.banned && user.role !== "pending") {
redirect("/dashboard/home");
}
return (
<div className="flex min-h-screen flex-col justify-between py-10 sm:px-6 lg:px-8 ">
<div className="flex flex-col items-center justify-center flex-1">
<div className="mx-auto w-full max-w-md">
<AuthLogoSection />
2026-02-26 15:29:00 +01:00
<div className="mt-4">{children}</div>
</div>
</div>
<footer className="mt-8 text-center text-xs text-muted-foreground flex flex-col gap-1">
<p className="flex items-center justify-center gap-1">
Made with{" "}
<Heart className="size-3 fill-red-500 text-red-500 animate-pulse" />{" "}
by <span className="font-medium text-foreground">Portabase</span>
</p>
</footer>
</div>
);
}