Add description exports and collapse characters from same user
This commit is contained in:
parent
2990644f87
commit
d4a9dc9dbc
78 changed files with 693 additions and 247 deletions
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
import { Image } from "astro:assets";
|
||||
import { type CollectionEntry } from "astro:content";
|
||||
import { type CollectionEntry, getEntry, getEntries } from "astro:content";
|
||||
import { Markdown } from "@astropub/md";
|
||||
import { format as formatDate } from "date-fns";
|
||||
import { enUS as enUSLocale } from "date-fns/locale/en-US";
|
||||
|
|
@ -13,8 +13,17 @@ import Prose from "../components/Prose.astro";
|
|||
type Props = CollectionEntry<"games">["data"];
|
||||
|
||||
const { props } = Astro;
|
||||
//const relatedStories = (await Promise.all((props.relatedStories || []).map(story => getEntry(story)))).filter(story => !story.data.isDraft)
|
||||
// const relatedGames = (await Promise.all((props.relatedGames || []).map(game => getEntry(game)))).filter(game => !game.data.isDraft)
|
||||
const authors = await getEntries([props.authors].flat());
|
||||
const copyrightedCharacters: Record<string, CollectionEntry<"users">> = {};
|
||||
Object.keys(props.copyrightedCharacters).forEach(async (character) => {
|
||||
copyrightedCharacters[character] = await getEntry(props.copyrightedCharacters[character]);
|
||||
});
|
||||
// const relatedStories = (await getEntries(props.relatedStories)).filter(
|
||||
// (story) => !story.data.isDraft,
|
||||
// );
|
||||
// const relatedGames = (await getEntries(props.relatedGames)).filter(
|
||||
// (game) => !game.data.isDraft,
|
||||
// );
|
||||
---
|
||||
|
||||
<AgeRestrictedBaseLayout pageTitle={props.title}>
|
||||
|
|
@ -74,7 +83,7 @@ const { props } = Astro;
|
|||
id="game-information"
|
||||
class="mt-1 space-y-2 px-2 font-serif font-light italic text-stone-600 dark:text-stone-200"
|
||||
>
|
||||
<Authors authors={props.authors} lang={props.lang} />
|
||||
<Authors authors={authors} lang={props.lang} />
|
||||
{
|
||||
props.isDraft ? (
|
||||
<p id="draft-warning" class="py-2 text-center text-2xl font-semibold not-italic text-red-600">
|
||||
|
|
@ -131,7 +140,7 @@ const { props } = Astro;
|
|||
</h2>
|
||||
<Prose>
|
||||
<Markdown of={props.description} />
|
||||
<CopyrightedCharacters copyrightedCharacters={props.copyrightedCharacters} lang={props.lang} />
|
||||
<CopyrightedCharacters copyrightedCharacters={copyrightedCharacters} lang={props.lang} />
|
||||
</Prose>
|
||||
</section>
|
||||
<div class="pr-3 text-right print:hidden">
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
import { Image } from "astro:assets";
|
||||
import { getEntry, type CollectionEntry } from "astro:content";
|
||||
import { type CollectionEntry, getEntry, getEntries } from "astro:content";
|
||||
import { Markdown } from "@astropub/md";
|
||||
import { format as formatDate } from "date-fns";
|
||||
import { enUS as enUSLocale } from "date-fns/locale/en-US";
|
||||
|
|
@ -22,10 +22,15 @@ let next = props.next && (await getEntry(props.next));
|
|||
if (next && next.data.isDraft) {
|
||||
next = undefined;
|
||||
}
|
||||
const relatedStories = (await Promise.all((props.relatedStories || []).map((story) => getEntry(story)))).filter(
|
||||
(story) => !story.data.isDraft,
|
||||
);
|
||||
// const relatedGames = (await Promise.all((props.relatedGames || []).map(game => getEntry(game)))).filter(
|
||||
const authors = await getEntries([props.authors].flat());
|
||||
const commissioner = props.commissioner && (await getEntry(props.commissioner));
|
||||
const requester = props.requester && (await getEntry(props.requester));
|
||||
const copyrightedCharacters: Record<string, CollectionEntry<"users">> = {};
|
||||
Object.keys(props.copyrightedCharacters).forEach(async (character) => {
|
||||
copyrightedCharacters[character] = await getEntry(props.copyrightedCharacters[character]);
|
||||
});
|
||||
const relatedStories = (await getEntries(props.relatedStories)).filter((story) => !story.data.isDraft);
|
||||
// const relatedGames = (await getEntries(props.relatedGames)).filter(
|
||||
// (game) => !game.data.isDraft,
|
||||
// );
|
||||
---
|
||||
|
|
@ -122,7 +127,7 @@ const relatedStories = (await Promise.all((props.relatedStories || []).map((stor
|
|||
id="story-information"
|
||||
class="mt-1 space-y-2 px-2 font-serif font-light italic text-stone-600 dark:text-stone-200"
|
||||
>
|
||||
<Authors authors={props.authors} lang={props.lang} />
|
||||
<Authors authors={authors} lang={props.lang} />
|
||||
{
|
||||
props.isDraft ? (
|
||||
<p id="draft-warning" class="py-2 text-center text-2xl font-semibold not-italic text-red-600">
|
||||
|
|
@ -131,16 +136,16 @@ const relatedStories = (await Promise.all((props.relatedStories || []).map((stor
|
|||
) : null
|
||||
}
|
||||
{
|
||||
props.commissioner && (
|
||||
commissioner && (
|
||||
<p id="commissioner">
|
||||
Commissioned by <UserComponent user={props.commissioner} />
|
||||
Commissioned by <UserComponent user={commissioner} lang={props.lang} />
|
||||
</p>
|
||||
)
|
||||
}
|
||||
{
|
||||
props.requester && (
|
||||
requester && (
|
||||
<p id="requester">
|
||||
Requested by <UserComponent user={props.requester} />
|
||||
Requested by <UserComponent user={requester} lang={props.lang} />
|
||||
</p>
|
||||
)
|
||||
}
|
||||
|
|
@ -196,7 +201,7 @@ const relatedStories = (await Promise.all((props.relatedStories || []).map((stor
|
|||
</h2>
|
||||
<Prose>
|
||||
<Markdown of={props.description} />
|
||||
<CopyrightedCharacters copyrightedCharacters={props.copyrightedCharacters} lang={props.lang} />
|
||||
<CopyrightedCharacters copyrightedCharacters={copyrightedCharacters} lang={props.lang} />
|
||||
</Prose>
|
||||
</section>
|
||||
<div class="pr-3 text-right print:hidden">
|
||||
|
|
@ -281,7 +286,9 @@ const relatedStories = (await Promise.all((props.relatedStories || []).map((stor
|
|||
</main>
|
||||
<div class="pt-6 text-center text-xs text-black dark:text-white">
|
||||
<span>© {formatDate(props.pubDate, "yyyy")} | </span>
|
||||
<a class="hover:underline focus:underline" href="/licenses.txt" target="_blank">Licenses</a>
|
||||
<a class="hover:underline focus:underline" href="/licenses.txt" target="_blank"
|
||||
>{props.lang === "eng" ? "Licenses" : props.lang === "tok" ? "lipu lawa" : null}</a
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</AgeRestrictedBaseLayout>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue