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 {
|
import { faUser, faList } from '@fortawesome/pro-regular-svg-icons';
|
||||||
faUser,
|
|
||||||
faList,
|
|
||||||
faCalendar,
|
|
||||||
faEnvelope,
|
|
||||||
} from '@fortawesome/pro-regular-svg-icons';
|
|
||||||
import WithTopBarContainer from '../../layout/containers/WithTopBarContainer';
|
import WithTopBarContainer from '../../layout/containers/WithTopBarContainer';
|
||||||
import Table from '../../components/table/Table';
|
import Table from '../../components/table/Table';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { peopleColumns } from './people-table';
|
import { peopleColumns, sortsAvailable } from './people-table';
|
||||||
import { GraphqlPerson, mapPerson } from '../../interfaces/person.interface';
|
import { mapPerson } from '../../interfaces/person.interface';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { SortType } from '../../components/table/table-header/SortAndFilterBar';
|
import { SortType } from '../../components/table/table-header/SortAndFilterBar';
|
||||||
import { OrderBy, usePeopleQuery } from '../../services/people';
|
import { OrderBy, usePeopleQuery } from '../../services/people';
|
||||||
@ -32,21 +27,6 @@ const reduceSortsToOrderBy = (sorts: Array<SortType>): OrderBy[] => {
|
|||||||
return [mappedSorts];
|
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() {
|
function People() {
|
||||||
const [, setSorts] = useState([] as Array<SortType>);
|
const [, setSorts] = useState([] as Array<SortType>);
|
||||||
const [orderBy, setOrderBy] = useState(defaultOrderBy);
|
const [orderBy, setOrderBy] = useState(defaultOrderBy);
|
||||||
|
@ -15,8 +15,24 @@ import Checkbox from '../../components/form/Checkbox';
|
|||||||
import HorizontalyAlignedContainer from '../../layout/containers/HorizontalyAlignedContainer';
|
import HorizontalyAlignedContainer from '../../layout/containers/HorizontalyAlignedContainer';
|
||||||
import CompanyChip from '../../components/chips/CompanyChip';
|
import CompanyChip from '../../components/chips/CompanyChip';
|
||||||
import PersonChip from '../../components/chips/PersonChip';
|
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 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>();
|
const columnHelper = createColumnHelper<Person>();
|
||||||
export const peopleColumns = [
|
export const peopleColumns = [
|
||||||
|
Loading…
Reference in New Issue
Block a user