mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-06 00:07:44 +01:00
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
|
import { ArchiveTable } from './ArchiveTable/ArchiveTable';
|
||
|
import { useSearchParams } from 'react-router-dom';
|
||
|
import { useLocalStorage } from '../../hooks/useLocalStorage';
|
||
|
import { SortingRule } from 'react-table';
|
||
|
import { useProjectFeaturesArchive } from '../../hooks/api/getters/useProjectFeaturesArchive/useProjectFeaturesArchive';
|
||
|
|
||
|
const defaultSort: SortingRule<string> = { id: 'archivedAt', desc: true };
|
||
|
|
||
|
interface IProjectFeaturesTable {
|
||
|
projectId: string;
|
||
|
}
|
||
|
|
||
|
export const ProjectFeaturesArchiveTable = ({
|
||
|
projectId,
|
||
|
}: IProjectFeaturesTable) => {
|
||
|
const {
|
||
|
archivedFeatures = [],
|
||
|
refetchArchived,
|
||
|
loading,
|
||
|
} = useProjectFeaturesArchive(projectId);
|
||
|
|
||
|
const [searchParams, setSearchParams] = useSearchParams();
|
||
|
const [storedParams, setStoredParams] = useLocalStorage(
|
||
|
'ProjectFeaturesArchiveTable:v1',
|
||
|
defaultSort
|
||
|
);
|
||
|
|
||
|
return (
|
||
|
<ArchiveTable
|
||
|
archivedFeatures={archivedFeatures}
|
||
|
loading={loading}
|
||
|
searchParams={searchParams}
|
||
|
setSearchParams={setSearchParams}
|
||
|
storedParams={storedParams}
|
||
|
setStoredParams={setStoredParams}
|
||
|
refetch={refetchArchived}
|
||
|
inProject={true}
|
||
|
/>
|
||
|
);
|
||
|
};
|