2022-06-06 11:12:28 +02:00
|
|
|
import { ArchiveTable } from './ArchiveTable/ArchiveTable';
|
|
|
|
import { SortingRule } from 'react-table';
|
2022-06-15 15:16:42 +02:00
|
|
|
import { useProjectFeaturesArchive } from 'hooks/api/getters/useProjectFeaturesArchive/useProjectFeaturesArchive';
|
2022-06-10 08:34:42 +02:00
|
|
|
import { createLocalStorage } from 'utils/createLocalStorage';
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
export const ProjectFeaturesArchiveTable = ({
|
|
|
|
projectId,
|
|
|
|
}: IProjectFeaturesTable) => {
|
|
|
|
const {
|
|
|
|
archivedFeatures = [],
|
|
|
|
refetchArchived,
|
|
|
|
loading,
|
|
|
|
} = useProjectFeaturesArchive(projectId);
|
|
|
|
|
2022-06-10 08:34:42 +02:00
|
|
|
const { value, setValue } = createLocalStorage(
|
2022-06-08 12:26:41 +02:00
|
|
|
`${projectId}:ProjectFeaturesArchiveTable`,
|
2022-06-06 11:12:28 +02:00
|
|
|
defaultSort
|
|
|
|
);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ArchiveTable
|
2022-06-21 09:08:37 +02:00
|
|
|
title="Project archive"
|
2022-06-06 11:12:28 +02:00
|
|
|
archivedFeatures={archivedFeatures}
|
|
|
|
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
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|