import { dehydrate, HydrationBoundary } from "@tanstack/react-query"; import { notFound } from "next/navigation"; import { getTranslation } from "@turbostarter/i18n/server"; import { getUser } from "~/lib/auth/server"; import { getMetadata } from "~/lib/metadata"; import { getQueryClient } from "~/lib/query/server"; import { admin } from "~/modules/admin/lib/api"; import { AccountsDataTable } from "~/modules/admin/users/user/accounts/data-table/accounts-data-table"; import { UserDetails } from "~/modules/admin/users/user/details"; import { UserHeader } from "~/modules/admin/users/user/header"; import { InvitationsDataTable } from "~/modules/admin/users/user/invitations/data-table/invitations-data-table"; import { MembershipsDataTable } from "~/modules/admin/users/user/memberships/data-table/memberships-data-table"; import { PlansDataTable } from "~/modules/admin/users/user/plans/data-table/plans-data-table"; import { SessionsList } from "~/modules/admin/users/user/sessions/sessions-list"; export const generateMetadata = async ({ params, }: { params: Promise<{ id: string; locale: string }>; }) => { const id = (await params).id; const user = await getUser({ id }); if (!user) { return notFound(); } return getMetadata({ title: user.name, })({ params }); }; export default async function UserPage({ params, }: { params: Promise<{ id: string }>; }) { const { t } = await getTranslation({ ns: "common" }); const { id } = await params; const user = await getUser({ id }); if (!user) { return notFound(); } const queryClient = getQueryClient(); await queryClient.setQueryData( admin.queries.users.get({ id }).queryKey, user, ); const sections = [ { label: t("accounts"), component: , }, { label: t("plans"), component: , }, { label: t("memberships"), component: , }, { label: t("invitations"), component: , }, ]; return ( {sections.map(({ label, component }) => ( {label} {component} ))} ); }