v3 : modules d'ordre et de titre — l'interface, restes mineurs (L11, C25–C27)
Chaque section du lecteur finit par l'ordre de ses articles (inertie 2) : ses articles numérotés, son vote déplié, « Proposer un autre ordre » — une liste où l'on clique un article puis sa place, ses flèches, ou le clavier. Le titre du document (inertie 4) se vote et se propose sous le titre, « traduction à revoir » quand il a changé. Les deux sont dans la liste des propositions, le panier et la chaîne Ğ1 ; un nouvel article se propose dans une section, à sa fin. La liste du groupe compte les propositions ouvertes des modules. Restes mineurs : la participation ramenée se dit en deux temps (la mesure, puis ce que le groupe demande), les lignes « habituelle » des réglages resserrées, le sélecteur d'inertie se parcourt aux flèches (le cran actuel atteignable, jamais choisi), la marque « seed a minima » porte le vrai nombre de votes. Contrôles : C25 (ordre, dont la chaîne et le téléphone), C26 (titre), C27 (participation ramenée) ; C3, C17 (41 modules), C20 mis à jour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+29
-2
@@ -1,4 +1,4 @@
|
||||
import { t } from './i18n/index.svelte';
|
||||
import { i18n, t, type Key } from './i18n/index.svelte';
|
||||
import type { Inertia, Proposal, Unit } from './types';
|
||||
|
||||
/** « 3 / 5 · moyenne ». */
|
||||
@@ -11,18 +11,45 @@ export function inertiaBadge(k: Inertia): string {
|
||||
return t('inertia.badge', { level: inertiaLevel(k) });
|
||||
}
|
||||
|
||||
const SECTIONS = ['introduction', 'fondamental', 'technique', 'conclusion', 'annexe', 'formule', 'inertie', 'ordonnancement'];
|
||||
|
||||
/** The name of a section of the seed, or null. */
|
||||
export function sectionLabel(s: string | null | undefined): string | null {
|
||||
return s && SECTIONS.includes(s) ? t(`section.${s}` as Key) : null;
|
||||
}
|
||||
|
||||
/** The name of a module (ADR 0009): « Titre du document », « Ordre des articles · Conclusion ». */
|
||||
export function moduleName(unit: Unit): string {
|
||||
if (unit.kind === 'title') return t('module.title.name');
|
||||
const section = sectionLabel(unit.section) ?? unit.section;
|
||||
return section ? t('module.order.named', { section }) : t('module.order.name');
|
||||
}
|
||||
|
||||
/** 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: inertiaLevel(p.inertiaTarget) });
|
||||
}
|
||||
if (p.kind === 'remove') return t('deep.removal', { title: unit?.inForce?.title ?? p.title });
|
||||
if (p.kind === 'order') return unit ? moduleName(unit) : t('module.order.name');
|
||||
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 (p.kind !== 'text' && p.kind !== 'title') return '';
|
||||
if (unit?.inForce && unit.inForce.id !== p.id) return t('deep.rival', { title: unit.inForce.title });
|
||||
return '';
|
||||
}
|
||||
|
||||
/** What an order version says of itself: completed at the end, or the order in force already. */
|
||||
export function orderNote(p: Proposal): string[] {
|
||||
const o = p.order;
|
||||
if (!o || p.status === 'in_force') return [];
|
||||
const notes: string[] = [];
|
||||
if (o.added.length) notes.push(i18n.plural('module.order.added', o.added.length));
|
||||
if (o.dropped.length) notes.push(i18n.plural('module.order.dropped', o.dropped.length));
|
||||
if (o.same) notes.push(t('module.order.same'));
|
||||
return notes;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user