@burdenoff/microfe-govcitizenhub 2026.730.1 → 2026.730.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/govcitizenhub/components/DocumentUploadField.d.ts.map +1 -1
  2. package/dist/govcitizenhub/components/DocumentUploadField.js.map +1 -1
  3. package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.d.ts.map +1 -1
  4. package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.js.map +1 -1
  5. package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.d.ts.map +1 -1
  6. package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.js.map +1 -1
  7. package/dist/govcitizenhub/pages/intelligence/AssetMapPanel.d.ts.map +1 -1
  8. package/dist/govcitizenhub/pages/intelligence/AssetMapPanel.js.map +1 -1
  9. package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.d.ts.map +1 -1
  10. package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.js.map +1 -1
  11. package/dist/govcitizenhub/pages/intelligence/BudgetPage.d.ts.map +1 -1
  12. package/dist/govcitizenhub/pages/intelligence/BudgetPage.js.map +1 -1
  13. package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.d.ts.map +1 -1
  14. package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.js.map +1 -1
  15. package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.d.ts.map +1 -1
  16. package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.js.map +1 -1
  17. package/dist/govcitizenhub/pages/intelligence/ConsultationResultsPanel.d.ts.map +1 -1
  18. package/dist/govcitizenhub/pages/intelligence/ConsultationResultsPanel.js.map +1 -1
  19. package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.d.ts.map +1 -1
  20. package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.js.map +1 -1
  21. package/dist/govcitizenhub/pages/intelligence/CorrectionsPage.js.map +1 -1
  22. package/dist/govcitizenhub/pages/intelligence/IndicatorCatalogPage.js.map +1 -1
  23. package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.d.ts.map +1 -1
  24. package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.js.map +1 -1
  25. package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.d.ts.map +1 -1
  26. package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.js.map +1 -1
  27. package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.d.ts.map +1 -1
  28. package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.js.map +1 -1
  29. package/dist/govcitizenhub/pages/intelligence/OpenDataPage.d.ts.map +1 -1
  30. package/dist/govcitizenhub/pages/intelligence/OpenDataPage.js +2 -1
  31. package/dist/govcitizenhub/pages/intelligence/OpenDataPage.js.map +1 -1
  32. package/dist/govcitizenhub/pages/intelligence/ProjectsPage.js.map +1 -1
  33. package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.d.ts.map +1 -1
  34. package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.js.map +1 -1
  35. package/dist/govcitizenhub/pages/intelligence/ServicePerformancePage.js.map +1 -1
  36. package/dist/govcitizenhub/pages/intelligence/consultationQuestions.d.ts.map +1 -1
  37. package/dist/govcitizenhub/pages/intelligence/consultationQuestions.js.map +1 -1
  38. package/dist/govcitizenhub/types/intelligence.d.ts.map +1 -1
  39. package/dist/govcitizenhub/types/intelligence.js.map +1 -1
  40. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ConsultationsPage.js","names":[],"sources":["../../../../src/govcitizenhub/pages/intelligence/ConsultationsPage.tsx"],"sourcesContent":["/**\n * ConsultationsPage — public participation for one jurisdiction.\n * @module govcitizenhub/pages/intelligence\n *\n * Route: `/govcitizenhub/intelligence/:jurisdictionId/consultations`.\n *\n * Reads `govConsultations` (type / status / open-now filters, cursor\n * paginated). Every card carries only server-supplied facts: the dates the\n * author published, the service-computed `isAcceptingResponses` and\n * `hasRespondedByMe`, and the transactional `responseCount` — never a tally\n * derived from the loaded page, and never a placeholder figure.\n *\n * Participation runs through `ConsultationParticipateDialog`, which renders the\n * consultation's own `questions` schema. After submitting, the respondent's own\n * answers are shown from `govMyConsultationResponse` (self-scoped — an anonymous\n * submission is deliberately not retrievable, and the panel says so).\n *\n * Results come from `govConsultationResults` via `ConsultationResultsPanel`,\n * which treats suppression as a state to explain rather than an empty chart.\n *\n * Cache: the shared mutation hooks invalidate the consultation list, the\n * consultation, its results and the caller's own response, and `govQuery` clears\n * the 15s response cache around every write.\n */\n\nimport { useMemo, useState, type ReactElement } from 'react';\nimport { useParams } from 'react-router-dom';\nimport {\n BarChart3,\n CalendarClock,\n CheckCircle2,\n ChevronDown,\n ChevronUp,\n Coins,\n ListFilter,\n Lock,\n MessageSquareQuote,\n MoreVertical,\n Pencil,\n Plus,\n Send,\n Trash2,\n Unlock,\n Upload,\n Users,\n} from 'lucide-react';\nimport {\n Button,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n GlassCard,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n Switch,\n} from '@burdenoff/fe-libs/ui';\n\nimport { SectionCard } from '../../components/SectionCard';\nimport { EmptyState } from '../../components/EmptyState';\nimport { ErrorView, LoadingView } from '../../components/StateViews';\nimport { FilterTabs, type FilterOption } from '../../components/FilterTabs';\nimport { Pagination } from '../../components/Pagination';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport { ConfirmDialog } from '../../components/ConfirmDialog';\nimport { JurisdictionLayout } from './JurisdictionLayout';\nimport { ConsultationFormDialog } from './ConsultationFormDialog';\nimport { ConsultationParticipateDialog } from './ConsultationParticipateDialog';\nimport { ConsultationResultsPanel } from './ConsultationResultsPanel';\nimport {\n describeAnswerValue,\n parseConsultationAnswers,\n parseConsultationQuestions,\n readAllocation,\n QUESTION_TYPE_LABELS,\n} from './consultationQuestions';\nimport {\n useCursorPager,\n useGovCloseConsultation,\n useGovConsultations,\n useGovDeleteConsultation,\n useGovMyConsultationResponse,\n useGovOpenConsultation,\n useGovPublishConsultationResults,\n} from '../../hooks';\nimport { describeError, notify } from '../../lib/toast';\nimport {\n formatCurrency,\n formatDateTime,\n formatEnumLabel,\n formatNumber,\n formatRelativeTime,\n} from '../../utils/formatters';\nimport { cn } from '../../utils/cn';\nimport type {\n GovConsultation,\n GovConsultationFilterInput,\n GovConsultationStatus,\n GovConsultationType,\n} from '../../types';\n\nconst PAGE_SIZE = 10;\n\n/** Below this many hours left, the closing countdown is flagged as urgent. */\nconst URGENT_HOURS = 48;\n\ntype StatusFilter = 'ALL' | GovConsultationStatus;\ntype TypeFilter = 'ALL' | GovConsultationType;\n\nconst STATUS_OPTIONS: FilterOption<StatusFilter>[] = [\n { value: 'ALL', label: 'All' },\n { value: 'DRAFT', label: 'Draft' },\n { value: 'OPEN', label: 'Open' },\n { value: 'CLOSED', label: 'Closed' },\n { value: 'PUBLISHED', label: 'Published' },\n { value: 'CANCELLED', label: 'Cancelled' },\n];\n\nconst CONSULTATION_TYPES: readonly GovConsultationType[] = [\n 'SURVEY',\n 'POLL',\n 'PARTICIPATORY_BUDGET',\n 'PUBLIC_HEARING',\n 'FEEDBACK',\n];\n\n/** Which detail panel a card currently has expanded. */\ntype ExpandedPanel = 'none' | 'response' | 'results';\n\nexport function ConsultationsPage(): ReactElement {\n const { jurisdictionId } = useParams<{ jurisdictionId: string }>();\n const pager = useCursorPager();\n\n const [status, setStatus] = useState<StatusFilter>('ALL');\n const [type, setType] = useState<TypeFilter>('ALL');\n const [openOnly, setOpenOnly] = useState(false);\n\n const [formOpen, setFormOpen] = useState(false);\n const [editing, setEditing] = useState<GovConsultation | null>(null);\n const [participating, setParticipating] = useState<GovConsultation | null>(null);\n const [pendingDelete, setPendingDelete] = useState<GovConsultation | null>(null);\n /**\n * Which detail panel each card has open, keyed by consultation id. Lifted out\n * of the card so a fresh submission can reveal the respondent's own answers\n * straight away without a state-syncing effect.\n */\n const [expandedPanels, setExpandedPanels] = useState<Record<string, ExpandedPanel>>({});\n\n const togglePanel = (consultationId: string, panel: ExpandedPanel): void => {\n setExpandedPanels((current) => ({\n ...current,\n [consultationId]: current[consultationId] === panel ? 'none' : panel,\n }));\n };\n\n const openConsultation = useGovOpenConsultation();\n const closeConsultation = useGovCloseConsultation();\n const publishResults = useGovPublishConsultationResults();\n const deleteConsultation = useGovDeleteConsultation();\n\n const filter = useMemo<GovConsultationFilterInput>(\n () => ({\n jurisdictionId,\n consultationType: type === 'ALL' ? undefined : type,\n status: openOnly || status === 'ALL' ? undefined : status,\n openOnly: openOnly ? true : undefined,\n }),\n [jurisdictionId, type, status, openOnly]\n );\n\n const { data, isLoading, isError, refetch } = useGovConsultations(filter, {\n limit: PAGE_SIZE,\n cursor: pager.cursor,\n });\n\n const consultations = useMemo(() => data?.items ?? [], [data]);\n const filtersApplied = status !== 'ALL' || type !== 'ALL' || openOnly;\n\n const clearFilters = (): void => {\n setStatus('ALL');\n setType('ALL');\n setOpenOnly(false);\n pager.reset();\n };\n\n const openCreate = (): void => {\n setEditing(null);\n setFormOpen(true);\n };\n\n const runLifecycle = async (\n action: () => Promise<unknown>,\n successTitle: string,\n successBody: string,\n failureTitle: string\n ): Promise<void> => {\n try {\n await action();\n notify.success(successTitle, successBody);\n } catch (err) {\n notify.error(failureTitle, describeError(err));\n }\n };\n\n const confirmDelete = async (): Promise<void> => {\n if (!pendingDelete) return;\n try {\n await deleteConsultation.mutateAsync(pendingDelete.id);\n notify.success('Consultation deleted', `${pendingDelete.title} was removed.`);\n setPendingDelete(null);\n } catch (err) {\n notify.error('Could not delete the consultation', describeError(err));\n }\n };\n\n const lifecycleBusy =\n openConsultation.isPending || closeConsultation.isPending || publishResults.isPending;\n\n return (\n <JurisdictionLayout\n actions={\n <Button onClick={openCreate}>\n <Plus className=\"mr-1.5 h-4 w-4\" aria-hidden=\"true\" /> New consultation\n </Button>\n }\n >\n <div className=\"flex flex-col gap-6\">\n <SectionCard title=\"Filter consultations\" icon={<ListFilter />}>\n <div className=\"flex flex-col gap-4\">\n {openOnly ? (\n <p className=\"text-sm text-text-muted\">\n Showing only consultations that are accepting responses right now, so the status\n filter does not apply.\n </p>\n ) : (\n <div className=\"overflow-x-auto pb-1\">\n <FilterTabs\n options={STATUS_OPTIONS}\n value={status}\n onChange={(next) => {\n setStatus(next);\n pager.reset();\n }}\n />\n </div>\n )}\n\n <div className=\"flex flex-wrap items-end gap-4\">\n <div className=\"grid min-w-[14rem] flex-1 gap-1.5\">\n <span className=\"text-xs font-medium text-text-muted\">Type</span>\n <Select\n value={type}\n onValueChange={(value) => {\n setType(value as TypeFilter);\n pager.reset();\n }}\n >\n <SelectTrigger aria-label=\"Filter by consultation type\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"ALL\">Any type</SelectItem>\n {CONSULTATION_TYPES.map((entry) => (\n <SelectItem key={entry} value={entry}>\n {formatEnumLabel(entry)}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n\n <div className=\"flex items-center gap-2.5 pb-1.5\">\n <Switch\n id=\"consultations-open-only\"\n checked={openOnly}\n onCheckedChange={(next) => {\n setOpenOnly(next === true);\n pager.reset();\n }}\n />\n <label\n htmlFor=\"consultations-open-only\"\n className=\"cursor-pointer text-sm text-text-secondary\"\n >\n Accepting responses right now\n </label>\n </div>\n\n {filtersApplied && (\n <Button variant=\"ghost\" size=\"sm\" className=\"pb-1.5\" onClick={clearFilters}>\n Clear filters\n </Button>\n )}\n </div>\n </div>\n </SectionCard>\n\n {isLoading ? (\n <LoadingView label=\"Loading consultations…\" />\n ) : isError ? (\n <ErrorView\n message=\"We couldn't load consultations for this jurisdiction.\"\n onRetry={() => {\n void refetch();\n }}\n />\n ) : consultations.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n title={\n filtersApplied ? 'No consultations match these filters' : 'No consultations published yet'\n }\n description={\n filtersApplied\n ? 'Nothing matches the current filters. Try widening them.'\n : 'Run a survey, a poll, a public hearing or a participatory budget so residents can shape decisions here.'\n }\n action={\n filtersApplied ? (\n <Button variant=\"outline\" onClick={clearFilters}>\n Clear filters\n </Button>\n ) : (\n <Button onClick={openCreate}>\n <Plus className=\"mr-1.5 h-4 w-4\" aria-hidden=\"true\" /> New consultation\n </Button>\n )\n }\n />\n ) : (\n <>\n <div className=\"flex flex-col gap-4\">\n {consultations.map((consultation) => (\n <ConsultationCard\n key={consultation.id}\n consultation={consultation}\n lifecycleBusy={lifecycleBusy}\n expanded={expandedPanels[consultation.id] ?? 'none'}\n onTogglePanel={(panel) => togglePanel(consultation.id, panel)}\n onParticipate={() => setParticipating(consultation)}\n onEdit={() => {\n setEditing(consultation);\n setFormOpen(true);\n }}\n onDelete={() => setPendingDelete(consultation)}\n onOpen={() =>\n void runLifecycle(\n () => openConsultation.mutateAsync(consultation.id),\n 'Consultation opened',\n `${consultation.title} is now accepting responses.`,\n 'Could not open the consultation'\n )\n }\n onClose={() =>\n void runLifecycle(\n () => closeConsultation.mutateAsync(consultation.id),\n 'Consultation closed',\n `${consultation.title} no longer accepts responses.`,\n 'Could not close the consultation'\n )\n }\n onPublishResults={() =>\n void runLifecycle(\n () => publishResults.mutateAsync(consultation.id),\n 'Results published',\n `The aggregate for ${consultation.title} is now public.`,\n 'Could not publish the results'\n )\n }\n />\n ))}\n </div>\n <Pagination\n page={pager.page}\n pageSize={PAGE_SIZE}\n itemCount={consultations.length}\n hasMore={data?.pageInfo.hasMore ?? false}\n onPageChange={(target) => pager.onPageChange(target, data?.pageInfo.cursor)}\n />\n </>\n )}\n </div>\n\n {formOpen && jurisdictionId && (\n <ConsultationFormDialog\n jurisdictionId={jurisdictionId}\n consultation={editing}\n onClose={() => {\n setFormOpen(false);\n setEditing(null);\n }}\n />\n )}\n\n {participating && (\n <ConsultationParticipateDialog\n consultation={participating}\n onSubmitted={() =>\n setExpandedPanels((current) => ({ ...current, [participating.id]: 'response' }))\n }\n onClose={() => setParticipating(null)}\n />\n )}\n\n <ConfirmDialog\n open={pendingDelete !== null}\n onOpenChange={(next) => {\n if (!next) setPendingDelete(null);\n }}\n title=\"Delete this consultation?\"\n description={\n pendingDelete\n ? `${pendingDelete.title} and the responses recorded against it will no longer be readable.`\n : undefined\n }\n confirmLabel=\"Delete consultation\"\n destructive\n onConfirm={confirmDelete}\n />\n </JurisdictionLayout>\n );\n}\n\ninterface ConsultationCardProps {\n consultation: GovConsultation;\n lifecycleBusy: boolean;\n /** Which detail panel this card currently shows. Owned by the page. */\n expanded: ExpandedPanel;\n onTogglePanel: (panel: ExpandedPanel) => void;\n onParticipate: () => void;\n onEdit: () => void;\n onDelete: () => void;\n onOpen: () => void;\n onClose: () => void;\n onPublishResults: () => void;\n}\n\nfunction ConsultationCard({\n consultation,\n lifecycleBusy,\n expanded,\n onTogglePanel,\n onParticipate,\n onEdit,\n onDelete,\n onOpen,\n onClose,\n onPublishResults,\n}: ConsultationCardProps): ReactElement {\n const questionCount = useMemo(\n () => parseConsultationQuestions(consultation.questions).length,\n [consultation.questions]\n );\n\n // Render-stable clock: the countdown is relative to when the card mounted, so\n // rendering stays pure (no `Date.now()` read in the render body).\n const [nowMs] = useState(() => Date.now());\n\n const countdown = useMemo(() => {\n if (!consultation.closesAt || !consultation.isAcceptingResponses) return null;\n const closesAtMs = new Date(consultation.closesAt).getTime();\n if (Number.isNaN(closesAtMs)) return null;\n const remainingMs = closesAtMs - nowMs;\n if (remainingMs <= 0) return null;\n return {\n label: `Closes ${formatRelativeTime(consultation.closesAt)}`,\n urgent: remainingMs <= URGENT_HOURS * 3_600_000,\n };\n }, [consultation.closesAt, consultation.isAcceptingResponses, nowMs]);\n\n const canParticipate = consultation.isAcceptingResponses && !consultation.hasRespondedByMe;\n\n return (\n <GlassCard treatment=\"plain\" className=\"border-border-seam p-5\">\n <div className=\"flex flex-wrap items-start gap-3\">\n <div className=\"min-w-0 flex-1\">\n <h3 className=\"text-base font-semibold text-text-primary\">{consultation.title}</h3>\n {consultation.description && (\n <p className=\"mt-1 line-clamp-3 text-sm text-text-secondary\">\n {consultation.description}\n </p>\n )}\n </div>\n <div className=\"flex shrink-0 items-center gap-2\">\n <StatusBadge status={consultation.status} />\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button variant=\"ghost\" size=\"sm\" aria-label={`Actions for ${consultation.title}`}>\n <MoreVertical className=\"size-4\" aria-hidden=\"true\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n <DropdownMenuItem onSelect={onEdit}>\n <Pencil className=\"mr-2 size-4\" aria-hidden=\"true\" /> Edit consultation\n </DropdownMenuItem>\n {consultation.status === 'DRAFT' && (\n <DropdownMenuItem disabled={lifecycleBusy} onSelect={onOpen}>\n <Unlock className=\"mr-2 size-4\" aria-hidden=\"true\" /> Open for responses\n </DropdownMenuItem>\n )}\n {consultation.status === 'OPEN' && (\n <DropdownMenuItem disabled={lifecycleBusy} onSelect={onClose}>\n <Lock className=\"mr-2 size-4\" aria-hidden=\"true\" /> Close consultation\n </DropdownMenuItem>\n )}\n {consultation.status === 'CLOSED' && (\n <DropdownMenuItem disabled={lifecycleBusy} onSelect={onPublishResults}>\n <Upload className=\"mr-2 size-4\" aria-hidden=\"true\" /> Publish results\n </DropdownMenuItem>\n )}\n <DropdownMenuSeparator />\n <DropdownMenuItem onSelect={onDelete}>\n <Trash2 className=\"mr-2 size-4\" aria-hidden=\"true\" /> Delete consultation\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n </div>\n\n <div className=\"mt-3 flex flex-wrap items-center gap-2\">\n <span className=\"rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs font-medium text-text-secondary\">\n {formatEnumLabel(consultation.consultationType)}\n </span>\n <span className=\"rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs font-medium text-text-secondary\">\n {formatNumber(questionCount)} question{questionCount === 1 ? '' : 's'}\n </span>\n {consultation.allowAnonymous && (\n <span className=\"rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs font-medium text-text-secondary\">\n Anonymous allowed\n </span>\n )}\n {consultation.budgetAmount != null && (\n <span className=\"inline-flex items-center gap-1.5 rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs font-medium text-text-secondary\">\n <Coins className=\"size-3.5\" aria-hidden=\"true\" />\n {formatCurrency(consultation.budgetAmount, consultation.currencyCode)} pot\n </span>\n )}\n {consultation.tags.map((tag) => (\n <span\n key={tag}\n className=\"rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-text-secondary\"\n >\n {tag}\n </span>\n ))}\n </div>\n\n <dl className=\"mt-4 grid gap-3 sm:grid-cols-3\">\n <div>\n <dt className=\"text-xs text-text-muted\">Opens</dt>\n <dd className=\"text-sm text-text-secondary\">\n {consultation.opensAt ? formatDateTime(consultation.opensAt) : 'Not scheduled'}\n </dd>\n </div>\n <div>\n <dt className=\"text-xs text-text-muted\">Closes</dt>\n <dd className=\"text-sm text-text-secondary\">\n {consultation.closesAt ? formatDateTime(consultation.closesAt) : 'No closing date'}\n </dd>\n </div>\n <div>\n <dt className=\"text-xs text-text-muted\">Responses</dt>\n <dd className=\"inline-flex items-center gap-1.5 text-sm text-text-secondary tabular-nums\">\n <Users className=\"size-4 text-text-muted\" aria-hidden=\"true\" />\n {formatNumber(consultation.responseCount)}\n </dd>\n </div>\n </dl>\n\n {countdown && (\n <p\n className={cn(\n 'mt-3 inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium',\n countdown.urgent\n ? 'bg-status-warning-bg-subtle text-status-warning-text'\n : 'bg-status-success-bg-subtle text-status-success-text'\n )}\n >\n <CalendarClock className=\"size-3.5\" aria-hidden=\"true\" /> {countdown.label}\n </p>\n )}\n\n <div className=\"mt-4 flex flex-wrap items-center gap-2 border-t border-border-seam pt-4\">\n {canParticipate ? (\n <Button onClick={onParticipate}>\n <Send className=\"mr-1.5 h-4 w-4\" aria-hidden=\"true\" /> Participate\n </Button>\n ) : consultation.hasRespondedByMe ? (\n <span className=\"inline-flex items-center gap-1.5 rounded-full bg-status-success-bg-subtle px-3 py-1 text-sm font-medium text-status-success-text\">\n <CheckCircle2 className=\"size-4\" aria-hidden=\"true\" /> You have responded\n </span>\n ) : (\n <span className=\"text-sm text-text-muted\">\n {consultation.status === 'DRAFT'\n ? 'Not open for responses yet.'\n : 'This consultation is not accepting responses.'}\n </span>\n )}\n\n {consultation.hasRespondedByMe && (\n <Button variant=\"outline\" onClick={() => onTogglePanel('response')}>\n <MessageSquareQuote className=\"mr-1.5 h-4 w-4\" aria-hidden=\"true\" />\n Your response\n {expanded === 'response' ? (\n <ChevronUp className=\"ml-1.5 h-4 w-4\" aria-hidden=\"true\" />\n ) : (\n <ChevronDown className=\"ml-1.5 h-4 w-4\" aria-hidden=\"true\" />\n )}\n </Button>\n )}\n\n <Button variant=\"outline\" onClick={() => onTogglePanel('results')}>\n <BarChart3 className=\"mr-1.5 h-4 w-4\" aria-hidden=\"true\" />\n Results\n {expanded === 'results' ? (\n <ChevronUp className=\"ml-1.5 h-4 w-4\" aria-hidden=\"true\" />\n ) : (\n <ChevronDown className=\"ml-1.5 h-4 w-4\" aria-hidden=\"true\" />\n )}\n </Button>\n </div>\n\n {expanded === 'response' && (\n <div className=\"mt-4 border-t border-border-seam pt-4\">\n <MyResponsePanel consultation={consultation} />\n </div>\n )}\n\n {expanded === 'results' && (\n <div className=\"mt-4 border-t border-border-seam pt-4\">\n <ConsultationResultsPanel consultation={consultation} />\n </div>\n )}\n </GlassCard>\n );\n}\n\n/** The calling actor's own submitted answers, read back from the self-scoped query. */\nfunction MyResponsePanel({ consultation }: { consultation: GovConsultation }): ReactElement {\n const { data, isLoading, isError, refetch } = useGovMyConsultationResponse(consultation.id);\n\n const questions = useMemo(\n () => parseConsultationQuestions(consultation.questions),\n [consultation.questions]\n );\n const answers = useMemo(() => parseConsultationAnswers(data?.answers ?? null), [data]);\n const answerById = useMemo(\n () => new Map(answers.map((answer) => [answer.questionId, answer.value])),\n [answers]\n );\n\n if (isLoading) {\n return <LoadingView label=\"Loading your response…\" className=\"min-h-[8rem]\" />;\n }\n\n if (isError) {\n return (\n <ErrorView\n className=\"min-h-[8rem]\"\n message=\"We couldn't load your response.\"\n onRetry={() => {\n void refetch();\n }}\n />\n );\n }\n\n if (!data) {\n return (\n <EmptyState\n icon={<MessageSquareQuote className=\"size-8\" aria-hidden=\"true\" />}\n title=\"No response linked to your account\"\n description=\"Anonymous submissions store no respondent id, so they cannot be shown back to you.\"\n />\n );\n }\n\n const answered = questions.filter((question) => answerById.has(question.id));\n\n return (\n <div className=\"flex flex-col gap-3\">\n <p className=\"text-sm text-text-muted\">\n Submitted {formatDateTime(data.submittedAt)}\n {data.sentiment ? ` · overall sentiment: ${formatEnumLabel(data.sentiment)}` : ''}\n </p>\n\n {answered.length === 0 ? (\n <p className=\"text-sm text-text-muted\">\n Your response recorded no answers against the current questions.\n </p>\n ) : (\n <dl className=\"flex flex-col gap-3\">\n {answered.map((question) => {\n const value = answerById.get(question.id);\n return (\n <div\n key={question.id}\n className=\"rounded-lg border border-border-seam bg-bg-sunken/40 p-3\"\n >\n <dt className=\"text-sm font-medium text-text-primary\">\n {question.label}\n <span className=\"ml-2 text-xs font-normal text-text-muted\">\n {QUESTION_TYPE_LABELS[question.type]}\n </span>\n </dt>\n <dd className=\"mt-1 text-sm text-text-secondary\">\n {question.type === 'BUDGET_ALLOCATION' ? (\n <ul className=\"flex flex-col gap-0.5\">\n {Object.entries(readAllocation(value)).map(([option, amount]) => (\n <li key={option} className=\"flex justify-between gap-4 tabular-nums\">\n <span>{option}</span>\n <span>{formatCurrency(amount, consultation.currencyCode)}</span>\n </li>\n ))}\n </ul>\n ) : (\n describeAnswerValue(question, value).join(', ') || '—'\n )}\n </dd>\n </div>\n );\n })}\n </dl>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyGA,IAAM,KAAY,IAGZ,KAAe,I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AD;EAAK,WAAU;YAAf,CACE,kBAAC,KAAD;GAAG,WAAU;aAAb;IAAuC;IAC1B,EAAe,EAAK,WAAW;IACzC,EAAK,YAAY,yBAAyB,EAAgB,EAAK,SAAS,MAAM;GAC9E;MAEF,EAAS,WAAW,IACnB,kBAAC,KAAD;GAAG,WAAU;aAA0B;EAEpC,CAAA,IAEH,kBAAC,MAAD;GAAI,WAAU;aACX,EAAS,KAAK,MAAa;IAC1B,IAAM,IAAQ,EAAW,IAAI,EAAS,EAAE;IACxC,OACE,kBAAC,OAAD;KAEE,WAAU;eAFZ,CAIE,kBAAC,MAAD;MAAI,WAAU;gBAAd,CACG,EAAS,OACV,kBAAC,QAAD;OAAM,WAAU;iBACb,EAAqB,EAAS;MAC3B,CAAA,CACJ;SACJ,kBAAC,MAAD;MAAI,WAAU;gBACX,EAAS,SAAS,sBACjB,kBAAC,MAAD;OAAI,WAAU;iBACX,OAAO,QAAQ,EAAe,CAAK,CAAC,EAAE,KAAK,CAAC,GAAQ,OACnD,kBAAC,MAAD;QAAiB,WAAU;kBAA3B,CACE,kBAAC,QAAD,EAAA,UAAO,EAAa,CAAA,GACpB,kBAAC,QAAD,EAAA,UAAO,EAAe,GAAQ,EAAa,YAAY,EAAQ,CAAA,CAC7D;UAHK,CAGL,CACL;MACC,CAAA,IAEJ,EAAoB,GAAU,CAAK,EAAE,KAAK,IAAI,KAAK;KAEnD,CAAA,CACD;OAvBE,EAAS,EAuBX;GAET,CAAC;EACC,CAAA,CAEH;;AAET"}
1
+ {"version":3,"file":"ConsultationsPage.js","names":[],"sources":["../../../../src/govcitizenhub/pages/intelligence/ConsultationsPage.tsx"],"sourcesContent":["/**\n * ConsultationsPage — public participation for one jurisdiction.\n * @module govcitizenhub/pages/intelligence\n *\n * Route: `/govcitizenhub/intelligence/:jurisdictionId/consultations`.\n *\n * Reads `govConsultations` (type / status / open-now filters, cursor\n * paginated). Every card carries only server-supplied facts: the dates the\n * author published, the service-computed `isAcceptingResponses` and\n * `hasRespondedByMe`, and the transactional `responseCount` — never a tally\n * derived from the loaded page, and never a placeholder figure.\n *\n * Participation runs through `ConsultationParticipateDialog`, which renders the\n * consultation's own `questions` schema. After submitting, the respondent's own\n * answers are shown from `govMyConsultationResponse` (self-scoped — an anonymous\n * submission is deliberately not retrievable, and the panel says so).\n *\n * Results come from `govConsultationResults` via `ConsultationResultsPanel`,\n * which treats suppression as a state to explain rather than an empty chart.\n *\n * Cache: the shared mutation hooks invalidate the consultation list, the\n * consultation, its results and the caller's own response, and `govQuery` clears\n * the 15s response cache around every write.\n */\n\nimport { useMemo, useState, type ReactElement } from 'react';\nimport { useParams } from 'react-router-dom';\nimport {\n BarChart3,\n CalendarClock,\n CheckCircle2,\n ChevronDown,\n ChevronUp,\n Coins,\n ListFilter,\n Lock,\n MessageSquareQuote,\n MoreVertical,\n Pencil,\n Plus,\n Send,\n Trash2,\n Unlock,\n Upload,\n Users,\n} from 'lucide-react';\nimport {\n Button,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n GlassCard,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n Switch,\n} from '@burdenoff/fe-libs/ui';\n\nimport { SectionCard } from '../../components/SectionCard';\nimport { EmptyState } from '../../components/EmptyState';\nimport { ErrorView, LoadingView } from '../../components/StateViews';\nimport { FilterTabs, type FilterOption } from '../../components/FilterTabs';\nimport { Pagination } from '../../components/Pagination';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport { ConfirmDialog } from '../../components/ConfirmDialog';\nimport { JurisdictionLayout } from './JurisdictionLayout';\nimport { ConsultationFormDialog } from './ConsultationFormDialog';\nimport { ConsultationParticipateDialog } from './ConsultationParticipateDialog';\nimport { ConsultationResultsPanel } from './ConsultationResultsPanel';\nimport {\n describeAnswerValue,\n parseConsultationAnswers,\n parseConsultationQuestions,\n readAllocation,\n QUESTION_TYPE_LABELS,\n} from './consultationQuestions';\nimport {\n useCursorPager,\n useGovCloseConsultation,\n useGovConsultations,\n useGovDeleteConsultation,\n useGovMyConsultationResponse,\n useGovOpenConsultation,\n useGovPublishConsultationResults,\n} from '../../hooks';\nimport { describeError, notify } from '../../lib/toast';\nimport {\n formatCurrency,\n formatDateTime,\n formatEnumLabel,\n formatNumber,\n formatRelativeTime,\n} from '../../utils/formatters';\nimport { cn } from '../../utils/cn';\nimport type {\n GovConsultation,\n GovConsultationFilterInput,\n GovConsultationStatus,\n GovConsultationType,\n} from '../../types';\n\nconst PAGE_SIZE = 10;\n\n/** Below this many hours left, the closing countdown is flagged as urgent. */\nconst URGENT_HOURS = 48;\n\ntype StatusFilter = 'ALL' | GovConsultationStatus;\ntype TypeFilter = 'ALL' | GovConsultationType;\n\nconst STATUS_OPTIONS: FilterOption<StatusFilter>[] = [\n { value: 'ALL', label: 'All' },\n { value: 'DRAFT', label: 'Draft' },\n { value: 'OPEN', label: 'Open' },\n { value: 'CLOSED', label: 'Closed' },\n { value: 'PUBLISHED', label: 'Published' },\n { value: 'CANCELLED', label: 'Cancelled' },\n];\n\nconst CONSULTATION_TYPES: readonly GovConsultationType[] = [\n 'SURVEY',\n 'POLL',\n 'PARTICIPATORY_BUDGET',\n 'PUBLIC_HEARING',\n 'FEEDBACK',\n];\n\n/** Which detail panel a card currently has expanded. */\ntype ExpandedPanel = 'none' | 'response' | 'results';\n\nexport function ConsultationsPage(): ReactElement {\n const { jurisdictionId } = useParams<{ jurisdictionId: string }>();\n const pager = useCursorPager();\n\n const [status, setStatus] = useState<StatusFilter>('ALL');\n const [type, setType] = useState<TypeFilter>('ALL');\n const [openOnly, setOpenOnly] = useState(false);\n\n const [formOpen, setFormOpen] = useState(false);\n const [editing, setEditing] = useState<GovConsultation | null>(null);\n const [participating, setParticipating] = useState<GovConsultation | null>(null);\n const [pendingDelete, setPendingDelete] = useState<GovConsultation | null>(null);\n /**\n * Which detail panel each card has open, keyed by consultation id. Lifted out\n * of the card so a fresh submission can reveal the respondent's own answers\n * straight away without a state-syncing effect.\n */\n const [expandedPanels, setExpandedPanels] = useState<Record<string, ExpandedPanel>>({});\n\n const togglePanel = (consultationId: string, panel: ExpandedPanel): void => {\n setExpandedPanels((current) => ({\n ...current,\n [consultationId]: current[consultationId] === panel ? 'none' : panel,\n }));\n };\n\n const openConsultation = useGovOpenConsultation();\n const closeConsultation = useGovCloseConsultation();\n const publishResults = useGovPublishConsultationResults();\n const deleteConsultation = useGovDeleteConsultation();\n\n const filter = useMemo<GovConsultationFilterInput>(\n () => ({\n jurisdictionId,\n consultationType: type === 'ALL' ? undefined : type,\n status: openOnly || status === 'ALL' ? undefined : status,\n openOnly: openOnly ? true : undefined,\n }),\n [jurisdictionId, type, status, openOnly]\n );\n\n const { data, isLoading, isError, refetch } = useGovConsultations(filter, {\n limit: PAGE_SIZE,\n cursor: pager.cursor,\n });\n\n const consultations = useMemo(() => data?.items ?? [], [data]);\n const filtersApplied = status !== 'ALL' || type !== 'ALL' || openOnly;\n\n const clearFilters = (): void => {\n setStatus('ALL');\n setType('ALL');\n setOpenOnly(false);\n pager.reset();\n };\n\n const openCreate = (): void => {\n setEditing(null);\n setFormOpen(true);\n };\n\n const runLifecycle = async (\n action: () => Promise<unknown>,\n successTitle: string,\n successBody: string,\n failureTitle: string\n ): Promise<void> => {\n try {\n await action();\n notify.success(successTitle, successBody);\n } catch (err) {\n notify.error(failureTitle, describeError(err));\n }\n };\n\n const confirmDelete = async (): Promise<void> => {\n if (!pendingDelete) return;\n try {\n await deleteConsultation.mutateAsync(pendingDelete.id);\n notify.success('Consultation deleted', `${pendingDelete.title} was removed.`);\n setPendingDelete(null);\n } catch (err) {\n notify.error('Could not delete the consultation', describeError(err));\n }\n };\n\n const lifecycleBusy =\n openConsultation.isPending || closeConsultation.isPending || publishResults.isPending;\n\n return (\n <JurisdictionLayout\n actions={\n <Button onClick={openCreate}>\n <Plus className=\"mr-1.5 h-4 w-4\" aria-hidden=\"true\" /> New consultation\n </Button>\n }\n >\n <div className=\"flex flex-col gap-6\">\n <SectionCard title=\"Filter consultations\" icon={<ListFilter />}>\n <div className=\"flex flex-col gap-4\">\n {openOnly ? (\n <p className=\"text-sm text-text-muted\">\n Showing only consultations that are accepting responses right now, so the status\n filter does not apply.\n </p>\n ) : (\n <div className=\"overflow-x-auto pb-1\">\n <FilterTabs\n options={STATUS_OPTIONS}\n value={status}\n onChange={(next) => {\n setStatus(next);\n pager.reset();\n }}\n />\n </div>\n )}\n\n <div className=\"flex flex-wrap items-end gap-4\">\n <div className=\"grid min-w-[14rem] flex-1 gap-1.5\">\n <span className=\"text-xs font-medium text-text-muted\">Type</span>\n <Select\n value={type}\n onValueChange={(value) => {\n setType(value as TypeFilter);\n pager.reset();\n }}\n >\n <SelectTrigger aria-label=\"Filter by consultation type\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"ALL\">Any type</SelectItem>\n {CONSULTATION_TYPES.map((entry) => (\n <SelectItem key={entry} value={entry}>\n {formatEnumLabel(entry)}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n\n <div className=\"flex items-center gap-2.5 pb-1.5\">\n <Switch\n id=\"consultations-open-only\"\n checked={openOnly}\n onCheckedChange={(next) => {\n setOpenOnly(next === true);\n pager.reset();\n }}\n />\n <label\n htmlFor=\"consultations-open-only\"\n className=\"cursor-pointer text-sm text-text-secondary\"\n >\n Accepting responses right now\n </label>\n </div>\n\n {filtersApplied && (\n <Button variant=\"ghost\" size=\"sm\" className=\"pb-1.5\" onClick={clearFilters}>\n Clear filters\n </Button>\n )}\n </div>\n </div>\n </SectionCard>\n\n {isLoading ? (\n <LoadingView label=\"Loading consultations…\" />\n ) : isError ? (\n <ErrorView\n message=\"We couldn't load consultations for this jurisdiction.\"\n onRetry={() => {\n void refetch();\n }}\n />\n ) : consultations.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n title={\n filtersApplied\n ? 'No consultations match these filters'\n : 'No consultations published yet'\n }\n description={\n filtersApplied\n ? 'Nothing matches the current filters. Try widening them.'\n : 'Run a survey, a poll, a public hearing or a participatory budget so residents can shape decisions here.'\n }\n action={\n filtersApplied ? (\n <Button variant=\"outline\" onClick={clearFilters}>\n Clear filters\n </Button>\n ) : (\n <Button onClick={openCreate}>\n <Plus className=\"mr-1.5 h-4 w-4\" aria-hidden=\"true\" /> New consultation\n </Button>\n )\n }\n />\n ) : (\n <>\n <div className=\"flex flex-col gap-4\">\n {consultations.map((consultation) => (\n <ConsultationCard\n key={consultation.id}\n consultation={consultation}\n lifecycleBusy={lifecycleBusy}\n expanded={expandedPanels[consultation.id] ?? 'none'}\n onTogglePanel={(panel) => togglePanel(consultation.id, panel)}\n onParticipate={() => setParticipating(consultation)}\n onEdit={() => {\n setEditing(consultation);\n setFormOpen(true);\n }}\n onDelete={() => setPendingDelete(consultation)}\n onOpen={() =>\n void runLifecycle(\n () => openConsultation.mutateAsync(consultation.id),\n 'Consultation opened',\n `${consultation.title} is now accepting responses.`,\n 'Could not open the consultation'\n )\n }\n onClose={() =>\n void runLifecycle(\n () => closeConsultation.mutateAsync(consultation.id),\n 'Consultation closed',\n `${consultation.title} no longer accepts responses.`,\n 'Could not close the consultation'\n )\n }\n onPublishResults={() =>\n void runLifecycle(\n () => publishResults.mutateAsync(consultation.id),\n 'Results published',\n `The aggregate for ${consultation.title} is now public.`,\n 'Could not publish the results'\n )\n }\n />\n ))}\n </div>\n <Pagination\n page={pager.page}\n pageSize={PAGE_SIZE}\n itemCount={consultations.length}\n hasMore={data?.pageInfo.hasMore ?? false}\n onPageChange={(target) => pager.onPageChange(target, data?.pageInfo.cursor)}\n />\n </>\n )}\n </div>\n\n {formOpen && jurisdictionId && (\n <ConsultationFormDialog\n jurisdictionId={jurisdictionId}\n consultation={editing}\n onClose={() => {\n setFormOpen(false);\n setEditing(null);\n }}\n />\n )}\n\n {participating && (\n <ConsultationParticipateDialog\n consultation={participating}\n onSubmitted={() =>\n setExpandedPanels((current) => ({ ...current, [participating.id]: 'response' }))\n }\n onClose={() => setParticipating(null)}\n />\n )}\n\n <ConfirmDialog\n open={pendingDelete !== null}\n onOpenChange={(next) => {\n if (!next) setPendingDelete(null);\n }}\n title=\"Delete this consultation?\"\n description={\n pendingDelete\n ? `${pendingDelete.title} and the responses recorded against it will no longer be readable.`\n : undefined\n }\n confirmLabel=\"Delete consultation\"\n destructive\n onConfirm={confirmDelete}\n />\n </JurisdictionLayout>\n );\n}\n\ninterface ConsultationCardProps {\n consultation: GovConsultation;\n lifecycleBusy: boolean;\n /** Which detail panel this card currently shows. Owned by the page. */\n expanded: ExpandedPanel;\n onTogglePanel: (panel: ExpandedPanel) => void;\n onParticipate: () => void;\n onEdit: () => void;\n onDelete: () => void;\n onOpen: () => void;\n onClose: () => void;\n onPublishResults: () => void;\n}\n\nfunction ConsultationCard({\n consultation,\n lifecycleBusy,\n expanded,\n onTogglePanel,\n onParticipate,\n onEdit,\n onDelete,\n onOpen,\n onClose,\n onPublishResults,\n}: ConsultationCardProps): ReactElement {\n const questionCount = useMemo(\n () => parseConsultationQuestions(consultation.questions).length,\n [consultation.questions]\n );\n\n // Render-stable clock: the countdown is relative to when the card mounted, so\n // rendering stays pure (no `Date.now()` read in the render body).\n const [nowMs] = useState(() => Date.now());\n\n const countdown = useMemo(() => {\n if (!consultation.closesAt || !consultation.isAcceptingResponses) return null;\n const closesAtMs = new Date(consultation.closesAt).getTime();\n if (Number.isNaN(closesAtMs)) return null;\n const remainingMs = closesAtMs - nowMs;\n if (remainingMs <= 0) return null;\n return {\n label: `Closes ${formatRelativeTime(consultation.closesAt)}`,\n urgent: remainingMs <= URGENT_HOURS * 3_600_000,\n };\n }, [consultation.closesAt, consultation.isAcceptingResponses, nowMs]);\n\n const canParticipate = consultation.isAcceptingResponses && !consultation.hasRespondedByMe;\n\n return (\n <GlassCard treatment=\"plain\" className=\"border-border-seam p-5\">\n <div className=\"flex flex-wrap items-start gap-3\">\n <div className=\"min-w-0 flex-1\">\n <h3 className=\"text-base font-semibold text-text-primary\">{consultation.title}</h3>\n {consultation.description && (\n <p className=\"mt-1 line-clamp-3 text-sm text-text-secondary\">\n {consultation.description}\n </p>\n )}\n </div>\n <div className=\"flex shrink-0 items-center gap-2\">\n <StatusBadge status={consultation.status} />\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button variant=\"ghost\" size=\"sm\" aria-label={`Actions for ${consultation.title}`}>\n <MoreVertical className=\"size-4\" aria-hidden=\"true\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n <DropdownMenuItem onSelect={onEdit}>\n <Pencil className=\"mr-2 size-4\" aria-hidden=\"true\" /> Edit consultation\n </DropdownMenuItem>\n {consultation.status === 'DRAFT' && (\n <DropdownMenuItem disabled={lifecycleBusy} onSelect={onOpen}>\n <Unlock className=\"mr-2 size-4\" aria-hidden=\"true\" /> Open for responses\n </DropdownMenuItem>\n )}\n {consultation.status === 'OPEN' && (\n <DropdownMenuItem disabled={lifecycleBusy} onSelect={onClose}>\n <Lock className=\"mr-2 size-4\" aria-hidden=\"true\" /> Close consultation\n </DropdownMenuItem>\n )}\n {consultation.status === 'CLOSED' && (\n <DropdownMenuItem disabled={lifecycleBusy} onSelect={onPublishResults}>\n <Upload className=\"mr-2 size-4\" aria-hidden=\"true\" /> Publish results\n </DropdownMenuItem>\n )}\n <DropdownMenuSeparator />\n <DropdownMenuItem onSelect={onDelete}>\n <Trash2 className=\"mr-2 size-4\" aria-hidden=\"true\" /> Delete consultation\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n </div>\n\n <div className=\"mt-3 flex flex-wrap items-center gap-2\">\n <span className=\"rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs font-medium text-text-secondary\">\n {formatEnumLabel(consultation.consultationType)}\n </span>\n <span className=\"rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs font-medium text-text-secondary\">\n {formatNumber(questionCount)} question{questionCount === 1 ? '' : 's'}\n </span>\n {consultation.allowAnonymous && (\n <span className=\"rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs font-medium text-text-secondary\">\n Anonymous allowed\n </span>\n )}\n {consultation.budgetAmount != null && (\n <span className=\"inline-flex items-center gap-1.5 rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs font-medium text-text-secondary\">\n <Coins className=\"size-3.5\" aria-hidden=\"true\" />\n {formatCurrency(consultation.budgetAmount, consultation.currencyCode)} pot\n </span>\n )}\n {consultation.tags.map((tag) => (\n <span\n key={tag}\n className=\"rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-text-secondary\"\n >\n {tag}\n </span>\n ))}\n </div>\n\n <dl className=\"mt-4 grid gap-3 sm:grid-cols-3\">\n <div>\n <dt className=\"text-xs text-text-muted\">Opens</dt>\n <dd className=\"text-sm text-text-secondary\">\n {consultation.opensAt ? formatDateTime(consultation.opensAt) : 'Not scheduled'}\n </dd>\n </div>\n <div>\n <dt className=\"text-xs text-text-muted\">Closes</dt>\n <dd className=\"text-sm text-text-secondary\">\n {consultation.closesAt ? formatDateTime(consultation.closesAt) : 'No closing date'}\n </dd>\n </div>\n <div>\n <dt className=\"text-xs text-text-muted\">Responses</dt>\n <dd className=\"inline-flex items-center gap-1.5 text-sm text-text-secondary tabular-nums\">\n <Users className=\"size-4 text-text-muted\" aria-hidden=\"true\" />\n {formatNumber(consultation.responseCount)}\n </dd>\n </div>\n </dl>\n\n {countdown && (\n <p\n className={cn(\n 'mt-3 inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium',\n countdown.urgent\n ? 'bg-status-warning-bg-subtle text-status-warning-text'\n : 'bg-status-success-bg-subtle text-status-success-text'\n )}\n >\n <CalendarClock className=\"size-3.5\" aria-hidden=\"true\" /> {countdown.label}\n </p>\n )}\n\n <div className=\"mt-4 flex flex-wrap items-center gap-2 border-t border-border-seam pt-4\">\n {canParticipate ? (\n <Button onClick={onParticipate}>\n <Send className=\"mr-1.5 h-4 w-4\" aria-hidden=\"true\" /> Participate\n </Button>\n ) : consultation.hasRespondedByMe ? (\n <span className=\"inline-flex items-center gap-1.5 rounded-full bg-status-success-bg-subtle px-3 py-1 text-sm font-medium text-status-success-text\">\n <CheckCircle2 className=\"size-4\" aria-hidden=\"true\" /> You have responded\n </span>\n ) : (\n <span className=\"text-sm text-text-muted\">\n {consultation.status === 'DRAFT'\n ? 'Not open for responses yet.'\n : 'This consultation is not accepting responses.'}\n </span>\n )}\n\n {consultation.hasRespondedByMe && (\n <Button variant=\"outline\" onClick={() => onTogglePanel('response')}>\n <MessageSquareQuote className=\"mr-1.5 h-4 w-4\" aria-hidden=\"true\" />\n Your response\n {expanded === 'response' ? (\n <ChevronUp className=\"ml-1.5 h-4 w-4\" aria-hidden=\"true\" />\n ) : (\n <ChevronDown className=\"ml-1.5 h-4 w-4\" aria-hidden=\"true\" />\n )}\n </Button>\n )}\n\n <Button variant=\"outline\" onClick={() => onTogglePanel('results')}>\n <BarChart3 className=\"mr-1.5 h-4 w-4\" aria-hidden=\"true\" />\n Results\n {expanded === 'results' ? (\n <ChevronUp className=\"ml-1.5 h-4 w-4\" aria-hidden=\"true\" />\n ) : (\n <ChevronDown className=\"ml-1.5 h-4 w-4\" aria-hidden=\"true\" />\n )}\n </Button>\n </div>\n\n {expanded === 'response' && (\n <div className=\"mt-4 border-t border-border-seam pt-4\">\n <MyResponsePanel consultation={consultation} />\n </div>\n )}\n\n {expanded === 'results' && (\n <div className=\"mt-4 border-t border-border-seam pt-4\">\n <ConsultationResultsPanel consultation={consultation} />\n </div>\n )}\n </GlassCard>\n );\n}\n\n/** The calling actor's own submitted answers, read back from the self-scoped query. */\nfunction MyResponsePanel({ consultation }: { consultation: GovConsultation }): ReactElement {\n const { data, isLoading, isError, refetch } = useGovMyConsultationResponse(consultation.id);\n\n const questions = useMemo(\n () => parseConsultationQuestions(consultation.questions),\n [consultation.questions]\n );\n const answers = useMemo(() => parseConsultationAnswers(data?.answers ?? null), [data]);\n const answerById = useMemo(\n () => new Map(answers.map((answer) => [answer.questionId, answer.value])),\n [answers]\n );\n\n if (isLoading) {\n return <LoadingView label=\"Loading your response…\" className=\"min-h-[8rem]\" />;\n }\n\n if (isError) {\n return (\n <ErrorView\n className=\"min-h-[8rem]\"\n message=\"We couldn't load your response.\"\n onRetry={() => {\n void refetch();\n }}\n />\n );\n }\n\n if (!data) {\n return (\n <EmptyState\n icon={<MessageSquareQuote className=\"size-8\" aria-hidden=\"true\" />}\n title=\"No response linked to your account\"\n description=\"Anonymous submissions store no respondent id, so they cannot be shown back to you.\"\n />\n );\n }\n\n const answered = questions.filter((question) => answerById.has(question.id));\n\n return (\n <div className=\"flex flex-col gap-3\">\n <p className=\"text-sm text-text-muted\">\n Submitted {formatDateTime(data.submittedAt)}\n {data.sentiment ? ` · overall sentiment: ${formatEnumLabel(data.sentiment)}` : ''}\n </p>\n\n {answered.length === 0 ? (\n <p className=\"text-sm text-text-muted\">\n Your response recorded no answers against the current questions.\n </p>\n ) : (\n <dl className=\"flex flex-col gap-3\">\n {answered.map((question) => {\n const value = answerById.get(question.id);\n return (\n <div\n key={question.id}\n className=\"rounded-lg border border-border-seam bg-bg-sunken/40 p-3\"\n >\n <dt className=\"text-sm font-medium text-text-primary\">\n {question.label}\n <span className=\"ml-2 text-xs font-normal text-text-muted\">\n {QUESTION_TYPE_LABELS[question.type]}\n </span>\n </dt>\n <dd className=\"mt-1 text-sm text-text-secondary\">\n {question.type === 'BUDGET_ALLOCATION' ? (\n <ul className=\"flex flex-col gap-0.5\">\n {Object.entries(readAllocation(value)).map(([option, amount]) => (\n <li key={option} className=\"flex justify-between gap-4 tabular-nums\">\n <span>{option}</span>\n <span>{formatCurrency(amount, consultation.currencyCode)}</span>\n </li>\n ))}\n </ul>\n ) : (\n describeAnswerValue(question, value).join(', ') || '—'\n )}\n </dd>\n </div>\n );\n })}\n </dl>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyGA,IAAM,KAAY,IAGZ,KAAe,IAKf,KAA+C;CACnD;EAAE,OAA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KAAD;GAAG,WAAU;aAAb;IAAuC;IAC1B,EAAe,EAAK,WAAW;IACzC,EAAK,YAAY,yBAAyB,EAAgB,EAAK,SAAS,MAAM;GAC9E;MAEF,EAAS,WAAW,IACnB,kBAAC,KAAD;GAAG,WAAU;aAA0B;EAEpC,CAAA,IAEH,kBAAC,MAAD;GAAI,WAAU;aACX,EAAS,KAAK,MAAa;IAC1B,IAAM,IAAQ,EAAW,IAAI,EAAS,EAAE;IACxC,OACE,kBAAC,OAAD;KAEE,WAAU;eAFZ,CAIE,kBAAC,MAAD;MAAI,WAAU;gBAAd,CACG,EAAS,OACV,kBAAC,QAAD;OAAM,WAAU;iBACb,EAAqB,EAAS;MAC3B,CAAA,CACJ;SACJ,kBAAC,MAAD;MAAI,WAAU;gBACX,EAAS,SAAS,sBACjB,kBAAC,MAAD;OAAI,WAAU;iBACX,OAAO,QAAQ,EAAe,CAAK,CAAC,EAAE,KAAK,CAAC,GAAQ,OACnD,kBAAC,MAAD;QAAiB,WAAU;kBAA3B,CACE,kBAAC,QAAD,EAAA,UAAO,EAAa,CAAA,GACpB,kBAAC,QAAD,EAAA,UAAO,EAAe,GAAQ,EAAa,YAAY,EAAQ,CAAA,CAC7D;UAHK,CAGL,CACL;MACC,CAAA,IAEJ,EAAoB,GAAU,CAAK,EAAE,KAAK,IAAI,KAAK;KAEnD,CAAA,CACD;OAvBE,EAAS,EAuBX;GAET,CAAC;EACC,CAAA,CAEH;;AAET"}
@@ -1 +1 @@
1
- {"version":3,"file":"CorrectionsPage.js","names":[],"sources":["../../../../src/govcitizenhub/pages/intelligence/CorrectionsPage.tsx"],"sourcesContent":["/**\n * CorrectionsPage — citizen data corrections and the official review queue.\n * @module govcitizenhub/pages/intelligence\n *\n * Route: `intelligence/:jurisdictionId/corrections`\n *\n * Two panels:\n * 1. \"Suggest a correction\" — `govSubmitDataChangeProposal` (a `self` mutation:\n * the submitting actor comes from the gateway, never from the form) plus the\n * caller's own submissions from `govMyDataChangeProposals`, each withdrawable\n * while it is still SUBMITTED or UNDER_REVIEW.\n * 2. \"Review queue\" — `govDataChangeProposals` filtered by status, expandable to\n * the rationale and evidence, with Accept / Reject / Mark under review\n * recorded through `govReviewDataChangeProposal`.\n *\n * IMPORTANT — the review decision is a RECORD, not an edit. Accepting a proposal\n * stamps `appliedAt` on the proposal; it never rewrites the target record. An\n * official still applies the corrected value through that entity's own edit\n * form, so the change to public data stays attributable and shows up in that\n * entity's history. The UI says this in as many words, in both panels.\n *\n * `currentValue` is only populated when the platform captured a snapshot — it is\n * rendered as \"not recorded\" otherwise rather than being guessed at.\n */\n\nimport { Fragment, useState, type FC, type ReactElement } from 'react';\nimport { useParams } from 'react-router-dom';\nimport {\n AlertTriangle,\n Check,\n ChevronDown,\n ChevronRight,\n ExternalLink,\n FileText,\n Info,\n Paperclip,\n Pencil,\n Send,\n ShieldCheck,\n Undo2,\n X,\n} from 'lucide-react';\nimport {\n Button,\n Input,\n Label,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n Skeleton,\n Textarea,\n} from '@burdenoff/fe-libs/ui';\n\nimport { JurisdictionLayout } from './JurisdictionLayout';\nimport { SectionCard } from '../../components/SectionCard';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport { EmptyState } from '../../components/EmptyState';\nimport { ErrorView } from '../../components/StateViews';\nimport { Pagination } from '../../components/Pagination';\nimport { FilterTabs, type FilterOption } from '../../components/FilterTabs';\nimport { ConfirmDialog } from '../../components/ConfirmDialog';\nimport { DocumentUploadField } from '../../components/DocumentUploadField';\nimport {\n useCursorPager,\n useFileUrl,\n useGovDataChangeProposals,\n useGovMyDataChangeProposals,\n useGovReviewDataChangeProposal,\n useGovSubmitDataChangeProposal,\n useGovWithdrawDataChangeProposal,\n} from '../../hooks';\nimport { notify, describeError } from '../../lib/toast';\nimport { formatDateTime, formatRelativeTime } from '../../utils/formatters';\nimport { cn } from '../../utils/cn';\nimport type { GovDataChangeProposal, GovIntelEntityType, GovProposalStatus } from '../../types';\n\nconst PAGE_SIZE = 20;\n\n/** wspace-files-svc folder correction evidence is uploaded into. */\nconst EVIDENCE_FOLDER = '/GovCitizenHub/Corrections';\n\n/** Every `GovIntelEntityType` in the frozen SDL, with a human label. */\nconst ENTITY_TYPES: GovIntelEntityType[] = [\n 'JURISDICTION',\n 'OFFICIAL',\n 'OFFICIAL_COMMITMENT',\n 'BUDGET',\n 'BUDGET_LINE',\n 'PROJECT',\n 'PROJECT_MILESTONE',\n 'INDICATOR_VALUE',\n 'PUBLIC_ASSET',\n 'ELECTION',\n 'ELECTION_RESULT',\n 'DATASET',\n 'EVENT',\n];\n\nconst ENTITY_TYPE_LABELS: Record<GovIntelEntityType, string> = {\n JURISDICTION: 'Jurisdiction profile',\n OFFICIAL: 'Office holder',\n OFFICIAL_COMMITMENT: 'Commitment',\n BUDGET: 'Budget',\n BUDGET_LINE: 'Budget line',\n PROJECT: 'Project',\n PROJECT_MILESTONE: 'Project milestone',\n INDICATOR_VALUE: 'Indicator value',\n PUBLIC_ASSET: 'Public asset',\n ELECTION: 'Election',\n ELECTION_RESULT: 'Election result',\n DATASET: 'Dataset',\n EVENT: 'Timeline event',\n};\n\nconst ALL = 'ALL';\n\ntype StatusFilter = typeof ALL | GovProposalStatus;\n\nconst STATUS_FILTERS: FilterOption<StatusFilter>[] = [\n { value: 'SUBMITTED', label: 'Submitted' },\n { value: 'UNDER_REVIEW', label: 'Under review' },\n { value: 'ACCEPTED', label: 'Accepted' },\n { value: 'REJECTED', label: 'Rejected' },\n { value: 'WITHDRAWN', label: 'Withdrawn' },\n { value: ALL, label: 'All' },\n];\n\n/** Statuses the backend still lets the submitter withdraw. */\nconst WITHDRAWABLE: GovProposalStatus[] = ['SUBMITTED', 'UNDER_REVIEW'];\n\n/** The three decisions `govReviewDataChangeProposal` accepts. */\ntype ReviewDecision = Extract<GovProposalStatus, 'ACCEPTED' | 'REJECTED' | 'UNDER_REVIEW'>;\n\nexport function CorrectionsPage(): ReactElement {\n const { jurisdictionId } = useParams<{ jurisdictionId: string }>();\n\n return (\n <JurisdictionLayout>\n <div className=\"grid gap-4 xl:grid-cols-3\">\n <div className=\"min-w-0 xl:col-span-1\">\n <SuggestCorrectionPanel jurisdictionId={jurisdictionId} />\n </div>\n <div className=\"min-w-0 xl:col-span-2\">\n <ReviewQueuePanel jurisdictionId={jurisdictionId} />\n </div>\n </div>\n </JurisdictionLayout>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Panel 1 — suggest a correction + my submissions\n// ---------------------------------------------------------------------------\n\nconst SuggestCorrectionPanel: FC<{ jurisdictionId?: string }> = ({ jurisdictionId }) => {\n const submitProposal = useGovSubmitDataChangeProposal();\n const withdrawProposal = useGovWithdrawDataChangeProposal();\n const mine = useGovMyDataChangeProposals({ limit: PAGE_SIZE });\n\n const [entityType, setEntityType] = useState<GovIntelEntityType>('JURISDICTION');\n const [entityId, setEntityId] = useState('');\n const [fieldPath, setFieldPath] = useState('');\n const [proposedValue, setProposedValue] = useState('');\n const [rationale, setRationale] = useState('');\n const [evidenceUrl, setEvidenceUrl] = useState('');\n const [evidenceFiles, setEvidenceFiles] = useState<{ id: string; name: string }[]>([]);\n const [error, setError] = useState<string | null>(null);\n const [withdrawing, setWithdrawing] = useState<GovDataChangeProposal | null>(null);\n\n const ready =\n Boolean(jurisdictionId) &&\n Boolean(entityId.trim()) &&\n Boolean(fieldPath.trim()) &&\n Boolean(proposedValue.trim()) &&\n Boolean(rationale.trim());\n\n const submit = async (): Promise<void> => {\n if (!jurisdictionId || !ready) return;\n setError(null);\n try {\n await submitProposal.mutateAsync({\n jurisdictionId,\n entityType,\n entityId: entityId.trim(),\n fieldPath: fieldPath.trim(),\n proposedValue: proposedValue.trim(),\n rationale: rationale.trim(),\n evidenceUrl: evidenceUrl.trim() || null,\n evidenceFileIds: evidenceFiles.map((file) => file.id),\n });\n notify.success('Correction submitted', 'An official will review it and record a decision.');\n setEntityId('');\n setFieldPath('');\n setProposedValue('');\n setRationale('');\n setEvidenceUrl('');\n setEvidenceFiles([]);\n } catch (caught) {\n setError(describeError(caught));\n }\n };\n\n const confirmWithdraw = async (): Promise<void> => {\n if (!withdrawing) return;\n try {\n await withdrawProposal.mutateAsync(withdrawing.id);\n notify.success('Correction withdrawn');\n setWithdrawing(null);\n } catch (caught) {\n notify.error('Could not withdraw the correction', describeError(caught));\n }\n };\n\n const myProposals = mine.data?.items ?? [];\n\n return (\n <div className=\"space-y-4\">\n <SectionCard title=\"Suggest a correction\" icon={<Pencil />} className=\"border-border-seam\">\n <div className=\"mb-4 flex items-start gap-2.5 rounded-lg bg-bg-sunken px-3 py-2.5\">\n <Info className=\"mt-0.5 size-4 shrink-0 text-text-muted\" aria-hidden=\"true\" />\n <p className=\"text-xs text-text-secondary\">\n Point at the exact record and field that is wrong, say what it should be, and show your\n evidence. A reviewer records a decision on your proposal — the published figure itself is\n only changed by an official through that record&rsquo;s own edit form.\n </p>\n </div>\n\n <div className=\"grid gap-3\">\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"correction-entity-type\">What kind of record?</Label>\n <Select\n value={entityType}\n onValueChange={(value) => setEntityType(value as GovIntelEntityType)}\n >\n <SelectTrigger id=\"correction-entity-type\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {ENTITY_TYPES.map((value) => (\n <SelectItem key={value} value={value}>\n {ENTITY_TYPE_LABELS[value]}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"correction-entity-id\">Record id</Label>\n <Input\n id=\"correction-entity-id\"\n value={entityId}\n onChange={(event) => setEntityId(event.target.value)}\n placeholder=\"Copy it from the record you are correcting\"\n />\n </div>\n\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"correction-field-path\">Field</Label>\n <Input\n id=\"correction-field-path\"\n value={fieldPath}\n onChange={(event) => setFieldPath(event.target.value)}\n placeholder=\"e.g. population, contactPhone, budgetAmount\"\n />\n </div>\n\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"correction-proposed\">Proposed value</Label>\n <Textarea\n id=\"correction-proposed\"\n value={proposedValue}\n onChange={(event) => setProposedValue(event.target.value)}\n rows={2}\n placeholder=\"What the field should say\"\n />\n </div>\n\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"correction-rationale\">Why is the current value wrong?</Label>\n <Textarea\n id=\"correction-rationale\"\n value={rationale}\n onChange={(event) => setRationale(event.target.value)}\n rows={4}\n placeholder=\"Explain the discrepancy and where your figure comes from\"\n />\n </div>\n\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"correction-evidence-url\">Evidence URL (optional)</Label>\n <Input\n id=\"correction-evidence-url\"\n value={evidenceUrl}\n onChange={(event) => setEvidenceUrl(event.target.value)}\n placeholder=\"https://… a gazette notice, report or official page\"\n />\n </div>\n\n <div className=\"grid gap-2\">\n <Label>Evidence files (optional)</Label>\n {evidenceFiles.length > 0 && (\n <ul className=\"space-y-1.5\">\n {evidenceFiles.map((file) => (\n <li\n key={file.id}\n className=\"flex items-center justify-between gap-2 rounded-lg border border-border-seam bg-bg-surface px-3 py-2\"\n >\n <span className=\"flex min-w-0 items-center gap-2\">\n <Paperclip className=\"size-3.5 shrink-0 text-text-muted\" aria-hidden=\"true\" />\n <span className=\"truncate text-sm text-text-primary\">{file.name}</span>\n </span>\n <button\n type=\"button\"\n aria-label={`Remove ${file.name}`}\n onClick={() =>\n setEvidenceFiles((current) =>\n current.filter((entry) => entry.id !== file.id)\n )\n }\n className=\"text-text-muted transition-colors hover:text-text-primary\"\n >\n <X className=\"size-4\" aria-hidden=\"true\" />\n </button>\n </li>\n ))}\n </ul>\n )}\n <DocumentUploadField\n folder={EVIDENCE_FOLDER}\n hint=\"Attach a scan, notice or screenshot that backs up your correction\"\n onUploaded={(uploaded) =>\n setEvidenceFiles((current) => [...current, { id: uploaded.id, name: uploaded.name }])\n }\n />\n </div>\n\n {error && (\n <p className=\"rounded-lg bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text\">\n {error}\n </p>\n )}\n\n <Button\n onClick={() => {\n void submit();\n }}\n disabled={!ready || submitProposal.isPending}\n >\n <Send className=\"mr-1.5 h-4 w-4\" aria-hidden=\"true\" />\n {submitProposal.isPending ? 'Submitting…' : 'Submit correction'}\n </Button>\n </div>\n </SectionCard>\n\n <SectionCard\n title=\"Your corrections\"\n icon={<FileText />}\n className=\"border-border-seam\"\n actions={\n mine.isFetching ? <span className=\"text-xs text-text-muted\">Refreshing…</span> : null\n }\n >\n <p className=\"mb-3 text-xs text-text-muted\">\n Everything you have submitted in this workspace, newest first.\n </p>\n\n {mine.isLoading ? (\n <div className=\"space-y-2\">\n {Array.from({ length: 3 }, (_, index) => (\n <Skeleton key={index} className=\"h-16 w-full rounded-lg\" />\n ))}\n </div>\n ) : mine.isError ? (\n <ErrorView\n message=\"We couldn't load your corrections.\"\n onRetry={() => {\n void mine.refetch();\n }}\n />\n ) : myProposals.length === 0 ? (\n <p className=\"text-sm text-text-secondary\">\n You have not submitted a correction yet. Use the form above when you spot a figure that\n does not match the official record.\n </p>\n ) : (\n <ul className=\"space-y-2\">\n {myProposals.map((proposal) => (\n <li\n key={proposal.id}\n className=\"rounded-lg border border-border-seam bg-bg-surface px-3 py-2.5\"\n >\n <div className=\"flex flex-wrap items-start justify-between gap-2\">\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-medium text-text-primary\">\n {ENTITY_TYPE_LABELS[proposal.entityType]} · {proposal.fieldPath}\n </p>\n <p className=\"mt-0.5 truncate text-xs text-text-muted\">\n Proposed: {proposal.proposedValue}\n </p>\n </div>\n <StatusBadge status={proposal.status} />\n </div>\n <div className=\"mt-2 flex flex-wrap items-center justify-between gap-2\">\n <span className=\"text-xs text-text-muted\">\n Submitted {formatRelativeTime(proposal.submittedAt)}\n {Boolean(jurisdictionId) && proposal.jurisdictionId !== jurisdictionId && (\n <span className=\"ml-1.5 rounded-full bg-bg-sunken px-2 py-0.5\">\n Another region\n </span>\n )}\n </span>\n {WITHDRAWABLE.includes(proposal.status) && (\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => setWithdrawing(proposal)}\n disabled={withdrawProposal.isPending}\n >\n <Undo2 className=\"mr-1.5 h-3.5 w-3.5\" aria-hidden=\"true\" /> Withdraw\n </Button>\n )}\n </div>\n {proposal.reviewNote && (\n <p className=\"mt-2 rounded-md bg-bg-sunken px-2.5 py-1.5 text-xs text-text-secondary\">\n <span className=\"font-medium text-text-primary\">Reviewer note: </span>\n {proposal.reviewNote}\n </p>\n )}\n </li>\n ))}\n </ul>\n )}\n </SectionCard>\n\n {withdrawing && (\n <ConfirmDialog\n open\n onOpenChange={(next) => {\n if (!next) setWithdrawing(null);\n }}\n title=\"Withdraw this correction?\"\n description=\"It leaves the review queue. You can submit a fresh correction at any time.\"\n confirmLabel=\"Withdraw\"\n destructive\n onConfirm={confirmWithdraw}\n />\n )}\n </div>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Panel 2 — official review queue\n// ---------------------------------------------------------------------------\n\ninterface PendingReview {\n proposal: GovDataChangeProposal;\n decision: ReviewDecision;\n}\n\nconst REVIEW_COPY: Record<ReviewDecision, { title: string; description: string; label: string }> = {\n ACCEPTED: {\n title: 'Accept this correction?',\n description:\n 'This RECORDS your decision on the proposal. It does not change the published figure — apply the corrected value through that record’s own edit form so the change stays attributable and appears in its history.',\n label: 'Record acceptance',\n },\n REJECTED: {\n title: 'Reject this correction?',\n description:\n 'The submitter sees your note, so explain what the evidence did not establish.',\n label: 'Record rejection',\n },\n UNDER_REVIEW: {\n title: 'Mark as under review?',\n description:\n 'Signals to the submitter that someone has picked this up. It stays withdrawable while under review.',\n label: 'Mark under review',\n },\n};\n\nconst ReviewQueuePanel: FC<{ jurisdictionId?: string }> = ({ jurisdictionId }) => {\n const pager = useCursorPager();\n const [status, setStatus] = useState<StatusFilter>('SUBMITTED');\n const [expandedId, setExpandedId] = useState<string | null>(null);\n const [pending, setPending] = useState<PendingReview | null>(null);\n\n const { data, isLoading, isError, refetch } = useGovDataChangeProposals(\n {\n jurisdictionId,\n status: status === ALL ? undefined : status,\n },\n { limit: PAGE_SIZE, cursor: pager.cursor }\n );\n const reviewProposal = useGovReviewDataChangeProposal();\n\n const proposals = data?.items ?? [];\n\n const changeStatus = (next: StatusFilter): void => {\n setStatus(next);\n setExpandedId(null);\n pager.reset();\n };\n\n const confirmReview = async (reviewNote: string): Promise<void> => {\n if (!pending) return;\n try {\n await reviewProposal.mutateAsync({\n id: pending.proposal.id,\n decision: pending.decision,\n reviewNote: reviewNote.trim() || null,\n });\n notify.success(\n pending.decision === 'ACCEPTED'\n ? 'Acceptance recorded'\n : pending.decision === 'REJECTED'\n ? 'Rejection recorded'\n : 'Marked as under review',\n pending.decision === 'ACCEPTED'\n ? 'Now apply the value through the record’s own edit form.'\n : undefined\n );\n setPending(null);\n } catch (caught) {\n notify.error('Could not record the decision', describeError(caught));\n }\n };\n\n return (\n <SectionCard\n title=\"Review queue\"\n icon={<ShieldCheck />}\n className=\"border-border-seam\"\n flush\n >\n <div className=\"border-b border-border-seam px-5 py-4\">\n <div className=\"mb-3 flex items-start gap-2.5 rounded-lg bg-status-warning-bg-subtle px-3 py-2.5\">\n <AlertTriangle\n className=\"mt-0.5 size-4 shrink-0 text-status-warning-text\"\n aria-hidden=\"true\"\n />\n <p className=\"text-xs text-status-warning-text\">\n Accepting a correction <span className=\"font-semibold\">records the decision only</span>.\n The published value is not touched — an official must apply it through the record&rsquo;s\n own edit form so the change is attributable and shows up in that record&rsquo;s history.\n </p>\n </div>\n <div className=\"overflow-x-auto pb-1\">\n <FilterTabs options={STATUS_FILTERS} value={status} onChange={changeStatus} />\n </div>\n </div>\n\n {isLoading ? (\n <div className=\"space-y-2 p-5\">\n {Array.from({ length: 5 }, (_, index) => (\n <Skeleton key={index} className=\"h-12 w-full rounded-lg\" />\n ))}\n </div>\n ) : isError ? (\n <div className=\"p-5\">\n <ErrorView\n message=\"We couldn't load the review queue.\"\n onRetry={() => {\n void refetch();\n }}\n />\n </div>\n ) : proposals.length === 0 && pager.page === 0 ? (\n <div className=\"p-5\">\n <EmptyState\n illustration=\"empty-data\"\n title={status === ALL ? 'No corrections yet' : 'Nothing in this state'}\n description={\n status === ALL\n ? 'When residents or researchers propose a correction for this region it lands here.'\n : 'Switch state to see corrections at another point in the review workflow.'\n }\n />\n </div>\n ) : (\n <>\n <div className=\"overflow-x-auto\">\n <table className=\"w-full text-left text-sm\">\n <thead>\n <tr className=\"border-b border-border-seam text-xs uppercase tracking-wide text-text-muted\">\n <th className=\"w-10 px-3 py-3\" aria-label=\"Expand\" />\n <th className=\"px-4 py-3 font-medium\">Record</th>\n <th className=\"px-4 py-3 font-medium\">Field</th>\n <th className=\"px-4 py-3 font-medium\">Current</th>\n <th className=\"px-4 py-3 font-medium\">Proposed</th>\n <th className=\"px-4 py-3 font-medium\">Submitted</th>\n <th className=\"px-4 py-3 font-medium\">Status</th>\n <th className=\"px-4 py-3 text-right font-medium\">Decision</th>\n </tr>\n </thead>\n <tbody className=\"divide-y divide-border-subtle\">\n {proposals.map((proposal) => {\n const expanded = expandedId === proposal.id;\n const open = proposal.status === 'SUBMITTED' || proposal.status === 'UNDER_REVIEW';\n return (\n <Fragment key={proposal.id}>\n <tr className={cn('transition-colors', expanded && 'bg-bg-sunken')}>\n <td className=\"px-3 py-3 align-top\">\n <button\n type=\"button\"\n aria-expanded={expanded}\n aria-label={expanded ? 'Collapse details' : 'Expand details'}\n onClick={() => setExpandedId(expanded ? null : proposal.id)}\n className=\"inline-flex size-7 items-center justify-center rounded-lg text-text-muted transition-colors hover:bg-bg-sunken hover:text-text-primary\"\n >\n {expanded ? (\n <ChevronDown className=\"size-4\" aria-hidden=\"true\" />\n ) : (\n <ChevronRight className=\"size-4\" aria-hidden=\"true\" />\n )}\n </button>\n </td>\n <td className=\"px-4 py-3 align-top\">\n <p className=\"whitespace-nowrap font-medium text-text-primary\">\n {ENTITY_TYPE_LABELS[proposal.entityType]}\n </p>\n <p className=\"font-mono text-xs text-text-muted\">{proposal.entityId}</p>\n </td>\n <td className=\"whitespace-nowrap px-4 py-3 align-top font-mono text-xs text-text-secondary\">\n {proposal.fieldPath}\n </td>\n <td className=\"max-w-[14rem] break-words px-4 py-3 align-top text-text-secondary\">\n {proposal.currentValue ?? (\n <span className=\"text-text-muted\">Not recorded</span>\n )}\n </td>\n <td className=\"max-w-[14rem] break-words px-4 py-3 align-top font-medium text-text-primary\">\n {proposal.proposedValue}\n </td>\n <td className=\"whitespace-nowrap px-4 py-3 align-top text-text-secondary\">\n {formatDateTime(proposal.submittedAt)}\n </td>\n <td className=\"px-4 py-3 align-top\">\n <StatusBadge status={proposal.status} />\n </td>\n <td className=\"px-4 py-3 align-top\">\n <div className=\"flex flex-wrap justify-end gap-1.5\">\n {open ? (\n <>\n {proposal.status === 'SUBMITTED' && (\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() =>\n setPending({ proposal, decision: 'UNDER_REVIEW' })\n }\n disabled={reviewProposal.isPending}\n >\n Review\n </Button>\n )}\n <Button\n variant=\"outline\"\n size=\"sm\"\n aria-label=\"Accept correction\"\n onClick={() => setPending({ proposal, decision: 'ACCEPTED' })}\n disabled={reviewProposal.isPending}\n >\n <Check className=\"h-4 w-4\" aria-hidden=\"true\" />\n </Button>\n <Button\n variant=\"outline\"\n size=\"sm\"\n aria-label=\"Reject correction\"\n onClick={() => setPending({ proposal, decision: 'REJECTED' })}\n disabled={reviewProposal.isPending}\n >\n <X className=\"h-4 w-4\" aria-hidden=\"true\" />\n </Button>\n </>\n ) : (\n <span className=\"whitespace-nowrap text-xs text-text-muted\">\n {proposal.reviewedAt\n ? `Decided ${formatRelativeTime(proposal.reviewedAt)}`\n : '—'}\n </span>\n )}\n </div>\n </td>\n </tr>\n {expanded && (\n <tr className=\"bg-bg-sunken\">\n <td colSpan={8} className=\"px-4 py-4\">\n <ProposalDetail proposal={proposal} />\n </td>\n </tr>\n )}\n </Fragment>\n );\n })}\n </tbody>\n </table>\n </div>\n\n <div className=\"px-5 pb-4\">\n <Pagination\n page={pager.page}\n pageSize={PAGE_SIZE}\n itemCount={proposals.length}\n hasMore={data?.pageInfo.hasMore ?? false}\n onPageChange={(target) => {\n pager.onPageChange(target, data?.pageInfo.cursor);\n setExpandedId(null);\n }}\n />\n </div>\n </>\n )}\n\n {pending && (\n <ConfirmDialog\n open\n onOpenChange={(next) => {\n if (!next) setPending(null);\n }}\n title={REVIEW_COPY[pending.decision].title}\n description={REVIEW_COPY[pending.decision].description}\n confirmLabel={REVIEW_COPY[pending.decision].label}\n destructive={pending.decision === 'REJECTED'}\n reason={{\n label: 'Review note',\n placeholder:\n pending.decision === 'REJECTED'\n ? 'Explain what the evidence did not establish…'\n : 'Optional note recorded against the proposal…',\n required: pending.decision === 'REJECTED',\n }}\n onConfirm={confirmReview}\n />\n )}\n </SectionCard>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Expanded proposal detail\n// ---------------------------------------------------------------------------\n\nconst ProposalDetail: FC<{ proposal: GovDataChangeProposal }> = ({ proposal }) => (\n <div className=\"grid gap-4 md:grid-cols-2\">\n <div>\n <p className=\"mb-1 text-xs font-medium uppercase tracking-wide text-text-muted\">Rationale</p>\n <p className=\"whitespace-pre-wrap text-sm text-text-primary\">{proposal.rationale}</p>\n </div>\n <div className=\"space-y-3\">\n <div>\n <p className=\"mb-1 text-xs font-medium uppercase tracking-wide text-text-muted\">Evidence</p>\n {proposal.evidenceUrl ? (\n <a\n href={proposal.evidenceUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1.5 break-all text-sm text-action-primary-text hover:underline\"\n >\n <ExternalLink className=\"size-3.5 shrink-0\" aria-hidden=\"true\" />\n {proposal.evidenceUrl}\n </a>\n ) : (\n <p className=\"text-sm text-text-muted\">No evidence link supplied.</p>\n )}\n {proposal.evidenceFileIds.length > 0 && (\n <ul className=\"mt-2 space-y-1.5\">\n {proposal.evidenceFileIds.map((fileId) => (\n <li key={fileId}>\n <EvidenceFileLink fileId={fileId} />\n </li>\n ))}\n </ul>\n )}\n </div>\n\n {(proposal.reviewNote || proposal.reviewedAt) && (\n <div>\n <p className=\"mb-1 text-xs font-medium uppercase tracking-wide text-text-muted\">\n Recorded decision\n </p>\n <p className=\"text-sm text-text-secondary\">\n {proposal.status === 'ACCEPTED' ? 'Accepted' : 'Reviewed'}\n {proposal.reviewedAt ? ` on ${formatDateTime(proposal.reviewedAt)}` : ''}\n {proposal.appliedAt\n ? ' · acceptance stamped — the value is applied separately through the record’s own edit form'\n : ''}\n </p>\n {proposal.reviewNote && (\n <p className=\"mt-1 whitespace-pre-wrap text-sm text-text-primary\">\n {proposal.reviewNote}\n </p>\n )}\n </div>\n )}\n </div>\n </div>\n);\n\n/** Resolves one evidence file id to a presigned link through wspace-files-svc. */\nconst EvidenceFileLink: FC<{ fileId: string }> = ({ fileId }) => {\n const { data: url, isLoading, isError } = useFileUrl(fileId);\n\n if (isLoading) {\n return <Skeleton className=\"h-4 w-40 rounded\" />;\n }\n if (isError || !url) {\n return (\n <span className=\"inline-flex items-center gap-1.5 text-sm text-text-muted\">\n <Paperclip className=\"size-3.5\" aria-hidden=\"true\" />\n <span className=\"font-mono text-xs\">{fileId}</span>\n <span className=\"text-status-error-text\">(link unavailable)</span>\n </span>\n );\n }\n return (\n <a\n href={url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1.5 text-sm text-action-primary-text hover:underline\"\n >\n <Paperclip className=\"size-3.5 shrink-0\" aria-hidden=\"true\" />\n Attached evidence\n <span className=\"font-mono text-xs text-text-muted\">{fileId.slice(0, 8)}</span>\n </a>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8EA,IAAM,IAAY,IAGZ,KAAkB,8BAGlB,KAAqC;CACzC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GAEM,IAAyD;CAC7D,cAAc;CACd,UAAU;CACV,qBAAqB;CACrB,QAAQ;CACR,aAA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AG,WAAU;cAAb;KACG,EAAS,WAAW,aAAa,aAAa;KAC9C,EAAS,aAAa,OAAO,EAAe,EAAS,UAAU,MAAM;KACrE,EAAS,YACN,+FACA;IACH;;GACF,EAAS,cACR,kBAAC,KAAD;IAAG,WAAU;cACV,EAAS;GACT,CAAA;EAEF,EAAA,CAAA,CAEJ;GACF;IAID,MAA4C,EAAE,gBAAa;CAC/D,IAAM,EAAE,MAAM,GAAK,cAAW,eAAY,EAAW,CAAM;CAc3D,OAZI,IACK,kBAAC,GAAD,EAAU,WAAU,mBAAoB,CAAA,IAE7C,KAAW,CAAC,IAEZ,kBAAC,QAAD;EAAM,WAAU;YAAhB;GACE,kBAAC,GAAD;IAAW,WAAU;IAAW,eAAY;GAAQ,CAAA;GACpD,kBAAC,QAAD;IAAM,WAAU;cAAqB;GAAa,CAAA;GAClD,kBAAC,QAAD;IAAM,WAAU;cAAyB;GAAwB,CAAA;EAC7D;MAIR,kBAAC,KAAD;EACE,MAAM;EACN,QAAO;EACP,KAAI;EACJ,WAAU;YAJZ;GAME,kBAAC,GAAD;IAAW,WAAU;IAAoB,eAAY;GAAQ,CAAA;GAAC;GAE9D,kBAAC,QAAD;IAAM,WAAU;cAAqC,EAAO,MAAM,GAAG,CAAC;GAAQ,CAAA;EAC7E;;AAEP"}
1
+ {"version":3,"file":"CorrectionsPage.js","names":[],"sources":["../../../../src/govcitizenhub/pages/intelligence/CorrectionsPage.tsx"],"sourcesContent":["/**\n * CorrectionsPage — citizen data corrections and the official review queue.\n * @module govcitizenhub/pages/intelligence\n *\n * Route: `intelligence/:jurisdictionId/corrections`\n *\n * Two panels:\n * 1. \"Suggest a correction\" — `govSubmitDataChangeProposal` (a `self` mutation:\n * the submitting actor comes from the gateway, never from the form) plus the\n * caller's own submissions from `govMyDataChangeProposals`, each withdrawable\n * while it is still SUBMITTED or UNDER_REVIEW.\n * 2. \"Review queue\" — `govDataChangeProposals` filtered by status, expandable to\n * the rationale and evidence, with Accept / Reject / Mark under review\n * recorded through `govReviewDataChangeProposal`.\n *\n * IMPORTANT — the review decision is a RECORD, not an edit. Accepting a proposal\n * stamps `appliedAt` on the proposal; it never rewrites the target record. An\n * official still applies the corrected value through that entity's own edit\n * form, so the change to public data stays attributable and shows up in that\n * entity's history. The UI says this in as many words, in both panels.\n *\n * `currentValue` is only populated when the platform captured a snapshot — it is\n * rendered as \"not recorded\" otherwise rather than being guessed at.\n */\n\nimport { Fragment, useState, type FC, type ReactElement } from 'react';\nimport { useParams } from 'react-router-dom';\nimport {\n AlertTriangle,\n Check,\n ChevronDown,\n ChevronRight,\n ExternalLink,\n FileText,\n Info,\n Paperclip,\n Pencil,\n Send,\n ShieldCheck,\n Undo2,\n X,\n} from 'lucide-react';\nimport {\n Button,\n Input,\n Label,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n Skeleton,\n Textarea,\n} from '@burdenoff/fe-libs/ui';\n\nimport { JurisdictionLayout } from './JurisdictionLayout';\nimport { SectionCard } from '../../components/SectionCard';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport { EmptyState } from '../../components/EmptyState';\nimport { ErrorView } from '../../components/StateViews';\nimport { Pagination } from '../../components/Pagination';\nimport { FilterTabs, type FilterOption } from '../../components/FilterTabs';\nimport { ConfirmDialog } from '../../components/ConfirmDialog';\nimport { DocumentUploadField } from '../../components/DocumentUploadField';\nimport {\n useCursorPager,\n useFileUrl,\n useGovDataChangeProposals,\n useGovMyDataChangeProposals,\n useGovReviewDataChangeProposal,\n useGovSubmitDataChangeProposal,\n useGovWithdrawDataChangeProposal,\n} from '../../hooks';\nimport { notify, describeError } from '../../lib/toast';\nimport { formatDateTime, formatRelativeTime } from '../../utils/formatters';\nimport { cn } from '../../utils/cn';\nimport type { GovDataChangeProposal, GovIntelEntityType, GovProposalStatus } from '../../types';\n\nconst PAGE_SIZE = 20;\n\n/** wspace-files-svc folder correction evidence is uploaded into. */\nconst EVIDENCE_FOLDER = '/GovCitizenHub/Corrections';\n\n/** Every `GovIntelEntityType` in the frozen SDL, with a human label. */\nconst ENTITY_TYPES: GovIntelEntityType[] = [\n 'JURISDICTION',\n 'OFFICIAL',\n 'OFFICIAL_COMMITMENT',\n 'BUDGET',\n 'BUDGET_LINE',\n 'PROJECT',\n 'PROJECT_MILESTONE',\n 'INDICATOR_VALUE',\n 'PUBLIC_ASSET',\n 'ELECTION',\n 'ELECTION_RESULT',\n 'DATASET',\n 'EVENT',\n];\n\nconst ENTITY_TYPE_LABELS: Record<GovIntelEntityType, string> = {\n JURISDICTION: 'Jurisdiction profile',\n OFFICIAL: 'Office holder',\n OFFICIAL_COMMITMENT: 'Commitment',\n BUDGET: 'Budget',\n BUDGET_LINE: 'Budget line',\n PROJECT: 'Project',\n PROJECT_MILESTONE: 'Project milestone',\n INDICATOR_VALUE: 'Indicator value',\n PUBLIC_ASSET: 'Public asset',\n ELECTION: 'Election',\n ELECTION_RESULT: 'Election result',\n DATASET: 'Dataset',\n EVENT: 'Timeline event',\n};\n\nconst ALL = 'ALL';\n\ntype StatusFilter = typeof ALL | GovProposalStatus;\n\nconst STATUS_FILTERS: FilterOption<StatusFilter>[] = [\n { value: 'SUBMITTED', label: 'Submitted' },\n { value: 'UNDER_REVIEW', label: 'Under review' },\n { value: 'ACCEPTED', label: 'Accepted' },\n { value: 'REJECTED', label: 'Rejected' },\n { value: 'WITHDRAWN', label: 'Withdrawn' },\n { value: ALL, label: 'All' },\n];\n\n/** Statuses the backend still lets the submitter withdraw. */\nconst WITHDRAWABLE: GovProposalStatus[] = ['SUBMITTED', 'UNDER_REVIEW'];\n\n/** The three decisions `govReviewDataChangeProposal` accepts. */\ntype ReviewDecision = Extract<GovProposalStatus, 'ACCEPTED' | 'REJECTED' | 'UNDER_REVIEW'>;\n\nexport function CorrectionsPage(): ReactElement {\n const { jurisdictionId } = useParams<{ jurisdictionId: string }>();\n\n return (\n <JurisdictionLayout>\n <div className=\"grid gap-4 xl:grid-cols-3\">\n <div className=\"min-w-0 xl:col-span-1\">\n <SuggestCorrectionPanel jurisdictionId={jurisdictionId} />\n </div>\n <div className=\"min-w-0 xl:col-span-2\">\n <ReviewQueuePanel jurisdictionId={jurisdictionId} />\n </div>\n </div>\n </JurisdictionLayout>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Panel 1 — suggest a correction + my submissions\n// ---------------------------------------------------------------------------\n\nconst SuggestCorrectionPanel: FC<{ jurisdictionId?: string }> = ({ jurisdictionId }) => {\n const submitProposal = useGovSubmitDataChangeProposal();\n const withdrawProposal = useGovWithdrawDataChangeProposal();\n const mine = useGovMyDataChangeProposals({ limit: PAGE_SIZE });\n\n const [entityType, setEntityType] = useState<GovIntelEntityType>('JURISDICTION');\n const [entityId, setEntityId] = useState('');\n const [fieldPath, setFieldPath] = useState('');\n const [proposedValue, setProposedValue] = useState('');\n const [rationale, setRationale] = useState('');\n const [evidenceUrl, setEvidenceUrl] = useState('');\n const [evidenceFiles, setEvidenceFiles] = useState<{ id: string; name: string }[]>([]);\n const [error, setError] = useState<string | null>(null);\n const [withdrawing, setWithdrawing] = useState<GovDataChangeProposal | null>(null);\n\n const ready =\n Boolean(jurisdictionId) &&\n Boolean(entityId.trim()) &&\n Boolean(fieldPath.trim()) &&\n Boolean(proposedValue.trim()) &&\n Boolean(rationale.trim());\n\n const submit = async (): Promise<void> => {\n if (!jurisdictionId || !ready) return;\n setError(null);\n try {\n await submitProposal.mutateAsync({\n jurisdictionId,\n entityType,\n entityId: entityId.trim(),\n fieldPath: fieldPath.trim(),\n proposedValue: proposedValue.trim(),\n rationale: rationale.trim(),\n evidenceUrl: evidenceUrl.trim() || null,\n evidenceFileIds: evidenceFiles.map((file) => file.id),\n });\n notify.success('Correction submitted', 'An official will review it and record a decision.');\n setEntityId('');\n setFieldPath('');\n setProposedValue('');\n setRationale('');\n setEvidenceUrl('');\n setEvidenceFiles([]);\n } catch (caught) {\n setError(describeError(caught));\n }\n };\n\n const confirmWithdraw = async (): Promise<void> => {\n if (!withdrawing) return;\n try {\n await withdrawProposal.mutateAsync(withdrawing.id);\n notify.success('Correction withdrawn');\n setWithdrawing(null);\n } catch (caught) {\n notify.error('Could not withdraw the correction', describeError(caught));\n }\n };\n\n const myProposals = mine.data?.items ?? [];\n\n return (\n <div className=\"space-y-4\">\n <SectionCard title=\"Suggest a correction\" icon={<Pencil />} className=\"border-border-seam\">\n <div className=\"mb-4 flex items-start gap-2.5 rounded-lg bg-bg-sunken px-3 py-2.5\">\n <Info className=\"mt-0.5 size-4 shrink-0 text-text-muted\" aria-hidden=\"true\" />\n <p className=\"text-xs text-text-secondary\">\n Point at the exact record and field that is wrong, say what it should be, and show your\n evidence. A reviewer records a decision on your proposal — the published figure itself\n is only changed by an official through that record&rsquo;s own edit form.\n </p>\n </div>\n\n <div className=\"grid gap-3\">\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"correction-entity-type\">What kind of record?</Label>\n <Select\n value={entityType}\n onValueChange={(value) => setEntityType(value as GovIntelEntityType)}\n >\n <SelectTrigger id=\"correction-entity-type\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {ENTITY_TYPES.map((value) => (\n <SelectItem key={value} value={value}>\n {ENTITY_TYPE_LABELS[value]}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"correction-entity-id\">Record id</Label>\n <Input\n id=\"correction-entity-id\"\n value={entityId}\n onChange={(event) => setEntityId(event.target.value)}\n placeholder=\"Copy it from the record you are correcting\"\n />\n </div>\n\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"correction-field-path\">Field</Label>\n <Input\n id=\"correction-field-path\"\n value={fieldPath}\n onChange={(event) => setFieldPath(event.target.value)}\n placeholder=\"e.g. population, contactPhone, budgetAmount\"\n />\n </div>\n\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"correction-proposed\">Proposed value</Label>\n <Textarea\n id=\"correction-proposed\"\n value={proposedValue}\n onChange={(event) => setProposedValue(event.target.value)}\n rows={2}\n placeholder=\"What the field should say\"\n />\n </div>\n\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"correction-rationale\">Why is the current value wrong?</Label>\n <Textarea\n id=\"correction-rationale\"\n value={rationale}\n onChange={(event) => setRationale(event.target.value)}\n rows={4}\n placeholder=\"Explain the discrepancy and where your figure comes from\"\n />\n </div>\n\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"correction-evidence-url\">Evidence URL (optional)</Label>\n <Input\n id=\"correction-evidence-url\"\n value={evidenceUrl}\n onChange={(event) => setEvidenceUrl(event.target.value)}\n placeholder=\"https://… a gazette notice, report or official page\"\n />\n </div>\n\n <div className=\"grid gap-2\">\n <Label>Evidence files (optional)</Label>\n {evidenceFiles.length > 0 && (\n <ul className=\"space-y-1.5\">\n {evidenceFiles.map((file) => (\n <li\n key={file.id}\n className=\"flex items-center justify-between gap-2 rounded-lg border border-border-seam bg-bg-surface px-3 py-2\"\n >\n <span className=\"flex min-w-0 items-center gap-2\">\n <Paperclip className=\"size-3.5 shrink-0 text-text-muted\" aria-hidden=\"true\" />\n <span className=\"truncate text-sm text-text-primary\">{file.name}</span>\n </span>\n <button\n type=\"button\"\n aria-label={`Remove ${file.name}`}\n onClick={() =>\n setEvidenceFiles((current) =>\n current.filter((entry) => entry.id !== file.id)\n )\n }\n className=\"text-text-muted transition-colors hover:text-text-primary\"\n >\n <X className=\"size-4\" aria-hidden=\"true\" />\n </button>\n </li>\n ))}\n </ul>\n )}\n <DocumentUploadField\n folder={EVIDENCE_FOLDER}\n hint=\"Attach a scan, notice or screenshot that backs up your correction\"\n onUploaded={(uploaded) =>\n setEvidenceFiles((current) => [\n ...current,\n { id: uploaded.id, name: uploaded.name },\n ])\n }\n />\n </div>\n\n {error && (\n <p className=\"rounded-lg bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text\">\n {error}\n </p>\n )}\n\n <Button\n onClick={() => {\n void submit();\n }}\n disabled={!ready || submitProposal.isPending}\n >\n <Send className=\"mr-1.5 h-4 w-4\" aria-hidden=\"true\" />\n {submitProposal.isPending ? 'Submitting…' : 'Submit correction'}\n </Button>\n </div>\n </SectionCard>\n\n <SectionCard\n title=\"Your corrections\"\n icon={<FileText />}\n className=\"border-border-seam\"\n actions={\n mine.isFetching ? <span className=\"text-xs text-text-muted\">Refreshing…</span> : null\n }\n >\n <p className=\"mb-3 text-xs text-text-muted\">\n Everything you have submitted in this workspace, newest first.\n </p>\n\n {mine.isLoading ? (\n <div className=\"space-y-2\">\n {Array.from({ length: 3 }, (_, index) => (\n <Skeleton key={index} className=\"h-16 w-full rounded-lg\" />\n ))}\n </div>\n ) : mine.isError ? (\n <ErrorView\n message=\"We couldn't load your corrections.\"\n onRetry={() => {\n void mine.refetch();\n }}\n />\n ) : myProposals.length === 0 ? (\n <p className=\"text-sm text-text-secondary\">\n You have not submitted a correction yet. Use the form above when you spot a figure that\n does not match the official record.\n </p>\n ) : (\n <ul className=\"space-y-2\">\n {myProposals.map((proposal) => (\n <li\n key={proposal.id}\n className=\"rounded-lg border border-border-seam bg-bg-surface px-3 py-2.5\"\n >\n <div className=\"flex flex-wrap items-start justify-between gap-2\">\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-medium text-text-primary\">\n {ENTITY_TYPE_LABELS[proposal.entityType]} · {proposal.fieldPath}\n </p>\n <p className=\"mt-0.5 truncate text-xs text-text-muted\">\n Proposed: {proposal.proposedValue}\n </p>\n </div>\n <StatusBadge status={proposal.status} />\n </div>\n <div className=\"mt-2 flex flex-wrap items-center justify-between gap-2\">\n <span className=\"text-xs text-text-muted\">\n Submitted {formatRelativeTime(proposal.submittedAt)}\n {Boolean(jurisdictionId) && proposal.jurisdictionId !== jurisdictionId && (\n <span className=\"ml-1.5 rounded-full bg-bg-sunken px-2 py-0.5\">\n Another region\n </span>\n )}\n </span>\n {WITHDRAWABLE.includes(proposal.status) && (\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => setWithdrawing(proposal)}\n disabled={withdrawProposal.isPending}\n >\n <Undo2 className=\"mr-1.5 h-3.5 w-3.5\" aria-hidden=\"true\" /> Withdraw\n </Button>\n )}\n </div>\n {proposal.reviewNote && (\n <p className=\"mt-2 rounded-md bg-bg-sunken px-2.5 py-1.5 text-xs text-text-secondary\">\n <span className=\"font-medium text-text-primary\">Reviewer note: </span>\n {proposal.reviewNote}\n </p>\n )}\n </li>\n ))}\n </ul>\n )}\n </SectionCard>\n\n {withdrawing && (\n <ConfirmDialog\n open\n onOpenChange={(next) => {\n if (!next) setWithdrawing(null);\n }}\n title=\"Withdraw this correction?\"\n description=\"It leaves the review queue. You can submit a fresh correction at any time.\"\n confirmLabel=\"Withdraw\"\n destructive\n onConfirm={confirmWithdraw}\n />\n )}\n </div>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Panel 2 — official review queue\n// ---------------------------------------------------------------------------\n\ninterface PendingReview {\n proposal: GovDataChangeProposal;\n decision: ReviewDecision;\n}\n\nconst REVIEW_COPY: Record<ReviewDecision, { title: string; description: string; label: string }> = {\n ACCEPTED: {\n title: 'Accept this correction?',\n description:\n 'This RECORDS your decision on the proposal. It does not change the published figure — apply the corrected value through that record’s own edit form so the change stays attributable and appears in its history.',\n label: 'Record acceptance',\n },\n REJECTED: {\n title: 'Reject this correction?',\n description: 'The submitter sees your note, so explain what the evidence did not establish.',\n label: 'Record rejection',\n },\n UNDER_REVIEW: {\n title: 'Mark as under review?',\n description:\n 'Signals to the submitter that someone has picked this up. It stays withdrawable while under review.',\n label: 'Mark under review',\n },\n};\n\nconst ReviewQueuePanel: FC<{ jurisdictionId?: string }> = ({ jurisdictionId }) => {\n const pager = useCursorPager();\n const [status, setStatus] = useState<StatusFilter>('SUBMITTED');\n const [expandedId, setExpandedId] = useState<string | null>(null);\n const [pending, setPending] = useState<PendingReview | null>(null);\n\n const { data, isLoading, isError, refetch } = useGovDataChangeProposals(\n {\n jurisdictionId,\n status: status === ALL ? undefined : status,\n },\n { limit: PAGE_SIZE, cursor: pager.cursor }\n );\n const reviewProposal = useGovReviewDataChangeProposal();\n\n const proposals = data?.items ?? [];\n\n const changeStatus = (next: StatusFilter): void => {\n setStatus(next);\n setExpandedId(null);\n pager.reset();\n };\n\n const confirmReview = async (reviewNote: string): Promise<void> => {\n if (!pending) return;\n try {\n await reviewProposal.mutateAsync({\n id: pending.proposal.id,\n decision: pending.decision,\n reviewNote: reviewNote.trim() || null,\n });\n notify.success(\n pending.decision === 'ACCEPTED'\n ? 'Acceptance recorded'\n : pending.decision === 'REJECTED'\n ? 'Rejection recorded'\n : 'Marked as under review',\n pending.decision === 'ACCEPTED'\n ? 'Now apply the value through the record’s own edit form.'\n : undefined\n );\n setPending(null);\n } catch (caught) {\n notify.error('Could not record the decision', describeError(caught));\n }\n };\n\n return (\n <SectionCard title=\"Review queue\" icon={<ShieldCheck />} className=\"border-border-seam\" flush>\n <div className=\"border-b border-border-seam px-5 py-4\">\n <div className=\"mb-3 flex items-start gap-2.5 rounded-lg bg-status-warning-bg-subtle px-3 py-2.5\">\n <AlertTriangle\n className=\"mt-0.5 size-4 shrink-0 text-status-warning-text\"\n aria-hidden=\"true\"\n />\n <p className=\"text-xs text-status-warning-text\">\n Accepting a correction <span className=\"font-semibold\">records the decision only</span>.\n The published value is not touched — an official must apply it through the\n record&rsquo;s own edit form so the change is attributable and shows up in that\n record&rsquo;s history.\n </p>\n </div>\n <div className=\"overflow-x-auto pb-1\">\n <FilterTabs options={STATUS_FILTERS} value={status} onChange={changeStatus} />\n </div>\n </div>\n\n {isLoading ? (\n <div className=\"space-y-2 p-5\">\n {Array.from({ length: 5 }, (_, index) => (\n <Skeleton key={index} className=\"h-12 w-full rounded-lg\" />\n ))}\n </div>\n ) : isError ? (\n <div className=\"p-5\">\n <ErrorView\n message=\"We couldn't load the review queue.\"\n onRetry={() => {\n void refetch();\n }}\n />\n </div>\n ) : proposals.length === 0 && pager.page === 0 ? (\n <div className=\"p-5\">\n <EmptyState\n illustration=\"empty-data\"\n title={status === ALL ? 'No corrections yet' : 'Nothing in this state'}\n description={\n status === ALL\n ? 'When residents or researchers propose a correction for this region it lands here.'\n : 'Switch state to see corrections at another point in the review workflow.'\n }\n />\n </div>\n ) : (\n <>\n <div className=\"overflow-x-auto\">\n <table className=\"w-full text-left text-sm\">\n <thead>\n <tr className=\"border-b border-border-seam text-xs uppercase tracking-wide text-text-muted\">\n <th className=\"w-10 px-3 py-3\" aria-label=\"Expand\" />\n <th className=\"px-4 py-3 font-medium\">Record</th>\n <th className=\"px-4 py-3 font-medium\">Field</th>\n <th className=\"px-4 py-3 font-medium\">Current</th>\n <th className=\"px-4 py-3 font-medium\">Proposed</th>\n <th className=\"px-4 py-3 font-medium\">Submitted</th>\n <th className=\"px-4 py-3 font-medium\">Status</th>\n <th className=\"px-4 py-3 text-right font-medium\">Decision</th>\n </tr>\n </thead>\n <tbody className=\"divide-y divide-border-subtle\">\n {proposals.map((proposal) => {\n const expanded = expandedId === proposal.id;\n const open =\n proposal.status === 'SUBMITTED' || proposal.status === 'UNDER_REVIEW';\n return (\n <Fragment key={proposal.id}>\n <tr className={cn('transition-colors', expanded && 'bg-bg-sunken')}>\n <td className=\"px-3 py-3 align-top\">\n <button\n type=\"button\"\n aria-expanded={expanded}\n aria-label={expanded ? 'Collapse details' : 'Expand details'}\n onClick={() => setExpandedId(expanded ? null : proposal.id)}\n className=\"inline-flex size-7 items-center justify-center rounded-lg text-text-muted transition-colors hover:bg-bg-sunken hover:text-text-primary\"\n >\n {expanded ? (\n <ChevronDown className=\"size-4\" aria-hidden=\"true\" />\n ) : (\n <ChevronRight className=\"size-4\" aria-hidden=\"true\" />\n )}\n </button>\n </td>\n <td className=\"px-4 py-3 align-top\">\n <p className=\"whitespace-nowrap font-medium text-text-primary\">\n {ENTITY_TYPE_LABELS[proposal.entityType]}\n </p>\n <p className=\"font-mono text-xs text-text-muted\">{proposal.entityId}</p>\n </td>\n <td className=\"whitespace-nowrap px-4 py-3 align-top font-mono text-xs text-text-secondary\">\n {proposal.fieldPath}\n </td>\n <td className=\"max-w-[14rem] break-words px-4 py-3 align-top text-text-secondary\">\n {proposal.currentValue ?? (\n <span className=\"text-text-muted\">Not recorded</span>\n )}\n </td>\n <td className=\"max-w-[14rem] break-words px-4 py-3 align-top font-medium text-text-primary\">\n {proposal.proposedValue}\n </td>\n <td className=\"whitespace-nowrap px-4 py-3 align-top text-text-secondary\">\n {formatDateTime(proposal.submittedAt)}\n </td>\n <td className=\"px-4 py-3 align-top\">\n <StatusBadge status={proposal.status} />\n </td>\n <td className=\"px-4 py-3 align-top\">\n <div className=\"flex flex-wrap justify-end gap-1.5\">\n {open ? (\n <>\n {proposal.status === 'SUBMITTED' && (\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() =>\n setPending({ proposal, decision: 'UNDER_REVIEW' })\n }\n disabled={reviewProposal.isPending}\n >\n Review\n </Button>\n )}\n <Button\n variant=\"outline\"\n size=\"sm\"\n aria-label=\"Accept correction\"\n onClick={() => setPending({ proposal, decision: 'ACCEPTED' })}\n disabled={reviewProposal.isPending}\n >\n <Check className=\"h-4 w-4\" aria-hidden=\"true\" />\n </Button>\n <Button\n variant=\"outline\"\n size=\"sm\"\n aria-label=\"Reject correction\"\n onClick={() => setPending({ proposal, decision: 'REJECTED' })}\n disabled={reviewProposal.isPending}\n >\n <X className=\"h-4 w-4\" aria-hidden=\"true\" />\n </Button>\n </>\n ) : (\n <span className=\"whitespace-nowrap text-xs text-text-muted\">\n {proposal.reviewedAt\n ? `Decided ${formatRelativeTime(proposal.reviewedAt)}`\n : '—'}\n </span>\n )}\n </div>\n </td>\n </tr>\n {expanded && (\n <tr className=\"bg-bg-sunken\">\n <td colSpan={8} className=\"px-4 py-4\">\n <ProposalDetail proposal={proposal} />\n </td>\n </tr>\n )}\n </Fragment>\n );\n })}\n </tbody>\n </table>\n </div>\n\n <div className=\"px-5 pb-4\">\n <Pagination\n page={pager.page}\n pageSize={PAGE_SIZE}\n itemCount={proposals.length}\n hasMore={data?.pageInfo.hasMore ?? false}\n onPageChange={(target) => {\n pager.onPageChange(target, data?.pageInfo.cursor);\n setExpandedId(null);\n }}\n />\n </div>\n </>\n )}\n\n {pending && (\n <ConfirmDialog\n open\n onOpenChange={(next) => {\n if (!next) setPending(null);\n }}\n title={REVIEW_COPY[pending.decision].title}\n description={REVIEW_COPY[pending.decision].description}\n confirmLabel={REVIEW_COPY[pending.decision].label}\n destructive={pending.decision === 'REJECTED'}\n reason={{\n label: 'Review note',\n placeholder:\n pending.decision === 'REJECTED'\n ? 'Explain what the evidence did not establish…'\n : 'Optional note recorded against the proposal…',\n required: pending.decision === 'REJECTED',\n }}\n onConfirm={confirmReview}\n />\n )}\n </SectionCard>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Expanded proposal detail\n// ---------------------------------------------------------------------------\n\nconst ProposalDetail: FC<{ proposal: GovDataChangeProposal }> = ({ proposal }) => (\n <div className=\"grid gap-4 md:grid-cols-2\">\n <div>\n <p className=\"mb-1 text-xs font-medium uppercase tracking-wide text-text-muted\">Rationale</p>\n <p className=\"whitespace-pre-wrap text-sm text-text-primary\">{proposal.rationale}</p>\n </div>\n <div className=\"space-y-3\">\n <div>\n <p className=\"mb-1 text-xs font-medium uppercase tracking-wide text-text-muted\">Evidence</p>\n {proposal.evidenceUrl ? (\n <a\n href={proposal.evidenceUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1.5 break-all text-sm text-action-primary-text hover:underline\"\n >\n <ExternalLink className=\"size-3.5 shrink-0\" aria-hidden=\"true\" />\n {proposal.evidenceUrl}\n </a>\n ) : (\n <p className=\"text-sm text-text-muted\">No evidence link supplied.</p>\n )}\n {proposal.evidenceFileIds.length > 0 && (\n <ul className=\"mt-2 space-y-1.5\">\n {proposal.evidenceFileIds.map((fileId) => (\n <li key={fileId}>\n <EvidenceFileLink fileId={fileId} />\n </li>\n ))}\n </ul>\n )}\n </div>\n\n {(proposal.reviewNote || proposal.reviewedAt) && (\n <div>\n <p className=\"mb-1 text-xs font-medium uppercase tracking-wide text-text-muted\">\n Recorded decision\n </p>\n <p className=\"text-sm text-text-secondary\">\n {proposal.status === 'ACCEPTED' ? 'Accepted' : 'Reviewed'}\n {proposal.reviewedAt ? ` on ${formatDateTime(proposal.reviewedAt)}` : ''}\n {proposal.appliedAt\n ? ' · acceptance stamped — the value is applied separately through the record’s own edit form'\n : ''}\n </p>\n {proposal.reviewNote && (\n <p className=\"mt-1 whitespace-pre-wrap text-sm text-text-primary\">\n {proposal.reviewNote}\n </p>\n )}\n </div>\n )}\n </div>\n </div>\n);\n\n/** Resolves one evidence file id to a presigned link through wspace-files-svc. */\nconst EvidenceFileLink: FC<{ fileId: string }> = ({ fileId }) => {\n const { data: url, isLoading, isError } = useFileUrl(fileId);\n\n if (isLoading) {\n return <Skeleton className=\"h-4 w-40 rounded\" />;\n }\n if (isError || !url) {\n return (\n <span className=\"inline-flex items-center gap-1.5 text-sm text-text-muted\">\n <Paperclip className=\"size-3.5\" aria-hidden=\"true\" />\n <span className=\"font-mono text-xs\">{fileId}</span>\n <span className=\"text-status-error-text\">(link unavailable)</span>\n </span>\n );\n }\n return (\n <a\n href={url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1.5 text-sm text-action-primary-text hover:underline\"\n >\n <Paperclip className=\"size-3.5 shrink-0\" aria-hidden=\"true\" />\n Attached evidence\n <span className=\"font-mono text-xs text-text-muted\">{fileId.slice(0, 8)}</span>\n </a>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8EA,IAAM,IAAY,IAGZ,KAAkB,8BAGlB,KAAqC;CACzC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GAEM,IAAyD;CAC7D,cAAc;CACd,UAAU;CACV,qBAAqB;CACrB,QAAQ;CACR,aAAa;CACb,SAAS;CACT,mBAAmB;CACnB,iBAAiB;CACjB,cAAc;CACd,UAAU;CACV,iBAAiB;CACjB,SAAS;CACT,OAAO;AACT,GAEM,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