import { env } from "@/env/server"
import { getFooter } from "@/lib/trpc/memoizedRequests"

import CurrentFooter from "@/components/Current/Footer"
import { getLang } from "@/i18n/serverContext"

import FooterDetails from "./Details"
import FooterNavigation from "./Navigation"

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

export function preload() {
  void getFooter()
}

export default function Footer() {
  const lang = getLang()
  if (!env.isLangLive(lang)) {
    return <CurrentFooter />
  }

  preload()

  return (
    <footer className={styles.footer}>
      <FooterNavigation />
      <FooterDetails />
    </footer>
  )
}
