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

import SectionContainer from "@/components/Section/Container"
import Header from "@/components/Section/Header"

import ClientEarnAndBurn from "./Client"

import type { AccountPageComponentProps } from "@/types/components/myPages/myPage/accountPage"

export default async function EarnAndBurn({
  lang,
  link,
  subtitle,
  title,
}: AccountPageComponentProps) {
  const initialTransactions =
    await serverClient().user.transaction.friendTransactions({ limit: 5 })
  if (!initialTransactions) {
    return null
  }
  return (
    <SectionContainer>
      <Header title={title} link={link} subtitle={subtitle} />
      <ClientEarnAndBurn initialData={initialTransactions} lang={lang} />
    </SectionContainer>
  )
}
