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 { fetchParish } from '@/fetch/parish'
import { fetchLastAnnouncement } from '@/fetch/announcement'
import { transformGallery } from '@/utils/dto/gallery'
import { getPhoto, transformGallery } from '@/utils/dto/gallery'
import { fetchLastCalendar } from '@/fetch/calendar'
import { isAuthenticated } from '@/utils/auth'
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 calendar = await fetchLastCalendar(id);
const authenticated = await isAuthenticated();
const image = getPhoto("tablet", photo)
return (
<>
<Parish
title={name}
slug={slug}
image={typeof photo === "string" ? photo : photo.url || "notfound"}
image={image || "notfound"}
description={description}
history={history}
contactPersons={contactPersons || []}

View file

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