import "./profileLayout.css"

import { serverClient } from "@/lib/trpc/server"

import TrackingSDK from "@/components/TrackingSDK"
import { setLang } from "@/i18n/serverContext"

import type { LangParams, PageArgs } from "@/types/params"

export { generateMetadata } from "@/utils/generateMetadata"

export default async function ProfilePage({ params }: PageArgs<LangParams>) {
  setLang(params.lang)
  const accountPage = await serverClient().contentstack.accountPage.get()

  if (!accountPage) {
    return null
  }

  return <TrackingSDK pageData={accountPage.tracking} />
}
