fix: image size

This commit is contained in:
Benno Tielen 2025-03-12 15:32:19 +01:00
parent dc45598578
commit 6ea099403a
2 changed files with 6 additions and 3 deletions

View file

@ -4,7 +4,7 @@ import { fetchEvents } from '@/fetch/events'
import { fetchWorship } from '@/fetch/worship' import { fetchWorship } from '@/fetch/worship'
import { fetchParish } from '@/fetch/parish' import { fetchParish } from '@/fetch/parish'
import { fetchLastAnnouncement } from '@/fetch/announcement' import { fetchLastAnnouncement } from '@/fetch/announcement'
import { transformGallery } from '@/utils/dto/gallery' import { getPhoto, transformGallery } from '@/utils/dto/gallery'
import { fetchLastCalendar } from '@/fetch/calendar' import { fetchLastCalendar } from '@/fetch/calendar'
import { isAuthenticated } from '@/utils/auth' import { isAuthenticated } from '@/utils/auth'
import { AdminMenu } from '@/components/AdminMenu/AdminMenu' import { AdminMenu } from '@/components/AdminMenu/AdminMenu'
@ -35,12 +35,13 @@ export default async function ParishPage ({ params }: { params: Promise<{slug: s
const announcement = await fetchLastAnnouncement(id); const announcement = await fetchLastAnnouncement(id);
const calendar = await fetchLastCalendar(id); const calendar = await fetchLastCalendar(id);
const authenticated = await isAuthenticated(); const authenticated = await isAuthenticated();
const image = getPhoto("tablet", photo)
return ( return (
<> <>
<Parish <Parish
title={name} title={name}
slug={slug} slug={slug}
image={typeof photo === "string" ? photo : photo.url || "notfound"} image={image || "notfound"}
description={description} description={description}
history={history} history={history}
contactPersons={contactPersons || []} contactPersons={contactPersons || []}

View file

@ -1,13 +1,15 @@
import { Blog } from '@/payload-types' import { Blog } from '@/payload-types'
import { Slide } from '@/compositions/ImageCardSlider/ImageCardSlider' import { Slide } from '@/compositions/ImageCardSlider/ImageCardSlider'
import { getPhoto } from '@/utils/dto/gallery'
export const blogToSlides = (blog: Blog[]): Slide[] => { export const blogToSlides = (blog: Blog[]): Slide[] => {
return blog.map(b => { return blog.map(b => {
const image = getPhoto("thumbnail", b.photo)
return { return {
id: b.id, id: b.id,
title: b.title, title: b.title,
href: `/blog/${b.id}`, href: `/blog/${b.id}`,
src: typeof b.photo === "string" ? b.photo : b.photo?.url || "" src: typeof image === "object" ? image.src : ""
} }
}) })
} }