---
import ProgramCard from './ProgramCard.astro';
import programData from '@data/program.json';
import { translations, type Lang } from '@data/i18n';

const { lang = 'no' } = Astro.props as { lang?: Lang };
const t = translations[lang].program;

const typedProgramData = programData as Record<string, any>;

const todayStr = new Date().toISOString().slice(0, 10);
const items = typedProgramData[todayStr];
---

<section class="flex flex-col gap-6 max-w-prose">
  <h2 class="font-bold text-2xl">{t.today}</h2>
  {items ? (
    <ProgramCard date={todayStr} items={items} lang={lang} />
  ) : (
    <p>{t.noProgram}</p>
  )}
</section>