From 6230126d386e7d44ef8611486ffca91a2ed01168 Mon Sep 17 00:00:00 2001 From: Max Richter Date: Fri, 24 Oct 2025 13:43:34 +0200 Subject: [PATCH] fix: some image loading --- src/components/HeroCard.astro | 8 +-- src/components/Image.astro | 4 +- src/components/card/Metadata.svelte | 20 ++++++- src/components/resources/Display.astro | 13 +--- src/components/resources/Review.astro | 2 +- src/content.config.ts | 51 +++++++++------- src/helpers/markdown.ts | 1 + src/i18n/ui.ts | 59 ++++++++++++------- .../resources/[resourceType]/index.astro | 9 ++- src/pages/resources/index.astro | 5 +- src/pages/resources/resources.ts | 40 +++++-------- 11 files changed, 120 insertions(+), 92 deletions(-) diff --git a/src/components/HeroCard.astro b/src/components/HeroCard.astro index b8db077..66fb020 100644 --- a/src/components/HeroCard.astro +++ b/src/components/HeroCard.astro @@ -15,7 +15,7 @@ interface Props { } const { - data: { title, cover, icon, date, reviewRating }, + data: { title, cover, icon, date, rating }, collection, body, id, @@ -28,11 +28,11 @@ const link = translatePath(`/${collection}/${id.split("/")[0]}`); --- + classes={`max-h-250px grid gradient border-1 border-neutral overflow-hidden ${cover ? "grid-rows-[200px_1fr] xs:grid-rows-none xs:grid-cols-[1fr_200px]" : ""}`}> { - (date || body || reviewRating !== undefined) && ( - + (date || body || rating !== undefined) && ( + ) } diff --git a/src/components/Image.astro b/src/components/Image.astro index 332aa55..5c65dd2 100644 --- a/src/components/Image.astro +++ b/src/components/Image.astro @@ -15,12 +15,12 @@ interface Props { } async function checkImage(image: ImageMetadata) { - const src = image.src; + const src = typeof image === "string" ? image : image.src; if (!src) return false; try { if (src.startsWith("/@fs") || src.startsWith("/_astro")) return true; const res = await inferRemoteSize(src); - if (res.format) { + console.log(res) image.format = res.format; return true; } else { diff --git a/src/components/card/Metadata.svelte b/src/components/card/Metadata.svelte index 51762ca..225c585 100644 --- a/src/components/card/Metadata.svelte +++ b/src/components/card/Metadata.svelte @@ -1,6 +1,7 @@