From fb2005a2dfb44684811d3580c6d27a3431d0c54c Mon Sep 17 00:00:00 2001 From: andreas-unleash <104830839+andreas-unleash@users.noreply.github.com> Date: Fri, 10 Jun 2022 15:47:42 +0300 Subject: [PATCH] PR comments --- .../archive/ArchiveTable/ArchiveTable.tsx | 79 +++++++++---------- .../ReviveArchivedFeatureCell.tsx | 6 +- .../archive/FeaturesArchiveTable.tsx | 2 +- .../archive/ProjectFeaturesArchiveTable.tsx | 2 +- .../FeatureArchivedCell.tsx | 2 +- 5 files changed, 42 insertions(+), 49 deletions(-) diff --git a/frontend/src/component/archive/ArchiveTable/ArchiveTable.tsx b/frontend/src/component/archive/ArchiveTable/ArchiveTable.tsx index ec5709509c..c74f97d8cf 100644 --- a/frontend/src/component/archive/ArchiveTable/ArchiveTable.tsx +++ b/frontend/src/component/archive/ArchiveTable/ArchiveTable.tsx @@ -9,7 +9,7 @@ import { TableRow, TableSearch, } from 'component/common/Table'; -import { useFlexLayout, useSortBy, useTable } from 'react-table'; +import {SortingRule, useFlexLayout, useSortBy, useTable} from 'react-table'; import { SearchHighlightProvider } from 'component/common/Table/SearchHighlightContext/SearchHighlightContext'; import { useMediaQuery } from '@mui/material'; import { sortTypes } from 'utils/sortTypes'; @@ -32,16 +32,17 @@ import { formatUnknownError } from 'utils/formatUnknownError'; import { useSearch } from 'hooks/useSearch'; import { FeatureArchivedCell } from '../../common/Table/cells/FeatureArchivedCell/FeatureArchivedCell'; import { useVirtualizedRange } from 'hooks/useVirtualizedRange'; +import { URLSearchParamsInit } from 'react-router-dom'; export interface IFeaturesArchiveTableProps { archivedFeatures: FeatureSchema[]; title: string; - refetch: any; + refetch: () => void; loading: boolean; - storedParams: any; - setStoredParams: any; - searchParams: any; - setSearchParams: any; + storedParams: SortingRule; + setStoredParams: (newValue: (SortingRule | ((prev: SortingRule) => SortingRule))) => SortingRule; + searchParams: URLSearchParams; + setSearchParams: (nextInit: URLSearchParamsInit, navigateOptions?: ({replace?: boolean | undefined, state?: any} | undefined)) => void; } export const ArchiveTable = ({ @@ -74,7 +75,6 @@ export const ArchiveTable = ({ type: 'success', title: "And we're back!", text: 'The feature toggle has been revived.', - confetti: true, }); } catch (e: unknown) { setToastApiError(formatUnknownError(e)); @@ -164,6 +164,7 @@ export const ArchiveTable = ({ accessor: 'description', }, ], + //eslint-disable-next-line [] ); @@ -244,41 +245,6 @@ export const ArchiveTable = ({ const [firstRenderedIndex, lastRenderedIndex] = useVirtualizedRange(rowHeight); - const renderRows = () => { - return ( - <> - {rows.map((row, index) => { - const isVirtual = - index < firstRenderedIndex || index > lastRenderedIndex; - - if (isVirtual) { - return null; - } - - prepareRow(row); - return ( - - {row.cells.map(cell => ( - - {cell.render('Cell')} - - ))} - - ); - })} - - ); - }; - return ( - {renderRows()} + {rows.map((row, index) => { + const isVirtual = + index < firstRenderedIndex || index > lastRenderedIndex; + + if (isVirtual) { + return null; + } + + prepareRow(row); + return ( + + {row.cells.map(cell => ( + + {cell.render('Cell')} + + ))} + + ); + })} diff --git a/frontend/src/component/archive/ArchiveTable/ReviveArchivedFeatureCell/ReviveArchivedFeatureCell.tsx b/frontend/src/component/archive/ArchiveTable/ReviveArchivedFeatureCell/ReviveArchivedFeatureCell.tsx index 9c7d99de9f..aa22d9a8f2 100644 --- a/frontend/src/component/archive/ArchiveTable/ReviveArchivedFeatureCell/ReviveArchivedFeatureCell.tsx +++ b/frontend/src/component/archive/ArchiveTable/ReviveArchivedFeatureCell/ReviveArchivedFeatureCell.tsx @@ -1,8 +1,8 @@ import { SyntheticEvent, VFC } from 'react'; -import { ActionCell } from '../../../common/Table/cells/ActionCell/ActionCell'; +import { ActionCell } from 'component/common/Table/cells/ActionCell/ActionCell'; import { Undo } from '@mui/icons-material'; -import PermissionIconButton from '../../../common/PermissionIconButton/PermissionIconButton'; -import { UPDATE_FEATURE } from '../../../providers/AccessProvider/permissions'; +import PermissionIconButton from 'component/common/PermissionIconButton/PermissionIconButton'; +import { UPDATE_FEATURE } from 'component/providers/AccessProvider/permissions'; interface IReviveArchivedFeatureCell { onRevive: () => void; diff --git a/frontend/src/component/archive/FeaturesArchiveTable.tsx b/frontend/src/component/archive/FeaturesArchiveTable.tsx index 56d35b4070..beb6cc5a1e 100644 --- a/frontend/src/component/archive/FeaturesArchiveTable.tsx +++ b/frontend/src/component/archive/FeaturesArchiveTable.tsx @@ -23,7 +23,7 @@ export const FeaturesArchiveTable = () => { return ( = ({ arrow > - + )}