// Mounted at `/`. The router maps `src/pages/<file>.tsx` to `/<file>`
// — see AGENTS.md for the conventions (groups, [param], [...slug]).
//
// Bilingual by default: the copy comes from the catalog via `<T>` (see
// src/locales), and <LocaleSwitcher> in the layout switches language.

import type { ReactNode } from 'react'
import type { PageMeta } from '@voltro/web'
import { T } from '@voltro/i18n'
import { getCatalog } from '../locales'

// Locale-aware tab title: @voltro/web resolves meta({ locale }) from the
// active locale (the `voltro:locale` cookie in this cookie-i18n app).
export const meta = ({ locale }: { readonly locale: string }): PageMeta => ({
  title: getCatalog(locale)['meta.home.title'],
})

export default function Index(): ReactNode {
  return (
    <main>
      <h1>{{capProjectName}}</h1>
      <p>
        <T id="home.intro" values={{ code: (c: ReactNode) => <code>{c}</code> }} />
      </p>
    </main>
  )
}
