
import { redirect } from "next/navigation";
import { checkSession } from "./actions";

export default async function Layout({
  children,
}: {
  children: React.ReactNode;
}) {
  const sessionResult = await checkSession();

  // If there's an active session, redirect to dashboard
  if (sessionResult.success && sessionResult.redirectTo) {
    redirect(sessionResult.redirectTo);
  }

  return <div className="max-w-full gap-12 items-start">{children}</div>;
}
