mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-01 08:06:49 +03:00
refactor: move sorts in peolpe-table
This commit is contained in:
parent
99aa39f2ba
commit
19903219c3
@ -1,14 +1,9 @@
|
||||
import {
|
||||
faUser,
|
||||
faList,
|
||||
faCalendar,
|
||||
faEnvelope,
|
||||
} from '@fortawesome/pro-regular-svg-icons';
|
||||
import { faUser, faList } from '@fortawesome/pro-regular-svg-icons';
|
||||
import WithTopBarContainer from '../../layout/containers/WithTopBarContainer';
|
||||
import Table from '../../components/table/Table';
|
||||
import styled from '@emotion/styled';
|
||||
import { peopleColumns } from './people-table';
|
||||
import { GraphqlPerson, mapPerson } from '../../interfaces/person.interface';
|
||||
import { peopleColumns, sortsAvailable } from './people-table';
|
||||
import { mapPerson } from '../../interfaces/person.interface';
|
||||
import { useCallback, useState } from 'react';
|
||||
import { SortType } from '../../components/table/table-header/SortAndFilterBar';
|
||||
import { OrderBy, usePeopleQuery } from '../../services/people';
|
||||
@ -32,21 +27,6 @@ const reduceSortsToOrderBy = (sorts: Array<SortType>): OrderBy[] => {
|
||||
return [mappedSorts];
|
||||
};
|
||||
|
||||
const sortsAvailable = [
|
||||
{
|
||||
id: 'created_at',
|
||||
label: 'Created at',
|
||||
order: 'asc',
|
||||
icon: faCalendar,
|
||||
},
|
||||
{
|
||||
id: 'email',
|
||||
label: 'Email',
|
||||
order: 'asc',
|
||||
icon: faEnvelope,
|
||||
},
|
||||
] satisfies Array<SortType<keyof GraphqlPerson>>;
|
||||
|
||||
function People() {
|
||||
const [, setSorts] = useState([] as Array<SortType>);
|
||||
const [orderBy, setOrderBy] = useState(defaultOrderBy);
|
||||
|
@ -15,8 +15,24 @@ import Checkbox from '../../components/form/Checkbox';
|
||||
import HorizontalyAlignedContainer from '../../layout/containers/HorizontalyAlignedContainer';
|
||||
import CompanyChip from '../../components/chips/CompanyChip';
|
||||
import PersonChip from '../../components/chips/PersonChip';
|
||||
import { Person } from '../../interfaces/person.interface';
|
||||
import { GraphqlPerson, Person } from '../../interfaces/person.interface';
|
||||
import PipeChip from '../../components/chips/PipeChip';
|
||||
import { SortType } from '../../components/table/table-header/SortAndFilterBar';
|
||||
|
||||
export const sortsAvailable = [
|
||||
{
|
||||
id: 'created_at',
|
||||
label: 'Created at',
|
||||
order: 'asc',
|
||||
icon: faCalendar,
|
||||
},
|
||||
{
|
||||
id: 'email',
|
||||
label: 'Email',
|
||||
order: 'asc',
|
||||
icon: faEnvelope,
|
||||
},
|
||||
] satisfies Array<SortType<keyof GraphqlPerson>>;
|
||||
|
||||
const columnHelper = createColumnHelper<Person>();
|
||||
export const peopleColumns = [
|
||||
|
Loading…
Reference in New Issue
Block a user