Lot U : le lecteur refait — l'ordre en une ligne au bout de sa section, poignées sur place (Reorder), le titre et l'ordre votés à leur place ; Propositions seed en tête quand rien n'est en vigueur ; Propositions en cours repliées par section ; panneau sans onglets ; oui pour passer · non pour bloquer ; quorum de l'auteur ; votes simulés dits simulés
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -78,3 +78,36 @@ export function articles(items: { unit: Unit; proposal: Proposal }[], filter: Fi
|
||||
return { unit, versions: ranked, leads: !!best && !!next && compare(best, next) < 0 };
|
||||
});
|
||||
}
|
||||
|
||||
/** A section of « Propositions en cours » (lot U): its articles, and its order when it closes here. */
|
||||
export interface DeepSection {
|
||||
key: string | null;
|
||||
articles: Article[];
|
||||
/** The order of the section, when the section is not read in the text above. */
|
||||
order?: Unit;
|
||||
}
|
||||
|
||||
/**
|
||||
* The open proposals by section, in the order of the document (`keys`, the sections as the
|
||||
* document lists them): each section holds its articles, then its order when the order
|
||||
* closes it here — a section read in the text above has its order there. A section with
|
||||
* only its order to show is kept.
|
||||
*/
|
||||
export function deepSections(articles: Article[], orders: Unit[], keys: (string | null)[]): DeepSection[] {
|
||||
const byKey = new Map<string | null, DeepSection>();
|
||||
for (const a of articles) {
|
||||
const s = byKey.get(a.unit.section) ?? { key: a.unit.section, articles: [] };
|
||||
s.articles.push(a);
|
||||
byKey.set(a.unit.section, s);
|
||||
}
|
||||
for (const order of orders) {
|
||||
const s = byKey.get(order.section) ?? { key: order.section, articles: [] };
|
||||
s.order = order;
|
||||
byKey.set(order.section, s);
|
||||
}
|
||||
const rank = (k: string | null) => {
|
||||
const i = keys.indexOf(k);
|
||||
return i < 0 ? keys.length : i;
|
||||
};
|
||||
return [...byKey.values()].sort((a, b) => rank(a.key) - rank(b.key));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user