// Docs landing — link to the available doc pages. Keep this thin; the docs
// themselves live under `src/pages/docs/[...slug].tsx`.
//
// Bilingual (Strategy B): mounted at `/` (default locale) and mirrored at
// `/de` by src/pages/[locale]/index.tsx. The links are locale-prefixed off
// the active locale so /de's landing points at the /de docs.

import type { ReactNode } from 'react'
import type { PageMeta } from '@voltro/web'
import { T, useLocale } from '@voltro/i18n'
import { getCatalog, withLocalePrefix } from '../lib/locale'

export const renderMode = 'static' as const
export const interactive = 'none' as const

export const meta = ({ locale }: { locale: string }): PageMeta => {
  const c = getCatalog(locale)
  return {
    title: c['meta.home.title'],
    description: c['meta.home.description'],
  }
}

export default function Index(): ReactNode {
  const locale = useLocale()
  return (
    <main>
      <h1>
        <T id="home.title" values={{ project: '{{capProjectName}}' }} />
      </h1>
      <ul>
        <li>
          <a href={withLocalePrefix('/docs/intro/getting-started', locale)}>
            <T id="docs.getting-started.title" />
          </a>
        </li>
        <li>
          <a href={withLocalePrefix('/docs/guides/first-page', locale)}>
            <T id="docs.first-page.title" />
          </a>
        </li>
      </ul>
    </main>
  )
}
