1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

fix: simplified empty archive list page

This commit is contained in:
Tymoteusz Czech 2022-06-14 11:28:40 +02:00
parent 349106a2be
commit 7bfe7201c0

View File

@ -283,86 +283,79 @@ export const ArchiveTable = ({
/> />
} }
> >
<SearchHighlightProvider value={getSearchText(searchValue)}>
<Table
{...getTableProps()}
rowHeight={rowHeight}
style={{
height:
rowHeight * rows.length +
theme.shape.tableRowHeightCompact,
}}
>
<SortableTableHeader
headerGroups={headerGroups as any}
flex
/>
<TableBody {...getTableBodyProps()}>
{rows.map((row, index) => {
const isVirtual =
index < firstRenderedIndex ||
index > lastRenderedIndex;
if (isVirtual) {
return null;
}
prepareRow(row);
return (
<TableRow
hover
{...row.getRowProps()}
style={{
display: 'flex',
top:
index * rowHeight +
theme.shape.tableRowHeightCompact,
}}
className={classes.row}
>
{row.cells.map(cell => (
<TableCell
{...cell.getCellProps({
style: {
flex: cell.column.minWidth
? '1 0 auto'
: undefined,
},
})}
className={classes.cell}
>
{cell.render('Cell')}
</TableCell>
))}
</TableRow>
);
})}
</TableBody>
</Table>
</SearchHighlightProvider>
<ConditionallyRender <ConditionallyRender
condition={!loading && data.length === 0} condition={rows.length === 0 && searchValue?.length > 0}
show={<TablePlaceholder />} show={
elseShow={() => ( <TablePlaceholder>
<> No feature toggles found matching &ldquo;
<SearchHighlightProvider {searchValue}&rdquo;
value={getSearchText(searchValue)} </TablePlaceholder>
> }
<Table />
{...getTableProps()} <ConditionallyRender
rowHeight={rowHeight} condition={rows.length === 0 && searchValue?.length === 0}
style={{ show={
height: <TablePlaceholder>
rowHeight * rows.length + None of the feature toggles where archived yet.
theme.shape.tableRowHeightCompact, </TablePlaceholder>
}} }
>
<SortableTableHeader
headerGroups={headerGroups as any}
flex
/>
<TableBody {...getTableBodyProps()}>
{rows.map((row, index) => {
const isVirtual =
index < firstRenderedIndex ||
index > lastRenderedIndex;
if (isVirtual) {
return null;
}
prepareRow(row);
return (
<TableRow
hover
{...row.getRowProps()}
style={{
display: 'flex',
top:
index * rowHeight +
theme.shape
.tableRowHeightCompact,
}}
className={classes.row}
>
{row.cells.map(cell => (
<TableCell
{...cell.getCellProps({
style: {
flex: cell
.column
.minWidth
? '1 0 auto'
: undefined,
},
})}
className={classes.cell}
>
{cell.render('Cell')}
</TableCell>
))}
</TableRow>
);
})}
</TableBody>
</Table>
</SearchHighlightProvider>
<ConditionallyRender
condition={
rows.length === 0 && searchValue?.length > 0
}
show={
<TablePlaceholder>
No feature toggles found matching &ldquo;
{searchValue}&rdquo;
</TablePlaceholder>
}
/>
</>
)}
/> />
</PageContent> </PageContent>
); );