chore: remove dead per-type helpers in /f/[slug]/+page.svelte
After commit 10's ParticipantInput dispatch, the per-type helpers in the participant page that the legacy inline rendering relied on are dead: - toggleMultiChoice (only used by the old multi_choice render block) - setDateRankedRating (only used by the old date_ranked_choice render block) - dateRankedRating (only used by the old date_ranked_choice render block) Removed. setAnswer is the one remaining helper — it's the callback wired to ParticipantInput's setAnswer prop. The three remaining `q.type === '...'` references in this file are intentional locale customizations (boolean Ja/Nein label override and date_ranked_choice per-option breakdown with formatted dates in the previousSubmission summary view) — they don't fit the registry contract and are flagged for m/fdbck#3 (i18n) when that ticket lands. Verified post-Phase 2: - 0 inline `q.type === '...'` strips outside lib/questions/ except the locale customizations above - 0 errors, 25 warnings (pre-existing — same set as before Phase 2 plus one a11y warning in date_ranked_choice.builder.svelte that mirrors the legacy FormBuilder warning that's now gone) - 123 server tests + 2 component tests pass - bun run check + bun run build clean
This commit is contained in:
@@ -371,29 +371,10 @@
|
||||
return dayBeforeFmt.format(d);
|
||||
}
|
||||
|
||||
function toggleMultiChoice(q: FeedbackQuestion, opt: string): void {
|
||||
if (q.type !== 'multi_choice') return;
|
||||
const cur = (answers[q.id] as string[] | undefined) ?? [];
|
||||
const next = cur.includes(opt) ? cur.filter((x) => x !== opt) : [...cur, opt];
|
||||
answers = { ...answers, [q.id]: next };
|
||||
}
|
||||
|
||||
function setAnswer(qid: string, value: unknown): void {
|
||||
answers = { ...answers, [qid]: value };
|
||||
}
|
||||
|
||||
function setDateRankedRating(qid: string, optId: string, rating: number | null): void {
|
||||
const cur = (answers[qid] as Record<string, number | null> | undefined) ?? {};
|
||||
answers = { ...answers, [qid]: { ...cur, [optId]: rating } };
|
||||
}
|
||||
|
||||
function dateRankedRating(qid: string, optId: string): number | null {
|
||||
const cur = answers[qid] as Record<string, number | null> | undefined;
|
||||
if (!cur) return null;
|
||||
const v = cur[optId];
|
||||
return typeof v === 'number' ? v : null;
|
||||
}
|
||||
|
||||
const dateOptionFmt = new Intl.DateTimeFormat([], {
|
||||
weekday: 'short',
|
||||
day: '2-digit',
|
||||
|
||||
Reference in New Issue
Block a user