diff --git a/frontend/components/ClubEditPage/EventsCard.tsx b/frontend/components/ClubEditPage/EventsCard.tsx index 49c8970c3..67b21df50 100644 --- a/frontend/components/ClubEditPage/EventsCard.tsx +++ b/frontend/components/ClubEditPage/EventsCard.tsx @@ -292,7 +292,12 @@ const eventTableFields = [ { name: 'is_ics_event', label: 'ICS', - converter: (a: boolean): ReactElement => , + converter: (a: boolean): ReactElement => ( + + ), }, ] diff --git a/frontend/components/ClubEditPage/MembersCard.tsx b/frontend/components/ClubEditPage/MembersCard.tsx index 53ec74707..a50937225 100644 --- a/frontend/components/ClubEditPage/MembersCard.tsx +++ b/frontend/components/ClubEditPage/MembersCard.tsx @@ -104,7 +104,7 @@ export default function MembersCard({ club }: MembersCardProps): ReactElement { filterFunction: (selection, object) => object.active === selection, }, ]} - searchableColumns = {["name", "email"]} + searchableColumns={['name', 'email']} currentTitle={(obj) => obj != null ? `${obj.name} (${obj.email})` : 'Kicked Member' } diff --git a/frontend/components/ModelForm.tsx b/frontend/components/ModelForm.tsx index 4d2f2891d..d458c5cf4 100644 --- a/frontend/components/ModelForm.tsx +++ b/frontend/components/ModelForm.tsx @@ -159,9 +159,7 @@ export const ModelTable = ({ ? objects?.filter((item) => item.id === id)[0] : objects?.[id] const value = obj?.[column.name] - return obj && !(value === null) - ? renderFunction(value, obj) - : 'None' + return obj && !(value === null) ? renderFunction(value, obj) : 'None' }, } } else return column diff --git a/frontend/components/PaginatedClubDisplay.tsx b/frontend/components/PaginatedClubDisplay.tsx index a93dca49b..db61b9519 100644 --- a/frontend/components/PaginatedClubDisplay.tsx +++ b/frontend/components/PaginatedClubDisplay.tsx @@ -40,7 +40,7 @@ const PaginatedClubDisplay = ({ if (nextUrl == null) { return null } - + setLoading(true) // fetch the entry diff --git a/frontend/components/common/Table.tsx b/frontend/components/common/Table.tsx index 3db5dec88..f73fa3ba2 100644 --- a/frontend/components/common/Table.tsx +++ b/frontend/components/common/Table.tsx @@ -195,7 +195,7 @@ const Table = ({ } const handleColumnsSort = (target) => { - if (sortedColumn && (sortedColumn.name === target)) { + if (sortedColumn && sortedColumn.name === target) { if (sortedColumn.status === 'asc') { setSortedColumn({ name: target, status: 'desc' }) } else { @@ -218,7 +218,7 @@ const Table = ({ return ( - +
-
- {filterOptions && - filterOptions.map((filterOption) => ( - - + handleFilterChange({ + value: value || null, + label: filterOption.label ? filterOption.label : null, + }) + } + isClearable={true} + placeholder={`Filter by ${titleize(filterOption.label)}`} + options={filterOption.options.map((option) => { + return { value: option.key, label: option.label } + })} + /> + + ))}
- {tableData.length > 0 ? ( + {headerGroups.length > 0 ? ( {headerGroups.map((headerGroup) => ( @@ -291,35 +293,41 @@ const Table = ({ ))} - - {page.map((row) => { - prepareRow(row) - return ( - - {columns.map((column, i) => { - return ( - + {page.map((row) => { + prepareRow(row) + return ( + + {columns.map((column, i) => { + return ( + - ) - })} - - ) - })} - + )} + + ) + })} + + ) + })} + + ) : data.length === 0 ? ( +

No items to show

+ ) : ( +

No matches were found. Please change your filters.

+ )}
- {column.render ? ( - column.render(row.original.id) ? ( - column.render(row.original.id) + {tableData.length > 0 ? ( +
+ {column.render ? ( + column.render(row.original.id) ? ( + column.render(row.original.id) + ) : ( + None + ) + ) : row.original[column.name] ? ( + row.original[column.name] ) : ( None - ) - ) : row.original[column.name] ? ( - row.original[column.name] - ) : ( - None - )} -
- ) : data.length === 0 ? (

No items to show

) : ( -

No matches were found. Please change your filters.

+ ) : ( +

Nothing to Show

)} {pageOptions.length > 1 && (
@@ -334,7 +342,7 @@ const Table = ({