Files
politics-tracking/web/src/components/Pagination.tsx
T
simonandClaude Opus 5.5 456f9816f4 Redesign the web app from a written design concept
Design concept and design system in docs/design/: principles (evidence
first, neutral, fair to the people shown, plain language, time as a
dimension, accessible and private), information architecture, core
patterns and a concept for every page; tokens with checked contrast,
component catalogue, content and accessibility rules.

web:
- neutral ink-indigo accent instead of flag red; party colours only as
  small markers next to the name; light/dark theme with a switcher
- stylesheets split into tokens, base, layout, components, print
- new header (search, filter count, language, theme, mobile menu) and
  footer; breadcrumbs, page headers, tabs with counts, filter bars that
  collapse on phones, pagination, notices and empty states
- claim cards with source meter, legal stage, innocence notice inside
  the card and a permalink; claim pages with citation (/angaben/{id})
- profiles with role timeline and key figures; party and organisation
  dashboards; vote list with position chips; calendar agenda on phones;
  tables that stack into cards; loading and error pages; favicon

backend:
- GET /api/v1/claims/{id} and MCP tool get_claim for permalinks
- parties list: evaluate person_status once instead of per party
  (30 s -> 1 s on the sample database, identical result)
- parliament calendar: HTML-decode titles ("84. Sitzung")

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 22:21:44 +01:00

25 lines
1.1 KiB
TypeScript

import {getTranslations} from 'next-intl/server';
import {Link} from '@/i18n/navigation';
import {Icon} from './Icon';
type Query = Record<string, string | undefined>;
/** Previous / page n / next. The API has no totals, so "next" appears when the page was full. */
export async function Pagination({pathname, query, page, hasNext}: {pathname: string; query: Query; page: number; hasNext: boolean}) {
if (page <= 1 && !hasNext) return null;
const t = await getTranslations('Common');
const clean = Object.fromEntries(Object.entries(query).filter(([, v]) => v)) as Record<string, string>;
const href = (p: number) => ({pathname, query: {...clean, page: String(p)}});
return (
<nav className="pagination" aria-label={t('pagination')}>
{page > 1 ? (
<Link href={href(page - 1)} rel="prev"><Icon name="arrow-left" /> {t('previous')}</Link>
) : <span className="is-hidden" aria-hidden="true" />}
<span>{t('page', {page})}</span>
{hasNext ? (
<Link href={href(page + 1)} rel="next">{t('next')} <Icon name="arrow-right" /></Link>
) : <span className="is-hidden" aria-hidden="true" />}
</nav>
);
}