35 lines
1001 B
Plaintext
35 lines
1001 B
Plaintext
---
|
|
import AppEmptyLayout from "components/AppLayout/AppEmptyLayout.astro";
|
|
import Lightbox from "components/Lightbox.astro";
|
|
import { getI18n } from "src/i18n/i18n";
|
|
import { payload } from "src/shared/payload/payload-sdk";
|
|
import { fetchOr404 } from "src/utils/responses";
|
|
|
|
const { id } = Astro.params;
|
|
const image = await fetchOr404(() => payload.getImageByID(id!));
|
|
if (image instanceof Response) {
|
|
return image;
|
|
}
|
|
|
|
const { getLocalizedMatch } = await getI18n(Astro.locals.currentLocale);
|
|
const { filename, translations, tagGroups, credits } = image;
|
|
|
|
const { title, description } =
|
|
translations.length > 0
|
|
? getLocalizedMatch(translations)
|
|
: { title: filename, description: undefined };
|
|
---
|
|
|
|
{/* ------------------------------------------- HTML ------------------------------------------- */}
|
|
|
|
<AppEmptyLayout>
|
|
<Lightbox
|
|
image={image}
|
|
title={title}
|
|
description={description}
|
|
filename={filename}
|
|
tagGroups={tagGroups}
|
|
credits={credits}
|
|
/>
|
|
</AppEmptyLayout>
|