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
|
|
|
|
2022-06-15 15:16:42 +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`,
|
2023-10-02 14:25:46 +02:00
|
|
|
defaultSort,
|
2022-06-06 11:12:28 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ArchiveTable
|
2023-10-02 14:25:46 +02:00
|
|
|
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
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|