import { DashboardPage } from "@/components/layout/dashboard-page";
import { getDashboardRole } from "@/lib/auth/dashboard-role";
import type { Metadata } from "next";
import { PageHeader } from "@/components/shared/page";
import { ProfilePreview } from "@/features/profile/profile-preview";
export const metadata: Metadata = { title: "Profile" };
function ProfilePage() {
  return (
    <>
      <PageHeader title="Profile" />
      <ProfilePreview />
    </>
  );
}

export default async function DashboardRoute(props: {
  searchParams: Promise<Record<string, string | string[] | undefined>>;
}) {
  const query = await props.searchParams;
  const role = await getDashboardRole(
    Array.isArray(query.role) ? query.role[0] : query.role,
  );
  return (
    <DashboardPage role={role}>
      <ProfilePage />
    </DashboardPage>
  );
}
