import { t } from './i18n/index.svelte'; import type { Proposal, Unit } from './types'; /** What a proposal is, in words, whatever its kind. */ export function titleOf(p: Proposal, unit: Unit | undefined): string { if (p.kind === 'inertia' && p.inertiaTarget) { return t('deep.inertia', { level: t(`inertia.level.${p.inertiaTarget}`) }); } if (p.kind === 'remove') return t('deep.removal', { title: unit?.inForce?.title ?? p.title }); return p.title; } /** Its relation to the text in force. */ export function relationOf(p: Proposal, unit: Unit | undefined): string { if (p.kind !== 'text') return ''; if (unit?.inForce && unit.inForce.id !== p.id) return t('deep.rival', { title: unit.inForce.title }); return ''; }