import { createFileRoute } from "@tanstack/react-router";

import { DashboardShell } from "@/components/dashboard-shell";
import { requireSession } from "@/lib/protected-route";

export const Route = createFileRoute("/dashboard")({
  component: RouteComponent,
  beforeLoad: requireSession,
});

function RouteComponent() {
  const { session } = Route.useRouteContext();

  return (
    <DashboardShell userName={session.data?.user.name} userEmail={session.data?.user.email} />
  );
}
