Fix Admin Interface

This commit is contained in:
Eric Gullickson
2025-11-06 20:36:31 -06:00
parent 5630979adf
commit d30c2bad8f
6 changed files with 220 additions and 57 deletions

View File

@@ -958,6 +958,16 @@ export const AdminCatalogPage: React.FC = () => {
}
}, [canViewLevel, currentLevelRequirement.message, selection]);
const formatDateValue = useCallback((value?: string) => {
if (!value) {
return '—';
}
const date = new Date(value);
return Number.isNaN(date.valueOf())
? '—'
: date.toLocaleDateString();
}, []);
const columns = useMemo<GridColumn<CatalogRow>[]>(() => {
const baseColumns: GridColumn<CatalogRow>[] = [
{
@@ -974,14 +984,14 @@ export const AdminCatalogPage: React.FC = () => {
headerName: 'Created',
sortable: true,
renderCell: (row) =>
new Date(row.createdAt).toLocaleDateString(),
formatDateValue(row.createdAt),
},
{
field: 'updatedAt',
headerName: 'Updated',
sortable: true,
renderCell: (row) =>
new Date(row.updatedAt).toLocaleDateString(),
formatDateValue(row.updatedAt),
},
{
field: 'actions',
@@ -1041,7 +1051,7 @@ export const AdminCatalogPage: React.FC = () => {
];
return baseColumns;
}, [handleDeleteSingle, handleDrillDown, openEditDialog, selection.level]);
}, [formatDateValue, handleDeleteSingle, handleDrillDown, openEditDialog, selection.level]);
const renderTree = useCallback(
(nodes: TreeNode[], depth = 0): React.ReactNode =>