fgo-ta-com-website/src/pages/database/index.astro

62 lines
1.7 KiB
Text
Raw Normal View History

---
2024-07-15 14:39:52 +02:00
import { getCollection } from 'astro:content'
2024-01-03 00:59:59 +01:00
import Layout from '../../layouts/Layout.astro'
2024-07-15 14:39:52 +02:00
import QuestListing from '../../components/listings/questListingLine.astro'
import EventListing from '../../components/listings/eventListingLine.astro'
2024-01-03 00:59:59 +01:00
import DatabaseSection from '../../layouts/databaseSection.astro'
2024-07-15 14:39:52 +02:00
import Title from '../../components/title.astro'
2024-01-03 00:59:59 +01:00
const description = 'FGO NA TA Database'
2024-07-15 14:39:52 +02:00
const fulldata = await getCollection('taInfoData')
2024-07-14 21:15:16 +02:00
const groups = await getCollection('groups')
2024-07-15 14:39:52 +02:00
const changes = await getCollection('changes')
2024-07-14 21:15:16 +02:00
let combined = fulldata
2024-07-14 21:15:16 +02:00
for (const group of groups) {
2024-07-15 14:39:52 +02:00
combined = combined.filter((data) => !data.id.startsWith(group.id))
2024-07-14 21:15:16 +02:00
}
2024-07-15 14:39:52 +02:00
combined = combined.concat(groups as any).concat(changes as any)
2024-07-14 21:15:16 +02:00
combined.sort(
2024-07-15 14:39:52 +02:00
(a, b) =>
b.data.info.releaseDate.valueOf() - a.data.info.releaseDate.valueOf() ||
b.data.info.releaseNumber - a.data.info.releaseNumber
2024-01-02 23:58:10 +01:00
)
---
<Layout
title="TA Database - FGO TA"
currentpage="database"
descriptionOverride={description}
>
2024-07-15 14:39:52 +02:00
<Title
maintext="TA DATA­BASE"
subtext="A mostly up-to-date list of NA TA runs"
fadeout={true}
/>
<DatabaseSection title="NA Runs" titlehidden={true} displayLine={true}>
{
combined.map((quest) => {
if (['quest', 'group'].includes(quest.data.info.type)) {
return (
<QuestListing
{...{ ...quest.data.info, slug: quest.id }}
baseurl="database"
/>
)
} else {
return (
<EventListing
{...{ ...quest.data.info, slug: quest.id }}
link={(quest.data as any).link}
2024-07-15 15:28:08 +02:00
hlcolor={(quest.data as any).color}
2024-07-15 14:39:52 +02:00
/>
)
}
})
}
</DatabaseSection>
</Layout>
<style></style>