feature: add email in sorts fields

This commit is contained in:
Sammy Teillet 2023-04-24 14:56:20 +02:00
parent a5909bd6ff
commit 6e353f590c
No known key found for this signature in database
GPG Key ID: 687E513E74D28696
2 changed files with 22 additions and 11 deletions

View File

@ -59,7 +59,7 @@ function TableHeader({
label: 'Created at',
order: 'asc',
id: sortId,
} as SortType,
} satisfies SortType,
];
setSorts(newSorts);
onSortsUpdate && onSortsUpdate(newSorts);

View File

@ -1,4 +1,9 @@
import { faUser, faList, faCalendar } from '@fortawesome/pro-regular-svg-icons';
import {
faUser,
faList,
faCalendar,
faEnvelope,
} from '@fortawesome/pro-regular-svg-icons';
import WithTopBarContainer from '../../layout/containers/WithTopBarContainer';
import Table from '../../components/table/Table';
import styled from '@emotion/styled';
@ -27,6 +32,21 @@ const reduceSortsToOrderBy = (sorts: Array<SortType>): OrderBy[] => {
return [mappedSorts];
};
const sortsAvailable: Array<SortType<keyof GraphqlPerson>> = [
{
id: 'created_at',
label: 'Created at',
order: 'asc',
icon: faCalendar,
},
{
id: 'email',
label: 'Email',
order: 'asc',
icon: faEnvelope,
},
];
function People() {
const [, setSorts] = useState([] as Array<SortType>);
const [orderBy, setOrderBy] = useState(defaultOrderBy);
@ -38,15 +58,6 @@ function People() {
const { data } = usePeopleQuery(orderBy);
const sortsAvailable: Array<SortType<keyof GraphqlPerson>> = [
{
id: 'created_at',
label: 'Created at',
order: 'asc',
icon: faCalendar,
},
];
return (
<WithTopBarContainer title="People" icon={faUser}>
<StyledPeopleContainer>