Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Drop the workbook in `data/` named like `Physioshark_Shark Log 2026-2027.xlsx` (

- Follow the dataviz method: categorical slots in fixed order (`--series-1…8`, validated light and dark), sequential = one hue (`--seq-*`), diverging = blue ↔ red with a neutral midpoint, one y-axis only (never dual axes), legends for ≥ 2 series, text in ink tokens (never the series colour), 4 px rounded bar ends, 2 px lines, hover tooltips, data tables via `ChartCard table`.
- Every chart registers its data with the enclosing `ChartCard` (`registerCsv` in `charts/csv.ts`), which shows **Download CSV**. A new chart component must call `registerCsv` too. An explicit `ChartCard table` takes precedence.
- Cite the study behind a chart with `<ChartCard papers={['debaere2024lunar']}>` (ids in `src/lib/publications.ts`). Link only papers that analysed the same question with this dataset; check the abstract first. PDFs are served at `rummerlab.com/papers/<file>` (metadata in the rummerlab-website repo, `data/papers.json`).
- Species colours come from `src/lib/species.ts` (blacktip = slot 1, sicklefin lemon = slot 2).
- Charts measure their width (`bind:clientWidth`) and carry a `viewBox` so pre-hydration renders scale down instead of overflowing.
- Interactive marks (links) inside an SVG → the SVG gets `role="group"`, not `img` (axe `nested-interactive`). Only put `aria-label` on elements that are links.
Expand Down
2 changes: 1 addition & 1 deletion e2e/pages.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ test('nursery links open a profile and the menu works on mobile', async ({ page
await page.setViewportSize({ width: 375, height: 800 });
await page.goto('/');
await page.getByRole('button', { name: 'Menu' }).click();
await page.getByText('Biology').click();
await page.getByText('Biology', { exact: true }).click();
await page.getByRole('link', { name: /Growth/ }).click();
await expect(page.locator('h1')).toHaveText('Growth');
const overflow = await page.evaluate(
Expand Down
21 changes: 21 additions & 0 deletions src/lib/components/ChartCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { onMount, type Snippet } from 'svelte';
import DataTable, { type Column } from './DataTable.svelte';
import { collectCsv, slug, toCsv, type CsvTable } from './charts/csv';
import { paper, paperHref, type PaperId } from '#lib/publications';

let {
title,
Expand All @@ -10,6 +11,7 @@
source,
id,
table,
papers = [],
children
}: {
title: string;
Expand All @@ -18,6 +20,8 @@
source?: string;
id?: string;
table?: { columns: Column[]; rows: Record<string, unknown>[] };
/** Studies that analysed the same question with this dataset (`#lib/publications`). */
papers?: PaperId[];
children: Snippet;
} = $props();

Expand Down Expand Up @@ -65,6 +69,14 @@
Download CSV<span class="sr"> for {title}</span>
</button>
{/if}
{#if papers.length}
<p class="papers">
{papers.length > 1 ? 'Papers' : 'Paper'}:
{#each papers.map(paper) as p, i (p.id)}{#if i > 0};{/if}
<a href={paperHref(p)} title={p.title}>{p.authors} ({p.year})</a>,
<i>{p.journal}</i>{#if p.pdf}<span class="pdf">&nbsp;(PDF)</span>{/if}{/each}
</p>
{/if}
{#if source}<p class="source">Source: {source}</p>{/if}
</figure>

Expand Down Expand Up @@ -95,6 +107,15 @@
margin: 10px 0 0;
line-height: 1.5;
}
.papers {
font-size: 0.78rem;
color: var(--ink-2);
margin: 8px 0 0;
line-height: 1.5;
}
.pdf {
color: var(--muted);
}
.source {
font-size: 0.74rem;
color: var(--muted);
Expand Down
Loading
Loading