diff --git a/frontend-v2/src/app/(authed)/activists/activists-table.tsx b/frontend-v2/src/app/(authed)/activists/activists-table.tsx index 7fc2b2e7..58fa1017 100644 --- a/frontend-v2/src/app/(authed)/activists/activists-table.tsx +++ b/frontend-v2/src/app/(authed)/activists/activists-table.tsx @@ -15,12 +15,12 @@ import { TableHeader, TableRow, } from '@/components/ui/table' -import { ArrowDown, ArrowUp } from 'lucide-react' +import { ArrowDown, ArrowUp, Check, Minus } from 'lucide-react' import { ActivistJSON, ActivistColumnName } from '@/lib/api' import { IntentPrefetchLink } from '@/components/intent-prefetch-link' import { COLUMN_DEFINITION_BY_NAME } from './column-definitions' import { getActivistDisplayName } from './display-name' -import { formatValue } from './format-value' +import { formatValue, COLUMN_TYPE_BY_NAME } from './format-value' import type { SortColumn } from './query-state' interface ActivistTableProps { @@ -101,6 +101,17 @@ export function ActivistTable({ } const value = row.original[colName as keyof ActivistJSON] + if (COLUMN_TYPE_BY_NAME[colName] === 'boolean') { + return ( +
+ {value ? ( + + ) : ( + + )} +
+ ) + } const formatted = formatValue(value, colName) return
{formatted}
}, @@ -199,28 +210,36 @@ export function ActivistTable({ {visibleColumns.map((colName) => { const definition = COLUMN_DEFINITION_BY_NAME[colName] const label = definition?.label || colName - const formattedValue = - colName === 'name' + const isBool = COLUMN_TYPE_BY_NAME[colName] === 'boolean' + const rawValue = activist[colName as keyof ActivistJSON] + const formattedValue = isBool + ? null + : colName === 'name' ? displayName.text - : formatValue( - activist[colName as keyof ActivistJSON], - colName, - ) + : formatValue(rawValue, colName) return (
{label}: - - {formattedValue} - + {isBool ? ( + rawValue ? ( + + ) : ( + + ) + ) : ( + + {formattedValue} + + )}
) })} diff --git a/frontend-v2/src/app/(authed)/activists/format-value.ts b/frontend-v2/src/app/(authed)/activists/format-value.ts index 633fbd68..e001e4fb 100644 --- a/frontend-v2/src/app/(authed)/activists/format-value.ts +++ b/frontend-v2/src/app/(authed)/activists/format-value.ts @@ -5,7 +5,7 @@ import { formatDateValueForActivists } from './date-time' type ColumnType = 'string' | 'number' | 'boolean' -const COLUMN_TYPE_BY_NAME = Object.fromEntries( +export const COLUMN_TYPE_BY_NAME = Object.fromEntries( Object.entries(ActivistJSON.shape).map(([columnName, schema]) => { const unwrapped = schema instanceof z.ZodOptional || schema instanceof z.ZodNullable