Started work on Teslafest Section
All checks were successful
/ checking (push) Successful in 14s

This commit is contained in:
Firq 2024-04-28 14:45:59 +02:00
parent 0afe61add2
commit 2af757d5bd
Signed by: Firq
GPG key ID: 4DE1059A4666E89F
12 changed files with 83 additions and 9 deletions

View file

@ -1,5 +1,6 @@
--- ---
export interface Props { export interface Props {
baseurl: string
slug: string slug: string
title: string title: string
releaseDate: Date releaseDate: Date
@ -12,8 +13,8 @@ const options_date: Intl.DateTimeFormatOptions = {
day: '2-digit', day: '2-digit',
} }
const { shortdescription, releaseDate, slug, title } = Astro.props const { shortdescription, releaseDate, slug, title, baseurl } = Astro.props
const url = `/database/${slug}` const url = `/${baseurl}/${slug}`
const render_date = releaseDate.toLocaleDateString( const render_date = releaseDate.toLocaleDateString(
'en-GB', 'en-GB',
options_date options_date

View file

@ -36,4 +36,5 @@ const taData = defineCollection({
export const collections = { export const collections = {
taInfoData: taData, taInfoData: taData,
teslafest: taData,
} }

View file

@ -0,0 +1,24 @@
{
"info": {
"title": "Giga Coil - Western Arts Ninja Style",
"releaseDate": "2024-03-28",
"shortdescription": "Fuuma Quest",
"releaseNumber": 1
},
"quests": [
{
"questTitle": "Giga Coil - Western Arts Ninja Style",
"description": "aaa",
"data": [
{
"title": "Skadi 3T",
"link": "https://www.youtube.com/watch?v=VMVus__ZYXE",
"date": "2024-03-30",
"servant": "skadi",
"turns": "3T",
"runner": "Firq"
}
]
}
]
}

View file

@ -5,6 +5,7 @@ import navdata from '../../static/data/_navdata.json'
import embed from '../assets/embed.png' import embed from '../assets/embed.png'
import home from 'iconoir/icons/home.svg' import home from 'iconoir/icons/home.svg'
import database from 'iconoir/icons/database.svg' import database from 'iconoir/icons/database.svg'
import databasestar from 'iconoir/icons/database-star.svg'
import mail from 'iconoir/icons/mail.svg' import mail from 'iconoir/icons/mail.svg'
import type { IconsLookup } from '../types/generic' import type { IconsLookup } from '../types/generic'
@ -17,6 +18,7 @@ export interface Props {
const icons: IconsLookup = { const icons: IconsLookup = {
home: home, home: home,
database: database, database: database,
databasestar: databasestar,
about: mail about: mail
} }

View file

@ -5,11 +5,13 @@ import TACard from '../components/taCard.astro'
import { plsLoadTAEntry } from '../utils/tools' import { plsLoadTAEntry } from '../utils/tools'
export interface Props { export interface Props {
collection: "teslafest" | "taInfoData"
collectionKey: string collectionKey: string
baseurl: "database" | "teslafest"
} }
const { collectionKey } = Astro.props const { collection, collectionKey, baseurl } = Astro.props
const taEntry = await plsLoadTAEntry(collectionKey) const taEntry = await plsLoadTAEntry(collectionKey, collection)
const pagetitle = `${taEntry.info.title} - FGO TA` const pagetitle = `${taEntry.info.title} - FGO TA`
--- ---
@ -18,7 +20,7 @@ const pagetitle = `${taEntry.info.title} - FGO TA`
currentpage="database-entry" currentpage="database-entry"
descriptionOverride={taEntry.info.shortdescription} descriptionOverride={taEntry.info.shortdescription}
> >
<a href="/database">&lt&lt Back to database</a> <a href=`/${baseurl}`>&lt&lt Back to database</a>
{ {
taEntry.quests.map((item) => ( taEntry.quests.map((item) => (
<BaseSection title={item.questTitle} description={item.description}> <BaseSection title={item.questTitle} description={item.description}>

View file

@ -10,4 +10,4 @@ export async function getStaticPaths() {
const { slug } = Astro.params const { slug } = Astro.params
--- ---
<TaShowcaseLayout collectionKey={slug} /> <TaShowcaseLayout collection="taInfoData" collectionKey={slug} baseurl="database"/>

View file

@ -19,7 +19,7 @@ fulldata.sort(
descriptionOverride={description} descriptionOverride={description}
> >
<DatabaseSection title="FGO NA TA Database"> <DatabaseSection title="FGO NA TA Database">
{fulldata.map((quest) => <QuestListing { ...{...quest.data.info, slug: quest.id} } />)} {fulldata.map((quest) => <QuestListing { ...{...quest.data.info, slug: quest.id} } baseurl="database" />)}
</DatabaseSection> </DatabaseSection>
</Layout> </Layout>

View file

@ -0,0 +1,13 @@
---
import { getCollection } from 'astro:content';
import TaShowcaseLayout from '../../layouts/taShowcaseLayout.astro'
export async function getStaticPaths() {
const fulldata = (await getCollection('teslafest')).map((data) => data.id)
return fulldata.map((slug) => ({ params: { slug } }))
}
const { slug } = Astro.params
---
<TaShowcaseLayout collection="teslafest" collectionKey={slug} baseurl="teslafest" />

View file

@ -0,0 +1,26 @@
---
import { getCollection } from 'astro:content';
import Layout from '../../layouts/Layout.astro'
import QuestListing from '../../components/questListing.astro'
import DatabaseSection from '../../layouts/databaseSection.astro'
const description = 'NA Teslafest'
const fulldata = await getCollection('teslafest')
fulldata.sort(
(a, b) => b.data.info.releaseDate.valueOf() - a.data.info.releaseDate.valueOf() || b.data.info.releaseNumber - a.data.info.releaseNumber
)
---
<Layout
title="Teslafest - FGO TA"
currentpage="teslafest"
descriptionOverride={description}
>
<DatabaseSection title="Teslafest - All Quests">
{fulldata.map((quest) => <QuestListing { ...{...quest.data.info, slug: quest.id} } baseurl="teslafest" />)}
</DatabaseSection>
</Layout>
<style></style>

View file

@ -7,8 +7,8 @@ export function plsLoadImage(record: ImportRecord<GlobImage>, path: string) {
return loadedImage return loadedImage
} }
export async function plsLoadTAEntry(key: string) { export async function plsLoadTAEntry(key: string, file: "taInfoData" | "teslafest" = 'taInfoData') {
const filecontent = (await getEntry('taInfoData', key))?.data const filecontent = (await getEntry(file, key))?.data
if (!filecontent) throw new Error(`Datafile was not found for key ${key}`) if (!filecontent) throw new Error(`Datafile was not found for key ${key}`)
return filecontent return filecontent
} }

View file

@ -8,5 +8,10 @@
"link": "/database", "link": "/database",
"text": "TA Database", "text": "TA Database",
"icon": "database" "icon": "database"
},
{
"link": "/teslafest",
"text": "Teslafest",
"icon": "databasestar"
} }
] ]