fix: some image loading
Some checks failed
Deploy to SFTP Server / build (push) Failing after 1m55s

This commit is contained in:
Max Richter
2025-10-24 13:43:34 +02:00
parent 231bdb09a3
commit 6230126d38
11 changed files with 120 additions and 92 deletions

View File

@@ -3,9 +3,12 @@ import Layout from "@layouts/Layout.astro";
import HeroCard from "@components/HeroCard.astro";
import * as memorium from "@helpers/memorium";
import { resources as resourceTypes } from "../resources.ts";
import {useTranslations} from "@i18n/utils";
const { resourceType } = Astro.params;
const t = useTranslations(Astro.url);
async function safeGetResource() {
try {
return await memorium.listResource(resourceType);
@@ -21,7 +24,6 @@ export async function getStaticPaths() {
return {
params: {
resourceType: type.id,
resourceName: type.data.title,
},
};
});
@@ -32,7 +34,10 @@ function isValidResource(res) {
}
---
<Layout title="Max Richter">
<h1 class="text-4xl mb-4">{t(resourceType)}</h1>
<p>{t(`${resourceType as "articles"}.description`)}</p>
{
resources.content
.filter((res) => isValidResource(res))
@@ -44,7 +49,7 @@ function isValidResource(res) {
data: {
title: resource?.content?.name ?? resource?.content?.headline ?? resource.content?.itemReviewed?.name,
date: resource?.content?.datePublished,
rating: resource?.content?.reviewRating,
rating: resource?.content?.reviewRating?.ratingValue,
cover: {
src: memorium.getImageUrl(resource.content.image),
},

View File

@@ -2,8 +2,11 @@
import Layout from "@layouts/Layout.astro";
import HeroCard from "@components/HeroCard.astro";
import { resources } from "./resources.ts";
import {useTranslations} from "@i18n/utils";
const t = useTranslations(Astro.url);
---
<Layout title="Max Richter">
{resources.map((resource) => <HeroCard post={resource} />)}
{resources.map((resource) => <HeroCard post={{...resource, body: t(`${resource.id}.description`), data: {cover:{src:resource.cover}, title: t(resource.id)}}} />)}
</Layout>

View File

@@ -1,13 +1,9 @@
const collection = "resources";
export type ResourceType = {
id: string;
id: "articles" | "recipes" | "movies" | "series";
collection: string;
body?: string;
data: {
title: string;
icon: string;
};
cover: string;
};
// const wiki = {
@@ -23,37 +19,29 @@ export type ResourceType = {
const articles = {
id: "articles",
collection,
data: {
title: "Articles",
icon: "📰",
},
};
cover:
"https://i0.wp.com/old-dressaday-images.s3-website-us-west-2.amazonaws.com/6a0133ed1b1479970b0134809d9f8b970c.jpg",
} as const;
const recipes = {
id: "recipes",
collection,
data: {
title: "Recipes",
icon: "🍲",
},
};
cover:
"https://marka.max-richter.dev/resources/recipes/images/auberginen_reispfanne.webp",
} as const;
const movies = {
id: "movies",
collection,
data: {
title: "Movies",
icon: "🎥",
},
};
cover:
"https://marka.max-richter.dev/resources/movies/images/2001_a_space_odyssey_cover.jpg",
} as const;
const series = {
id: "series",
collection,
data: {
title: "Series",
icon: "📺",
},
};
cover:
"https://marka.max-richter.dev/resources/series/images/arcane_cover.jpg",
} as const;
export const resources: ResourceType[] = [recipes, articles, movies, series];