ENCOA-283 or ENCOA-282, I don't know someone deleted the issue
This commit is contained in:
@@ -51,12 +51,28 @@ const columns = [
|
||||
];
|
||||
|
||||
|
||||
const institutionsColumn = columnHelper.accessor('entityLabels', {
|
||||
cell: (info): string => {
|
||||
const value = info.getValue();
|
||||
if (!value || value.length === 0) {
|
||||
return 'None';
|
||||
}
|
||||
return value.join(', ');
|
||||
},
|
||||
header: () => 'Institutions',
|
||||
}) as unknown as typeof columns[0];
|
||||
|
||||
const UserTable: React.FC<{ users: UserImport[] }> = ({ users }) => {
|
||||
const [globalFilter, setGlobalFilter] = useState('');
|
||||
|
||||
const tableColumns = [...columns];
|
||||
if (users.some(user => 'entityLabels' in user)) {
|
||||
tableColumns.push(institutionsColumn);
|
||||
}
|
||||
|
||||
const table = useReactTable({
|
||||
data: users,
|
||||
columns,
|
||||
columns: tableColumns,
|
||||
getCoreRowModel: getCoreRowModel(),
|
||||
getPaginationRowModel: getPaginationRowModel(),
|
||||
getSortedRowModel: getSortedRowModel(),
|
||||
|
||||
Reference in New Issue
Block a user