Add all filters to tables + make column width fixed (#133)

* Add additional filters on companies and people page

* Make colunn width fixed

* Remove duplicate declaration of Unknown type
This commit is contained in:
Charles Bochet
2023-05-21 22:47:18 +02:00
committed by GitHub
parent 3370499ad8
commit 67353eda8e
13 changed files with 214 additions and 86 deletions

View File

@ -1,7 +1,10 @@
import { gql, useQuery } from '@apollo/client';
import { useMemo, useState } from 'react';
import { SearchConfigType } from '../../../interfaces/search/interface';
import { AnyEntity } from '../../../interfaces/entities/generic.interface';
import {
AnyEntity,
UnknownType,
} from '../../../interfaces/entities/generic.interface';
export const SEARCH_PEOPLE_QUERY = gql`
query SearchPeopleQuery($where: people_bool_exp, $limit: Int) {
@ -58,15 +61,16 @@ const debounce = <FuncArgs extends any[]>(
};
};
export type SearchResultsType<T extends AnyEntity = AnyEntity> = {
results: {
render: (value: T) => string;
value: T;
}[];
loading: boolean;
};
export type SearchResultsType<T extends AnyEntity | UnknownType = UnknownType> =
{
results: {
render: (value: T) => string;
value: T;
}[];
loading: boolean;
};
export const useSearch = <T extends AnyEntity = AnyEntity>(): [
export const useSearch = <T extends AnyEntity | UnknownType = UnknownType>(): [
SearchResultsType<T>,
React.Dispatch<React.SetStateAction<string>>,
React.Dispatch<React.SetStateAction<SearchConfigType<T> | null>>,