1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-01 00:08:27 +01:00
unleash.unleash/frontend/src/component/archive/FeaturesArchiveTable.tsx

37 lines
1.1 KiB
TypeScript
Raw Normal View History

2022-06-06 11:12:28 +02:00
import { useFeaturesArchive } from '../../hooks/api/getters/useFeaturesArchive/useFeaturesArchive';
import { ArchiveTable } from './ArchiveTable/ArchiveTable';
import { useSearchParams } from 'react-router-dom';
import { SortingRule } from 'react-table';
2022-06-10 08:34:42 +02:00
import { usePageTitle } from 'hooks/usePageTitle';
import { createLocalStorage } from 'utils/createLocalStorage';
2022-06-06 11:12:28 +02:00
const defaultSort: SortingRule<string> = { id: 'createdAt', desc: true };
export const FeaturesArchiveTable = () => {
2022-06-07 10:54:16 +02:00
usePageTitle('Archived');
2022-06-06 11:12:28 +02:00
const {
archivedFeatures = [],
loading,
refetchArchived,
} = useFeaturesArchive();
const [searchParams, setSearchParams] = useSearchParams();
2022-06-10 08:34:42 +02:00
const { value, setValue } = createLocalStorage(
2022-06-06 11:12:28 +02:00
'FeaturesArchiveTable:v1',
defaultSort
);
return (
<ArchiveTable
2022-06-10 15:04:06 +02:00
title="Archived"
2022-06-06 11:12:28 +02:00
archivedFeatures={archivedFeatures}
loading={loading}
searchParams={searchParams}
setSearchParams={setSearchParams}
2022-06-10 08:34:42 +02:00
storedParams={value}
setStoredParams={setValue}
2022-06-06 11:12:28 +02:00
refetch={refetchArchived}
/>
);
};