feat(geschichten): blog-like family memory stories (closes #381) #382

Merged
marcel merged 30 commits from feat/issue-381-geschichten into main 2026-05-04 15:02:45 +02:00
2 changed files with 36 additions and 14 deletions
Showing only changes of commit 4f3020ffab - Show all commits

View File

@@ -53,22 +53,24 @@ function authorName(g: Geschichte): string {
{/if}
</header>
<ul class="flex flex-col gap-4">
<ul class="-mx-2">
{#each visible as g (g.id)}
<li class="flex flex-col gap-1 border-b border-line pb-3 last:border-0 last:pb-0">
<li>
<a
href="/geschichten/{g.id}"
class="font-serif text-base font-bold text-ink hover:underline"
class="group flex flex-col gap-1 border-b border-line px-2 py-3 transition-colors last:border-b-0 hover:bg-muted"
>
{g.title}
<span class="font-serif text-base font-bold text-ink group-hover:underline">
{g.title}
</span>
<span class="font-sans text-xs text-ink-3">
{authorName(g)}
{#if formatPublishedDate(g)}· {formatPublishedDate(g)}{/if}
</span>
{#if g.body}
<span class="font-serif text-sm text-ink-2">{plainExcerpt(g.body, 80)}</span>
{/if}
</a>
<p class="font-sans text-xs text-ink-3">
{authorName(g)}
{#if formatPublishedDate(g)}· {formatPublishedDate(g)}{/if}
</p>
{#if g.body}
<p class="font-serif text-sm text-ink-2">{plainExcerpt(g.body, 80)}</p>
{/if}
</li>
{/each}
</ul>

View File

@@ -51,9 +51,29 @@ describe('GeschichtenCard', () => {
canWrite: false
});
await expect.element(page.getByText('Geschichten')).toBeInTheDocument();
await expect
.element(page.getByRole('link', { name: 'Erinnerung an Franz' }))
.toBeInTheDocument();
// The whole row is one link to the story; matching on the title text via
// a partial regex tolerates trailing author/date metadata in the
// accessible name.
const link = await page
.getByRole('link', { name: /Erinnerung an Franz/ })
.first()
.element();
expect(link.getAttribute('href')).toBe('/geschichten/g1');
});
it('makes the entire story row a single clickable link', async () => {
render(GeschichtenCard, {
geschichten: [makeStory('g1', 'A title', '<p>Some body excerpt text</p>')],
personId: 'p1',
personName: 'Franz',
canWrite: false
});
// The body-excerpt text is inside the same <a> as the title.
const links = await page.getByRole('link', { name: /A title/ }).all();
expect(links.length).toBeGreaterThan(0);
const linkEl = await links[0].element();
expect(linkEl.tagName).toBe('A');
expect(linkEl.textContent).toContain('Some body excerpt text');
});
it('hides the "+ Geschichte schreiben" link when canWrite is false', async () => {