feat: add confidential ballot reference provider

This commit is contained in:
2026-08-02 03:41:01 +02:00
parent c176c5cfcb
commit 0a4e06077d
10 changed files with 1505 additions and 44 deletions
@@ -49,7 +49,16 @@ export default function VotingBallotDialog({
&& draft.options.every((item) => item.key.trim() && item.label.trim())
&& draft.electorate.length > 0
&& draft.electorate.every((item) => item.subject_id.trim() && item.weight > 0)
&& (draft.assurance_profile === "recorded" || (draft.provider_id?.trim() && draft.provider_ballot_ref?.trim()))
&& (
draft.assurance_profile === "recorded"
|| (
draft.provider_id?.trim()
&& (
draft.provider_id.trim() === "local_confidential"
|| draft.provider_ballot_ref?.trim()
)
)
)
), [draft]);
async function save() {
@@ -104,7 +113,21 @@ export default function VotingBallotDialog({
</FormField>
<FormField label="Description" className="voting-editor-wide"><textarea rows={3} value={draft.description ?? ""} disabled={busy} onChange={(event) => setDraft({ ...draft, description: event.target.value })} /></FormField>
<FormField label="Assurance profile">
<select value={draft.assurance_profile} disabled={busy} onChange={(event) => setDraft({ ...draft, assurance_profile: event.target.value as VotingBallotDraft["assurance_profile"] })}>
<select value={draft.assurance_profile} disabled={busy} onChange={(event) => {
const assurance_profile = event.target.value as VotingBallotDraft["assurance_profile"];
setDraft({
...draft,
assurance_profile,
provider_id: assurance_profile === "recorded"
? null
: assurance_profile === "confidential"
? "local_confidential"
: draft.provider_id === "local_confidential" ? "" : draft.provider_id,
provider_ballot_ref: assurance_profile === "recorded" || assurance_profile === "confidential"
? null
: draft.provider_ballot_ref
});
}}>
<option value="recorded">Recorded</option>
<option value="confidential">Confidential provider</option>
<option value="secret">Secret provider</option>
@@ -117,7 +140,14 @@ export default function VotingBallotDialog({
<div className="voting-editor-toggle"><ToggleSwitch label="Allow vote replacement" checked={draft.allow_replacement} disabled={busy} onChange={(allow_replacement) => setDraft({ ...draft, allow_replacement })} /></div>
{draft.assurance_profile !== "recorded" && <>
<FormField label="Provider id"><input value={draft.provider_id ?? ""} disabled={busy} onChange={(event) => setDraft({ ...draft, provider_id: event.target.value })} /></FormField>
<FormField label="Provider ballot reference"><input value={draft.provider_ballot_ref ?? ""} disabled={busy} onChange={(event) => setDraft({ ...draft, provider_ballot_ref: event.target.value })} /></FormField>
<FormField label="Provider ballot reference">
<input
value={draft.provider_ballot_ref ?? ""}
placeholder={draft.provider_id === "local_confidential" ? "Generated when opened" : undefined}
disabled={busy || draft.provider_id === "local_confidential"}
onChange={(event) => setDraft({ ...draft, provider_ballot_ref: event.target.value })}
/>
</FormField>
</>}
</div>