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

import Title from "@/components/Title"

import Friend from "./Friend"
import Stats from "./Stats"

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

import type { OverviewProps } from "@/types/components/myPages/myPage/overview"

export default async function Overview({ title }: OverviewProps) {
  const user = await serverClient().user.get()

  return (
    <section className={styles.container}>
      <header>
        {title && (
          <Title as="h3" level="h2" uppercase className={styles.title}>
            {title}
          </Title>
        )}
      </header>
      <section className={styles.overview}>
        <Friend user={user} />
        <Stats user={user} />
      </section>
    </section>
  )
}
