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

import Header from "@/components/SectionHeader"

import ClientEarnAndBurn from "./Client"

import styles from "./earnAndBurn.module.css"

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 (
    <div className={styles.container}>
      <Header title={title} link={link} subtitle={subtitle} />
      <ClientEarnAndBurn initialData={initialTransactions} lang={lang} />
    </div>
  )
}
