1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-06 00:07:44 +01:00
unleash.unleash/frontend/src/component/archive/ProjectFeaturesArchiveTable.tsx

36 lines
1.0 KiB
TypeScript
Raw Normal View History

2023-01-05 11:57:53 +01:00
import { useFeaturesArchive } from 'hooks/api/getters/useFeaturesArchive/useFeaturesArchive';
import { VFC } from 'react';
2022-06-06 11:12:28 +02:00
import { SortingRule } from 'react-table';
2022-06-10 08:34:42 +02:00
import { createLocalStorage } from 'utils/createLocalStorage';
2023-01-05 11:57:53 +01:00
import { ArchiveTable } from './ArchiveTable/ArchiveTable';
2022-06-06 11:12:28 +02:00
const defaultSort: SortingRule<string> = { id: 'archivedAt' };
2022-06-06 11:12:28 +02:00
interface IProjectFeaturesTable {
projectId: string;
}
2023-01-05 11:57:53 +01:00
export const ProjectFeaturesArchiveTable: VFC<IProjectFeaturesTable> = ({
2022-06-06 11:12:28 +02:00
projectId,
2023-01-05 11:57:53 +01:00
}) => {
const { archivedFeatures, loading, refetchArchived } =
useFeaturesArchive(projectId);
2022-06-06 11:12:28 +02:00
2022-06-10 08:34:42 +02:00
const { value, setValue } = createLocalStorage(
2022-06-08 12:26:41 +02:00
`${projectId}:ProjectFeaturesArchiveTable`,
defaultSort,
2022-06-06 11:12:28 +02:00
);
return (
<ArchiveTable
title='Project archive'
2023-01-05 11:57:53 +01:00
archivedFeatures={archivedFeatures || []}
2022-06-06 11:12:28 +02:00
loading={loading}
2022-06-10 08:34:42 +02:00
storedParams={value}
setStoredParams={setValue}
2022-06-06 11:12:28 +02:00
refetch={refetchArchived}
2022-06-14 09:19:41 +02:00
projectId={projectId}
2022-06-06 11:12:28 +02:00
/>
);
};