---
import Layout from '../layouts/Layout.astro'
import BaseSection from '../layouts/baseSection.astro'
import TACard from '../components/taCard.astro'
import { plsLoadTAEntry } from '../utils/tools'

export interface Props {
  collectionKey: string
}

const { collectionKey } = Astro.props
const taEntry = await plsLoadTAEntry(collectionKey)
const pagetitle = `${taEntry.info.title} - FGO TA`
taEntry.data.sort((a, b) => b.date.valueOf() - a.date.valueOf()  )
---

<Layout
  title={pagetitle}
  currentpage="database-entry"
  descriptionOverride={taEntry.info.shortdescription}
>
  <a href="/database">&lt&lt Back to database</a>
  <BaseSection
    title={taEntry.info.title}
    description={taEntry.info.description}
  >
    {taEntry.data.map((item) => <TACard {...item} />)}
  </BaseSection>
  <div class="placeholder"></div>
</Layout>

<style>
  .placeholder {
    visibility: hidden;
    width: 100%;
    height: 2.5rem;
  }

  a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    text-align: center;
    color: white;
    background-color: var(--c-gray);
    padding: 0.5rem 0px;
    text-decoration: none;
  }
</style>
