2026-05-06 21:51:55 +00:00
|
|
|
<script lang="ts">
|
2026-05-07 20:43:02 +00:00
|
|
|
import { locale, makeTranslate } from '$lib/i8n';
|
|
|
|
|
import translations from '../translations';
|
|
|
|
|
|
2026-05-06 21:51:55 +00:00
|
|
|
type Props = {
|
|
|
|
|
entries: {
|
|
|
|
|
id: string;
|
|
|
|
|
text: string;
|
|
|
|
|
possibleChoices: {
|
|
|
|
|
id: string;
|
|
|
|
|
text: string;
|
|
|
|
|
isSelected: boolean;
|
|
|
|
|
}[];
|
|
|
|
|
}[];
|
|
|
|
|
};
|
|
|
|
|
|
2026-05-07 20:43:02 +00:00
|
|
|
const t = $derived(makeTranslate(translations, $locale));
|
|
|
|
|
|
2026-05-06 21:51:55 +00:00
|
|
|
const { entries }: Props = $props();
|
|
|
|
|
|
|
|
|
|
function toParagraphs(text: string): string[] {
|
|
|
|
|
return text
|
|
|
|
|
.split(/\n\s*\n/g)
|
|
|
|
|
.map((paragraph) => paragraph.trim())
|
|
|
|
|
.filter(Boolean);
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
{#if entries.length > 0}
|
|
|
|
|
<section class="previous-entries" aria-label="Previous story entries">
|
|
|
|
|
<header class="previous-entries__header">
|
2026-05-07 20:43:02 +00:00
|
|
|
<h2 class="previous-entries__title">{t('previousEntries.title')}</h2>
|
2026-05-06 21:51:55 +00:00
|
|
|
</header>
|
|
|
|
|
|
2026-05-07 20:43:02 +00:00
|
|
|
<ol class="list">
|
2026-05-06 21:51:55 +00:00
|
|
|
{#each entries as entry, index (entry.id)}
|
|
|
|
|
<li class="previous-entries__item">
|
2026-05-07 20:43:02 +00:00
|
|
|
<article
|
|
|
|
|
class="entry-card"
|
|
|
|
|
aria-label={t('previousEntries.entryTitle', {
|
|
|
|
|
entryNumber: String(index + 1).padStart(2, '0')
|
|
|
|
|
})}
|
|
|
|
|
>
|
2026-05-06 21:51:55 +00:00
|
|
|
<header class="entry-card__header">
|
2026-05-07 20:43:02 +00:00
|
|
|
<p class="entry-card__index">
|
|
|
|
|
{t('previousEntries.entryTitle', {
|
|
|
|
|
entryNumber: String(index + 1).padStart(2, '0')
|
|
|
|
|
})}
|
|
|
|
|
</p>
|
2026-05-06 21:51:55 +00:00
|
|
|
</header>
|
|
|
|
|
|
|
|
|
|
<div class="entry-card__body">
|
|
|
|
|
{#each toParagraphs(entry.text) as paragraph, paragraphIndex (paragraphIndex)}
|
|
|
|
|
<p class="entry-card__paragraph">{paragraph}</p>
|
|
|
|
|
{/each}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{#if entry.possibleChoices.length > 0}
|
|
|
|
|
<footer class="entry-card__choices">
|
2026-05-07 20:43:02 +00:00
|
|
|
<p class="entry-card__choices-label">{t('previousEntries.possibleChoices')}</p>
|
2026-05-06 21:51:55 +00:00
|
|
|
<ul class="entry-card__choices-list" aria-label="Choices for this entry">
|
|
|
|
|
{#each entry.possibleChoices as choice, choiceIndex (choice.id)}
|
2026-05-07 20:43:02 +00:00
|
|
|
<li
|
|
|
|
|
class="entry-card__choice"
|
|
|
|
|
class:entry-card__choice--selected={choice.isSelected}
|
|
|
|
|
>
|
2026-05-06 21:51:55 +00:00
|
|
|
<span class="entry-card__choice-index" aria-hidden="true"
|
|
|
|
|
>{String(choiceIndex + 1).padStart(2, '0')}</span
|
|
|
|
|
>
|
|
|
|
|
<span class="entry-card__choice-text">{choice.text}</span>
|
|
|
|
|
{#if choice.isSelected}
|
2026-05-07 20:43:02 +00:00
|
|
|
<span class="entry-card__choice-state">{t('options.selected')}</span>
|
2026-05-06 21:51:55 +00:00
|
|
|
{/if}
|
|
|
|
|
</li>
|
|
|
|
|
{/each}
|
|
|
|
|
</ul>
|
|
|
|
|
</footer>
|
|
|
|
|
{/if}
|
|
|
|
|
</article>
|
|
|
|
|
</li>
|
|
|
|
|
{/each}
|
|
|
|
|
</ol>
|
|
|
|
|
</section>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
.previous-entries {
|
|
|
|
|
--previous-surface: var(--color-surface-container-low);
|
|
|
|
|
--previous-surface-elevated: var(--color-surface-container-lowest);
|
|
|
|
|
max-width: 88rem;
|
|
|
|
|
border-radius: var(--radius-xl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.previous-entries__header {
|
|
|
|
|
margin-bottom: var(--space-4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.previous-entries__title {
|
|
|
|
|
margin: var(--space-1) 0 0;
|
|
|
|
|
font-family: var(--font-display);
|
|
|
|
|
font-size: clamp(1.3rem, 1.12rem + 0.85vw, 1.9rem);
|
|
|
|
|
line-height: 1.15;
|
|
|
|
|
color: var(--color-on-surface);
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-07 20:43:02 +00:00
|
|
|
.previous-entries .list {
|
2026-05-06 21:51:55 +00:00
|
|
|
list-style: none;
|
|
|
|
|
padding: 0;
|
|
|
|
|
margin: 0;
|
|
|
|
|
display: grid;
|
2026-05-07 20:43:02 +00:00
|
|
|
gap: var(--space-5);
|
2026-05-06 21:51:55 +00:00
|
|
|
grid-template-columns: 1fr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.entry-card {
|
|
|
|
|
border-radius: var(--radius-lg);
|
|
|
|
|
background-color: var(--previous-surface-elevated);
|
2026-05-07 20:43:02 +00:00
|
|
|
display: grid;
|
|
|
|
|
grid-template-columns: 1fr;
|
|
|
|
|
grid-template-rows: auto 1fr;
|
|
|
|
|
place-items: center;
|
|
|
|
|
gap: var(--space-5);
|
|
|
|
|
padding: var(--space-4) var(--space-1);
|
2026-05-06 21:51:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.entry-card__header {
|
|
|
|
|
margin-bottom: var(--space-2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.entry-card__index {
|
|
|
|
|
margin: 0;
|
|
|
|
|
font-family: var(--font-label);
|
|
|
|
|
font-size: var(--text-label-md);
|
|
|
|
|
font-weight: var(--weight-semibold);
|
|
|
|
|
letter-spacing: 0.08em;
|
|
|
|
|
text-transform: uppercase;
|
|
|
|
|
color: color-mix(in srgb, var(--color-on-surface) 72%, transparent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.entry-card__body::-webkit-scrollbar {
|
|
|
|
|
width: 0.65rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.entry-card__body::-webkit-scrollbar-track {
|
|
|
|
|
background: transparent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.entry-card__body::-webkit-scrollbar-thumb {
|
|
|
|
|
background-color: color-mix(in srgb, var(--colour-yellow-300) 26%, transparent);
|
|
|
|
|
border: 0.16rem solid transparent;
|
|
|
|
|
border-radius: var(--radius-full);
|
|
|
|
|
background-clip: content-box;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.entry-card__paragraph {
|
|
|
|
|
font-family: var(--font-body);
|
2026-05-07 20:43:02 +00:00
|
|
|
font-size: var(--text-body-md);
|
|
|
|
|
line-height: var(--leading-xloose);
|
2026-05-06 21:51:55 +00:00
|
|
|
color: var(--color-on-surface);
|
|
|
|
|
text-wrap: pretty;
|
2026-05-07 20:43:02 +00:00
|
|
|
max-width: 65ch;
|
2026-05-06 21:51:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.entry-card__paragraph + .entry-card__paragraph {
|
|
|
|
|
margin-top: var(--space-3);
|
|
|
|
|
padding-top: var(--space-3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.entry-card__choices {
|
2026-05-07 20:43:02 +00:00
|
|
|
max-width: 65ch;
|
|
|
|
|
font-size: var(--text-body-md);
|
2026-05-06 21:51:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.entry-card__choices-label {
|
|
|
|
|
margin: 0 0 var(--space-2);
|
|
|
|
|
font-family: var(--font-label);
|
|
|
|
|
font-size: var(--text-label-md);
|
|
|
|
|
font-weight: var(--weight-medium);
|
|
|
|
|
letter-spacing: var(--tracking-wide);
|
|
|
|
|
text-transform: uppercase;
|
|
|
|
|
color: color-mix(in srgb, var(--color-on-surface) 72%, transparent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.entry-card__choices-list {
|
|
|
|
|
list-style: none;
|
|
|
|
|
margin: 0;
|
|
|
|
|
padding: 0;
|
|
|
|
|
display: grid;
|
|
|
|
|
gap: var(--space-2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.entry-card__choice {
|
|
|
|
|
display: grid;
|
|
|
|
|
grid-template-columns: auto 1fr auto;
|
2026-05-07 20:43:02 +00:00
|
|
|
place-items: center;
|
2026-05-06 21:51:55 +00:00
|
|
|
gap: var(--space-2);
|
|
|
|
|
padding: var(--space-2);
|
|
|
|
|
border-radius: var(--radius-md);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.entry-card__choice-index {
|
|
|
|
|
font-family: var(--font-label);
|
|
|
|
|
font-size: var(--text-label-md);
|
|
|
|
|
font-weight: var(--weight-medium);
|
|
|
|
|
letter-spacing: var(--tracking-wide);
|
|
|
|
|
color: color-mix(in srgb, var(--color-on-surface) 62%, transparent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.entry-card__choice-text {
|
|
|
|
|
font-family: var(--font-body);
|
2026-05-07 20:43:02 +00:00
|
|
|
font-size: var(--text-body-md);
|
2026-05-06 21:51:55 +00:00
|
|
|
line-height: var(--leading-relaxed);
|
|
|
|
|
color: color-mix(in srgb, var(--color-on-surface) 84%, transparent);
|
|
|
|
|
text-wrap: pretty;
|
2026-05-07 20:43:02 +00:00
|
|
|
width: 100%;
|
2026-05-06 21:51:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.entry-card__choice-state {
|
|
|
|
|
font-family: var(--font-label);
|
|
|
|
|
font-size: var(--text-label-md);
|
|
|
|
|
font-weight: var(--weight-medium);
|
|
|
|
|
letter-spacing: var(--tracking-wide);
|
|
|
|
|
text-transform: uppercase;
|
|
|
|
|
color: var(--color-primary);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.entry-card__choice--selected {
|
|
|
|
|
background-color: color-mix(in srgb, var(--color-primary-container) 56%, transparent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.entry-card__choice--selected .entry-card__choice-text {
|
|
|
|
|
color: var(--color-on-surface);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media (max-width: 42rem) {
|
|
|
|
|
.previous-entries {
|
|
|
|
|
padding: var(--space-2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.entry-card {
|
|
|
|
|
padding: var(--space-3);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|