Added more TAs to Beast4L, fixed unlighthouse issue, optimized dev experience by throwing actual useful errors
All checks were successful
/ checking (push) Successful in 11s

This commit is contained in:
Firq 2024-01-05 00:43:02 +01:00
parent 278c39cb3b
commit 34784a3bf1
Signed by: Firq
GPG key ID: 3ACC61C8CEC83C20
21 changed files with 112 additions and 33 deletions

View file

@ -91,5 +91,6 @@ jobs:
key: ${{ secrets.SSH_PRIVATE_KEY }} key: ${{ secrets.SSH_PRIVATE_KEY }}
script: | script: |
PATH="$HOME/.local/bin:$PATH" PATH="$HOME/.local/bin:$PATH"
screen -ls | grep 'fgo_ta_com-unlighthouse' | awk '{print $1}' | xargs -I % -t screen -X -S % quit
cd fgo_ta_com cd fgo_ta_com
screen -S fgo_ta_com-unlighthouse -dm serve unlighthouse/ -p ${{ secrets.UNLIGHTHOUSE_DEPLOY_PORT }} screen -S fgo_ta_com-unlighthouse -dm serve unlighthouse/ -p ${{ secrets.UNLIGHTHOUSE_DEPLOY_PORT }}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

View file

@ -38,7 +38,6 @@ const release = `https://forgejo.neshweb.net/Firq/fgo-ta-com-website/releases/ta
color: white; color: white;
font-size: 1.5em; font-size: 1.5em;
padding: 2rem 0rem; padding: 2rem 0rem;
margin-top: 7.5rem;
} }
a { a {
text-align: center; text-align: center;

View file

@ -1,6 +1,8 @@
--- ---
import type { ImageMetadata } from 'astro' import type { ImageMetadata } from 'astro'
import { Image } from 'astro:assets' import { Image } from 'astro:assets'
import { plsLoadImage } from '../utils/tools'
import type { GlobImage } from '../types/generic'
export interface Props { export interface Props {
title: string title: string
link: string link: string
@ -19,22 +21,25 @@ const options_date: Intl.DateTimeFormatOptions = {
} }
const servantImagePath = `/src/assets/ta_servants/${servant}.png` const servantImagePath = `/src/assets/ta_servants/${servant}.png`
const servant_images = import.meta.glob<GlobImage>(
const formatted_date = new Date(date).toLocaleDateString('de-DE', options_date)
const servant_images = import.meta.glob<{ default: ImageMetadata }>(
'/src/assets/ta_servants/*.png' '/src/assets/ta_servants/*.png'
) )
const loaded_image = plsLoadImage(servant_images, servantImagePath)
const formatted_date = new Date(date).toLocaleDateString('de-DE', options_date)
const arialabel = `By ${runner} • ${formatted_date} ${turns}`
--- ---
<a href={link} target="_blank" rel="noopener noreferrer" aria-label=`By ${runner} • ${formatted_date} ${turns}`> <a href={link} target="_blank" rel="noopener noreferrer" aria-label={arialabel}>
<article> <article>
<Image src={servant_images[servantImagePath]()} alt="" class="icon" /> <Image src={loaded_image} alt="" class="icon" />
<div class="title desktop"> <div class="title desktop">
<h2>{title}</h2> <h2>{title}</h2>
</div> </div>
<p class="desktop"> <p class="desktop">
<span> <span>
By {runner}<br /> • <br/ > {formatted_date} By {runner}<br /> • <br />
{formatted_date}
</span> </span>
</p> </p>
<div class="mobile"> <div class="mobile">

View file

@ -93,6 +93,62 @@
"servant": "koyo", "servant": "koyo",
"turns": "4T", "turns": "4T",
"runner": "MCR" "runner": "MCR"
},
{
"title": "Tamamo Solo 30T",
"link": "https://www.youtube.com/watch?v=2wUcojRXTlw",
"date": "2023-12-27",
"servant": "tamamo",
"turns": "30T",
"runner": "Mitsunee"
},
{
"title": "Dual Taigong Wang 4T",
"link": "https://www.youtube.com/watch?v=3jU3Az7iM7E",
"date": "2023-12-27",
"servant": "taigongwang",
"turns": "4T",
"runner": "Ryougi Bobby"
},
{
"title": "Ibuki 4T",
"link": "https://www.youtube.com/watch?v=dgJfgMHAOpI",
"date": "2023-12-29",
"servant": "ibuki",
"turns": "4T",
"runner": "Martyr Kuga"
},
{
"title": "Ozymandias 4T",
"link": "https://www.youtube.com/watch?v=Y8qYY875M_I",
"date": "2023-12-28",
"servant": "ozymandias",
"turns": "4T",
"runner": "Kusanagi"
},
{
"title": "Arjuna Alter 4T",
"link": "https://www.youtube.com/watch?v=OTfM7WQl5uI",
"date": "2023-12-28",
"servant": "arjunaalter",
"turns": "4T",
"runner": "Akise"
},
{
"title": "Galatea 4T",
"link": "https://www.youtube.com/watch?v=GKCZtn815wA",
"date": "2023-12-30",
"servant": "galatea",
"turns": "4T",
"runner": "Hentai Daddi"
},
{
"title": "Summer Kiara 4T",
"link": "https://www.youtube.com/watch?v=b46JRNUIdrM",
"date": "2023-12-28",
"servant": "kiarasummer",
"turns": "4T",
"runner": "Felt"
} }
] ]
} }

View file

@ -5,7 +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 type { IconsLookup } from '../types/icons' import type { IconsLookup } from '../types/generic'
export interface Props { export interface Props {
title: string title: string

View file

@ -2,29 +2,30 @@
import Layout from '../layouts/Layout.astro' import Layout from '../layouts/Layout.astro'
import BaseSection from '../layouts/baseSection.astro' import BaseSection from '../layouts/baseSection.astro'
import TACard from '../components/taCard.astro' import TACard from '../components/taCard.astro'
import type { filedata } from '../types/ta' import type { FileData } from '../types/ta'
import type { GlobAny } from '../types/generic'
export interface Props { export interface Props {
datafile: string datafile: string
} }
const { datafile } = Astro.props const { datafile } = Astro.props
const fulldata = import.meta.glob<{ default: any }>(`../content/data/*.json`) const fulldata = import.meta.glob<GlobAny>(`../content/data/*.json`)
const filecontent: filedata = ( const filecontent: FileData = (
await fulldata[`../content/data/${datafile}.json`]() await fulldata[`../content/data/${datafile}.json`]()
)['default'] )['default']
const title = filecontent.info.title const pagetitle = `${filecontent.info.title} - FGO TA`
filecontent.data.sort((a, b) => Date.parse(b.date) - Date.parse(a.date)) filecontent.data.sort((a, b) => Date.parse(b.date) - Date.parse(a.date))
--- ---
<Layout <Layout
title={title} title={pagetitle}
currentpage="database-entry" currentpage="database-entry"
descriptionOverride={filecontent.info.shortdescription} descriptionOverride={filecontent.info.shortdescription}
> >
<a href="/database">&lt&lt Back to database</a> <a href="/database">&lt&lt Back to database</a>
<BaseSection title={title} description={filecontent.info.description}> <BaseSection title={filecontent.info.title} description={filecontent.info.description}>
{filecontent.data.map((item) => <TACard {...item} />)} {filecontent.data.map((item) => <TACard {...item} />)}
</BaseSection> </BaseSection>
<div class="placeholder"></div> <div class="placeholder"></div>

View file

@ -8,11 +8,11 @@ const description = "Error. This shouldn't happen :/"
--- ---
<Layout <Layout
title="404 - Firq FGO Site" title="404 - FGO TA"
currentpage="404" currentpage="404"
descriptionOverride={description} descriptionOverride={description}
> >
<BaseSection title="FirqhundredandFirq - Not Found" description=""> <BaseSection title="Firqhundred&shy;andFirq - Not Found" description="">
<div> <div>
<Image src={sadshishou} alt="Sad Shishou" /> <Image src={sadshishou} alt="Sad Shishou" />
<h2>Well ... you were not supposed to end up here.</h2> <h2>Well ... you were not supposed to end up here.</h2>

View file

@ -1,9 +1,10 @@
--- ---
import TaShowcaseLayout from '../../layouts/taShowcaseLayout.astro' import TaShowcaseLayout from '../../layouts/taShowcaseLayout.astro'
import { findSlug } from '../../utils/slugTools' import type { GlobAny } from '../../types/generic'
import { findSlug } from '../../utils/tools'
export function getStaticPaths() { export function getStaticPaths() {
const fulldata = import.meta.glob<{ default: any }>( const fulldata = import.meta.glob<GlobAny>(
`../../content/data/*.json` `../../content/data/*.json`
) )
const keylist = Object.keys(fulldata).map((item) => findSlug(item)!) const keylist = Object.keys(fulldata).map((item) => findSlug(item)!)

View file

@ -2,13 +2,13 @@
import Layout from '../../layouts/Layout.astro' import Layout from '../../layouts/Layout.astro'
import QuestListing from '../../components/questListing.astro' import QuestListing from '../../components/questListing.astro'
import DatabaseSection from '../../layouts/databaseSection.astro' import DatabaseSection from '../../layouts/databaseSection.astro'
import { findSlug } from '../../utils/slugTools' import { findSlug } from '../../utils/tools'
import type { filedata } from '../../types/ta' import type { GlobFiledata } from '../../types/generic'
const description = 'FGO NA TA Database' const description = 'FGO NA TA Database'
const questInfo = [] const questInfo = []
const fulldata = import.meta.glob<{ default: filedata }>( const fulldata = import.meta.glob<GlobFiledata>(
`../../content/data/*.json` `../../content/data/*.json`
) )
@ -26,7 +26,7 @@ questInfo.sort(
--- ---
<Layout <Layout
title="FGO NA TA Database" title="TA Database - FGO TA"
currentpage="database" currentpage="database"
descriptionOverride={description} descriptionOverride={description}
> >

13
src/types/generic.ts Normal file
View file

@ -0,0 +1,13 @@
import type { FileData } from "./ta"
export interface IconsLookup {
[key: string]: ImageMetadata
}
interface GlobGeneric<T> {
default: T
}
export type GlobAny = GlobGeneric<any>
export type GlobFiledata = GlobGeneric<FileData>
export type GlobImage = GlobGeneric<ImageMetadata>

View file

@ -1,3 +0,0 @@
export interface IconsLookup {
[key: string]: ImageMetadata
}

View file

@ -1,4 +1,4 @@
interface tadata { interface TAData {
title: string title: string
link: string link: string
servant: string servant: string
@ -7,14 +7,14 @@ interface tadata {
date: string date: string
} }
interface info { interface Info {
title: string title: string
questReleaseDate: string questReleaseDate: string
description: string description: string
shortdescription: string shortdescription: string
} }
export interface filedata { export interface FileData {
info: info info: Info
data: tadata[] data: TAData[]
} }

View file

@ -1,3 +0,0 @@
export function findSlug(filepath: string) {
return filepath.match(/(?:.*[\\/])(.+)(?:\.json)/)?.[1]
}

9
src/utils/tools.ts Normal file
View file

@ -0,0 +1,9 @@
export function findSlug(filepath: string) {
return filepath.match(/(?:.*[\\/])(.+)(?:\.json)/)?.[1]
}
export function plsLoadImage(record: Record<string, () => Promise<{default: ImageMetadata}>>, path: string) {
const loadedImage = record[path]?.();
if (!loadedImage) throw new Error("Asset was not found:" + path);
return loadedImage;
}