import React from "react"; import {useSelector} from "react-redux"; import {selectUserAge, selectUserGender, selectUserUpkAnswers, selectUserZip} from "@/models/userUpkAnswerSlice.ts"; import {titleCase} from "@/lib/utils.ts"; import {Card, CardContent, CardHeader} from "@/components/ui/card"; import {Calendar, MapPin, User} from "lucide-react"; import {BucketTask} from "@/api"; import {ColumnDef, flexRender, getCoreRowModel, useReactTable} from "@tanstack/react-table"; import {Table, TableBody, TableCell, TableHead, TableHeader, TableRow} from "@/components/ui/table.tsx"; export const UpkGrid = () => { const columns: ColumnDef[] = [ { accessorKey: "property_label", header: "Label", }, { accessorKey: "answer", header: "Answer", cell: ({getValue}) => getValue()[0].value ?? getValue()[0].label }, ] const data = useSelector(selectUserUpkAnswers) const table = useReactTable({ data, columns, getCoreRowModel: getCoreRowModel(), }) return (
{table.getHeaderGroups().map((headerGroup) => ( {headerGroup.headers.map((header) => { return ( {header.isPlaceholder ? null : flexRender( header.column.columnDef.header, header.getContext() )} ) })} ))} { table.getRowModel().rows.map((row) => ( {row.getVisibleCells().map((cell) => ( {flexRender(cell.column.columnDef.cell, cell.getContext())} ))} )) }
) } export const ContactCard = () => { const age = useSelector(selectUserAge) const zip = useSelector(selectUserZip) const gender = useSelector(selectUserGender) return (
{titleCase(gender as string) ?? " - "}
{age ?? " - "} years old
{zip ?? " - "}
); }; const Demographics = () => { return ( <> ) } export { Demographics }