feat: persist view sorts (#1154)

Closes #1122
This commit is contained in:
Thaïs
2023-08-10 19:10:02 +02:00
committed by GitHub
parent 6b3a538c07
commit 80a562d90d
29 changed files with 991 additions and 103 deletions

View File

@ -8,7 +8,7 @@ import {
} from '@/ui/icon/index';
import { CompanyOrderByWithRelationInput as Companies_Order_By } from '~/generated/graphql';
export const availableSorts = [
export const availableSorts: SortType<Companies_Order_By>[] = [
{
key: 'name',
label: 'Name',
@ -34,4 +34,4 @@ export const availableSorts = [
label: 'Creation',
icon: <IconCalendarEvent size={16} />,
},
] satisfies Array<SortType<Companies_Order_By>>;
];

View File

@ -12,19 +12,15 @@ import {
SortOrder as Order_By,
} from '~/generated/graphql';
export const availableSorts = [
export const availableSorts: SortType<People_Order_By>[] = [
{
key: 'fullname',
label: 'People',
icon: <IconUser size={16} />,
orderByTemplates: [
(order: Order_By) => ({
firstName: order,
}),
(order: Order_By) => ({
lastName: order,
}),
orderByTemplate: (order: Order_By) => [
{ firstName: order },
{ lastName: order },
],
},
{
@ -32,7 +28,7 @@ export const availableSorts = [
label: 'Company',
icon: <IconBuildingSkyscraper size={16} />,
orderByTemplates: [(order: Order_By) => ({ company: { name: order } })],
orderByTemplate: (order: Order_By) => [{ company: { name: order } }],
},
{
key: 'email',
@ -54,4 +50,4 @@ export const availableSorts = [
label: 'City',
icon: <IconMap size={16} />,
},
] satisfies Array<SortType<People_Order_By>>;
];