diff --git a/frontend/src/components/locations/LocationsPage.tsx b/frontend/src/components/locations/LocationsPage.tsx index 3bc6206..36a7238 100644 --- a/frontend/src/components/locations/LocationsPage.tsx +++ b/frontend/src/components/locations/LocationsPage.tsx @@ -356,6 +356,17 @@ export default function LocationsPage() { sortDir={sortDir} onSort={handleSort} visibilityMode={visibilityMode} + mobileCardRender={(location) => ( +
+
+ {location.name} + {location.category && {location.category}} +
+ {location.address && ( +

{location.address}

+ )} +
+ )} /> )} diff --git a/frontend/src/components/people/PeoplePage.tsx b/frontend/src/components/people/PeoplePage.tsx index 133240e..d51cc3c 100644 --- a/frontend/src/components/people/PeoplePage.tsx +++ b/frontend/src/components/people/PeoplePage.tsx @@ -744,6 +744,18 @@ export default function PeoplePage() { sortDir={sortDir} onSort={handleSort} visibilityMode={visibilityMode} + mobileCardRender={(person) => ( +
+
+ {person.name} + {person.category && {person.category}} +
+
+ {person.email && {person.email}} + {person.phone && {person.phone}} +
+
+ )} /> )} diff --git a/frontend/src/components/shared/EntityTable.tsx b/frontend/src/components/shared/EntityTable.tsx index de4a244..e6ccf27 100644 --- a/frontend/src/components/shared/EntityTable.tsx +++ b/frontend/src/components/shared/EntityTable.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { ArrowUpDown, ArrowUp, ArrowDown } from 'lucide-react'; import type { VisibilityMode } from '@/hooks/useTableVisibility'; +import { useMediaQuery } from '@/hooks/useMediaQuery'; export interface ColumnDef { key: string; @@ -28,6 +29,7 @@ interface EntityTableProps { onSort: (key: string) => void; visibilityMode: VisibilityMode; loading?: boolean; + mobileCardRender?: (item: T) => React.ReactNode; } const LEVEL_ORDER: VisibilityMode[] = ['essential', 'filtered', 'all']; @@ -127,10 +129,51 @@ export function EntityTable({ onSort, visibilityMode, loading = false, + mobileCardRender, }: EntityTableProps) { const visibleColumns = columns.filter((col) => isVisible(col.visibilityLevel, visibilityMode)); const colCount = visibleColumns.length; const showPinnedSection = showPinned && pinnedRows.length > 0; + const isMobile = useMediaQuery('(max-width: 767px)'); + + if (isMobile && mobileCardRender) { + return ( +
+ {loading ? ( + Array.from({ length: 6 }).map((_, i) => ( +
+ )) + ) : ( + <> + {showPinnedSection && ( + <> +

{pinnedLabel}

+ {pinnedRows.map((item) => ( +
onRowClick(item.id)} className="cursor-pointer"> + {mobileCardRender(item)} +
+ ))} + + )} + {groups.map((group) => ( + + {group.rows.length > 0 && ( + <> +

{group.label}

+ {group.rows.map((item) => ( +
onRowClick(item.id)} className="cursor-pointer"> + {mobileCardRender(item)} +
+ ))} + + )} +
+ ))} + + )} +
+ ); + } return (