99 lines
3.6 KiB
Text
99 lines
3.6 KiB
Text
---
|
|
import { type CollectionEntry, getEntry, getEntries } from "astro:content";
|
|
import PublishedContentLayout from "./PublishedContentLayout.astro";
|
|
import { t } from "../i18n";
|
|
import Authors from "../components/Authors.astro";
|
|
import Commissioners from "../components/Commissioners.astro";
|
|
import Requesters from "../components/Requesters.astro";
|
|
import UserComponent from "../components/UserComponent.astro";
|
|
import Prose from "../components/Prose.astro";
|
|
|
|
type Props = CollectionEntry<"stories">["data"];
|
|
|
|
const { props } = Astro;
|
|
const prev = props.prev && (await getEntry(props.prev));
|
|
const next = props.next && (await getEntry(props.next));
|
|
const series = props.series && (await getEntry(props.series));
|
|
const authorsList = await getEntries(props.authors);
|
|
const commissionersList = props.commissioners && (await getEntries(props.commissioners));
|
|
const requestersList = props.requesters && (await getEntries(props.requesters));
|
|
const relatedStories = (await getEntries(props.relatedStories)).filter((story) => !story.data.isDraft);
|
|
const relatedGames = (await getEntries(props.relatedGames)).filter((game) => !game.data.isDraft);
|
|
const wordCount = props.wordCount?.toString();
|
|
---
|
|
|
|
<PublishedContentLayout
|
|
publishedContentType="story"
|
|
title={props.title}
|
|
lang={props.lang}
|
|
isDraft={props.isDraft}
|
|
pubDate={props.pubDate}
|
|
description={props.description}
|
|
summary={props.summary}
|
|
tags={props.tags}
|
|
thumbnail={props.thumbnail}
|
|
thumbnailWidth={props.thumbnailWidth}
|
|
thumbnailHeight={props.thumbnailHeight}
|
|
copyrightedCharacters={props.copyrightedCharacters}
|
|
series={series}
|
|
prev={prev && !prev.data.isDraft
|
|
? {
|
|
link: `/stories/${prev.slug}`,
|
|
title: t(props.lang, "story/previous_story", prev.data.shortTitle || prev.data.title),
|
|
}
|
|
: undefined}
|
|
next={next && !next.data.isDraft
|
|
? {
|
|
link: `/stories/${next.slug}`,
|
|
title: t(props.lang, "story/next_story", next.data.shortTitle || next.data.title),
|
|
}
|
|
: undefined}
|
|
relatedStories={relatedStories}
|
|
relatedGames={relatedGames}
|
|
posts={props.posts}
|
|
labelReturnTo={{ title: t(props.lang, "story/return_to_stories"), link: "/stories/1" }}
|
|
labelPreviousContent={t(props.lang, "story/previous_story_aria_label")}
|
|
labelNextContent={t(props.lang, "story/next_story_aria_label")}
|
|
labelTitleSection={t(props.lang, "story/title_aria_label")}
|
|
labelInformationSection={t(props.lang, "story/information_aria_label")}
|
|
labelArticleSection={t(props.lang, "story/article_aria_label")}
|
|
>
|
|
<meta
|
|
slot="head-description"
|
|
property="og:description"
|
|
content={t(props.lang, "story/warnings", wordCount, props.contentWarning)}
|
|
/>
|
|
<Fragment slot="section-information">
|
|
<Authors lang={props.lang}>
|
|
{authorsList.map((author) => <UserComponent rel="author" class="p-author" user={author} lang={props.lang} />)}
|
|
</Authors>
|
|
{
|
|
requestersList && (
|
|
<Requesters lang={props.lang}>
|
|
{requestersList.map((requester) => (
|
|
<UserComponent class="p-name" user={requester} lang={props.lang} />
|
|
))}
|
|
</Requesters>
|
|
)
|
|
}
|
|
{
|
|
commissionersList && (
|
|
<Commissioners lang={props.lang}>
|
|
{commissionersList.map((commissioner) => (
|
|
<UserComponent class="p-name" user={commissioner} lang={props.lang} />
|
|
))}
|
|
</Commissioners>
|
|
)
|
|
}
|
|
</Fragment>
|
|
<div slot="section-content-warning" id="content-warning">
|
|
<p>
|
|
{t(props.lang, "story/warnings", wordCount, props.contentWarning)}
|
|
</p>
|
|
</div>
|
|
<Fragment slot="section-article">
|
|
<Prose>
|
|
<slot />
|
|
</Prose>
|
|
</Fragment>
|
|
</PublishedContentLayout>
|