forked from yvv/decision
Lot U : après la fusion, les contrats réels de S et V remplacent les champs annoncés ; canCast et byChain retirés (le serveur dit open et way)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -148,18 +148,6 @@ export interface Proposal {
|
||||
translations: Partial<Record<Lang, Translation>>;
|
||||
/** An order version: the order it gives its section now. */
|
||||
order?: OrderInfo;
|
||||
/**
|
||||
* Lot S: a « Proposition seed », proposed at the start to set the vote going — not in
|
||||
* force. Absent before lot S: read as false.
|
||||
*/
|
||||
seedProposal?: boolean;
|
||||
/**
|
||||
* Lot V: where this session's vote stands — recorded, waiting (the chain, the buffer of
|
||||
* intentions), or simulated while the chain is closed. Absent before lot V.
|
||||
*/
|
||||
myVoteState?: 'recorded' | 'pending' | 'simulated' | null;
|
||||
/** Lot V: votes cast and not counted yet (the buffer of intentions). */
|
||||
tallyPending?: Tally;
|
||||
}
|
||||
|
||||
export type Choice = 'for' | 'against' | 'none';
|
||||
@@ -195,11 +183,6 @@ export interface VoteAccess {
|
||||
simulated: boolean;
|
||||
reason: 'members_only' | 'chain_off' | null;
|
||||
chain: ChainSettings | null;
|
||||
/**
|
||||
* Lot V: the vote is simulated while the chain is closed — the buttons show as if it
|
||||
* were open, marked « vote simulé ». Absent before lot V.
|
||||
*/
|
||||
simulated?: true;
|
||||
}
|
||||
|
||||
/** A ballot of the chain, as `GET /api/ballots/{id}` tells it to the session that asked. */
|
||||
|
||||
+1
-14
@@ -6,7 +6,7 @@ import type { DocState } from './doc.svelte';
|
||||
import { i18n, t, type Key } from './i18n/index.svelte';
|
||||
import { toasts } from './toast.svelte';
|
||||
import { moduleName, sectionLabel } from './labels';
|
||||
import type { Entered, VoteAccess } from './types';
|
||||
import type { Entered } from './types';
|
||||
|
||||
/** A line of a vote: one version, for or against, or null to withdraw one's vote. */
|
||||
export interface Line {
|
||||
@@ -14,19 +14,6 @@ export interface Line {
|
||||
choice: 'for' | 'against' | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this session sees the buttons of the vote: open, or simulated while the chain is
|
||||
* closed (lot V: « les boutons de vote apparaissent partout comme si le vote était ouvert »).
|
||||
*/
|
||||
export function canCast(access: VoteAccess | null | undefined): boolean {
|
||||
return !!access && (access.open || access.simulated === true);
|
||||
}
|
||||
|
||||
/** A vote that goes through the person's Ğ1 wallet; a simulated vote never does. */
|
||||
export function byChain(access: VoteAccess | null | undefined): boolean {
|
||||
return access?.way === 'chain' && access.simulated !== true && !!access.chain;
|
||||
}
|
||||
|
||||
/** Cents of Ğ1, as the person reads them: « 0,1 » in French. */
|
||||
export function g1Amount(cents: number): string {
|
||||
return i18n.number(cents / 100);
|
||||
|
||||
Reference in New Issue
Block a user