Compare commits

..

No commits in common. "b7db7dd512dc572b640fec125b7c880ef4037d59" and "e406bd8764dd815e0b21fceffb48d50731cefd42" have entirely different histories.

10 changed files with 42 additions and 73 deletions

View file

@ -1,7 +1,7 @@
{
"name": "@firq/fgosite",
"type": "module",
"version": "0.1.23",
"version": "0.1.22",
"private": true,
"scripts": {
"dev": "astro dev",

View file

@ -1,26 +1,29 @@
---
import type { ImageMetadata } from 'astro'
import { Image } from 'astro:assets'
import mlb_ce from '../assets/ce/mlb.webp'
import type { GlobImage } from '../types/generic'
import { plsLoadImage } from '../utils/tools'
export interface Props {
name: string
imageFile: string
mlb: boolean
mlb: string
}
const { mlb, imageFile, name } = Astro.props
const imagePath = `/src/assets/ce/${imageFile}`
const images_ces = import.meta.glob<GlobImage>('/src/assets/ce/*.png')
const loadedCEImage = plsLoadImage(images_ces, imagePath)
const images_ces = import.meta.glob<{ default: ImageMetadata }>(
'/src/assets/ce/*.png'
)
const mlb_image = mlb ? 'mlbalign' : 'hidemlb'
let mlb_image: string = 'mlbalign'
if (mlb === 'false') {
mlb_image = 'hidemlb'
}
---
<article>
<div>
<Image src={loadedCEImage} alt={name} class="ce-crop" />
<Image src={images_ces[imagePath]()} alt={name} class="ce-crop" />
</div>
<div class={mlb_image}>
<Image src={mlb_ce} alt="Max-limit broken" class="mlb" />

View file

@ -1,7 +1,6 @@
---
import type { ImageMetadata } from 'astro'
import { Image } from 'astro:assets'
import type { GlobImage } from '../types/generic'
import { plsLoadImage } from '../utils/tools'
export interface Props {
site: string
@ -12,20 +11,14 @@ export interface Props {
const { imageFile, link, site } = Astro.props
const logoAltText = `${site} Logo`
const imagePath = `/src/assets/social/${imageFile}`
const images_logos = import.meta.glob<GlobImage>(
const images_logos = import.meta.glob<{ default: ImageMetadata }>(
'/src/assets/social/*.{png,webp}'
)
const loadedLogoImage = plsLoadImage(images_logos, imagePath)
---
<a
href={link}
target="_blank"
rel="noopener noreferrer"
aria-label=`${site} - new window`
>
<a href={link} target="_blank" rel="noopener noreferrer" aria-label=`${site} - new window`>
<article class="contact do-hover">
<Image src={loadedLogoImage} alt={logoAltText} />
<Image src={images_logos[imagePath]()} alt={logoAltText} />
<div>
<h2>{site}</h2>
</div>

View file

@ -1,7 +1,6 @@
---
import type { ImageMetadata } from 'astro';
import { Image } from 'astro:assets';
import type { GlobImage } from '../types/generic'
import { plsLoadImage } from '../utils/tools'
export interface Props {
name: string
@ -12,13 +11,12 @@ export interface Props {
const { link, imageFile, origin, name } = Astro.props
const imagePath = `/src/assets/favourites/${imageFile}`
const images = import.meta.glob<GlobImage>('/src/assets/favourites/*.{png,webp}')
const loadedImage = plsLoadImage(images, imagePath)
const images = import.meta.glob<{ default: ImageMetadata }>('/src/assets/favourites/*.{png,webp}')
---
<a href={link} target="_blank" rel="noopener noreferrer" aria-label=`${name} - new window`>
<div class="heading">{name}</div>
<Image src={loadedImage} alt={name} />
<Image src={images[imagePath]()} alt={name} />
<h2 class="subtext">
{origin}
</h2>

View file

@ -1,7 +1,6 @@
---
import type { ImageMetadata } from 'astro';
import { Image } from 'astro:assets';
import type { GlobImage } from '../types/generic'
import { plsLoadImage } from '../utils/tools'
export interface Props {
name: string
@ -17,10 +16,8 @@ export interface Props {
const { bond10, ml, bondceImageFile, servantImageFile, np, skills, level, name } = Astro.props
const servantImagePath = `/src/assets/servant/${servantImageFile}`
const bondceImagePath = `/src/assets/ce/bond-ce/${bondceImageFile}`
const images_servants = import.meta.glob<GlobImage>('/src/assets/servant/*.{png,webp}')
const images_bond_ces = import.meta.glob<GlobImage>('/src/assets/ce/bond-ce/*.{png,webp}')
const loadedServantImage = plsLoadImage(images_servants, servantImagePath)
const loadedBondCEImage = plsLoadImage(images_bond_ces, bondceImagePath)
const images_servants = import.meta.glob<{ default: ImageMetadata }>('/src/assets/servant/*.{png,webp}')
const images_bond_ces = import.meta.glob<{ default: ImageMetadata }>('/src/assets/ce/bond-ce/*.{png,webp}')
let bondce_css: string = 'bond-ce'
@ -30,14 +27,14 @@ if (bond10 === false) {
---
<article>
<Image src={loadedServantImage} alt={name} />
<Image src={images_servants[servantImagePath]()} alt={name} />
<h2 class="subtext">
Level {level}<br />
{skills}<br />
NP {np}
</h2>
<div class="expand-on-hover">
<Image src={loadedBondCEImage} alt="" class={bondce_css}/>
<Image src={images_bond_ces[bondceImagePath]()} alt="" class={bondce_css}/>
<h2 class="subtext">Mana Loading: {ml === 'Not Unlocked' && <br />}{ml}</h2>
</div>
</article>

View file

@ -1,8 +1,6 @@
---
import type { ImageMetadata } from 'astro'
import { Image } from 'astro:assets'
import type { GlobImage } from '../types/generic'
import { plsLoadImage } from '../utils/tools'
export interface Props {
date: string
title: string
@ -26,16 +24,13 @@ const targetImagePath = `/src/assets/ta_icons/${targetImageFile}`
const servantImagePath = `/src/assets/ta_icons/ta_servants/${servantImageFile}`
const formatted_date = new Date(date).toLocaleDateString('de-DE', options_date)
const target_images = import.meta.glob<GlobImage>(
const target_images = import.meta.glob<{ default: ImageMetadata }>(
'/src/assets/ta_icons/*.{png,webp}'
)
const servant_images = import.meta.glob<GlobImage>(
const servant_images = import.meta.glob<{ default: ImageMetadata }>(
'/src/assets/ta_icons/ta_servants/*.{png,webp}'
)
const loadedServantImage = plsLoadImage(servant_images, servantImagePath)
const loadedTargetImage = plsLoadImage(target_images, targetImagePath)
let hasuser = ''
if (user !== undefined) {
hasuser = 'hasuser'
@ -44,7 +39,7 @@ if (user !== undefined) {
<a href={link} target="_blank" rel="noopener noreferrer" aria-label={title}>
<article>
<Image src={loadedTargetImage} alt={title} class="icon" />
<Image src={target_images[targetImagePath]()} alt={title} class="icon" />
<div class="title">
<h2>{title}</h2>
</div>
@ -55,7 +50,7 @@ if (user !== undefined) {
{formatted_date}
</p>
<div class="expand-on-hover">
<Image src={loadedServantImage} alt="" />
<Image src={servant_images[servantImagePath ?? 'undefined']()} alt="" />
<h2>{turns}</h2>
</div>
</article>

View file

@ -1,7 +1,6 @@
---
import type { ImageMetadata } from 'astro'
import { Image } from 'astro:assets'
import type { GlobImage } from '../types/generic'
import { plsLoadImage } from '../utils/tools'
export interface Props {
title: string
@ -12,15 +11,14 @@ export interface Props {
const { imageFile, link, title } = Astro.props
const logoAltText = `${title} Logo`
const imagePath = `/src/assets/technologies/${imageFile}`
const images_logos = import.meta.glob<GlobImage>(
const images_logos = import.meta.glob<{ default: ImageMetadata }>(
'/src/assets/technologies/*.{png,webp}'
)
const loadedImage = plsLoadImage(images_logos, imagePath)
---
<a href={link} target="_blank" rel="noopener noreferrer" aria-label={title}>
<article>
<Image src={loadedImage} alt={logoAltText} />
<Image src={images_logos[imagePath]()} alt={logoAltText} />
<div>
<h2>{title}</h2>
</div>

View file

@ -1,10 +0,0 @@
export interface IconsLookup {
[key: string]: ImageMetadata
}
interface GlobGeneric<T> {
default: T
}
export type GlobAny = GlobGeneric<any>
export type GlobImage = GlobGeneric<ImageMetadata>

View file

@ -1,5 +0,0 @@
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;
}

View file

@ -2,56 +2,56 @@
{
"name": "The Merciless One",
"imageFile": "merciless_one.png",
"mlb": true
"mlb": "true"
},
{
"name": "Ox-Demon King",
"imageFile": "ox-demon.png",
"mlb": true
"mlb": "true"
},
{
"name": "Holy Maiden's Teachings",
"imageFile": "maidens_teachings.png",
"mlb": true
"mlb": "true"
},
{
"name": "Kaleidoscope",
"imageFile": "kaleidoscope.png",
"mlb": true
"mlb": "true"
},
{
"name": "The Black Grail",
"imageFile": "black_grail.png",
"mlb": true
"mlb": "true"
},
{
"name": "A Fragment Of 2030",
"imageFile": "2030.png",
"mlb": true
"mlb": "true"
},
{
"name": "Outrage",
"imageFile": "outrage.png",
"mlb": false
"mlb": "false"
},
{
"name": "Vessel of the Saint",
"imageFile": "vessel.png",
"mlb": false
"mlb": "false"
},
{
"name": "Devilish Bodhisattva",
"imageFile": "devilish_bodhisattva.png",
"mlb": true
"mlb": "true"
},
{
"name": "500-Year Obsession",
"imageFile": "500.png",
"mlb": true
"mlb": "true"
},
{
"name": "Prisma Cosmos",
"imageFile": "prisma_cosmos.png",
"mlb": true
"mlb": "true"
}
]