Assets list - Very long empty page (#2159)

Co-authored-by: Fernando <fernando.greco@gmail.com>
This commit is contained in:
Mati Dastugue 2021-04-15 20:11:22 -03:00 committed by GitHub
parent 44a646e789
commit b8de127c42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,7 +36,7 @@ const styles = {
}, },
} }
const FIXED_HEIGHT = 49 const FIXED_EMPTY_HEIGHT = 255
const backProps = { const backProps = {
'aria-label': 'Previous Page', 'aria-label': 'Previous Page',
@ -101,8 +101,8 @@ class GnoTable extends React.Component<any, any> {
})) }))
} }
getEmptyStyle = (emptyRows) => ({ getEmptyStyle = () => ({
height: FIXED_HEIGHT * emptyRows, height: `calc(100vh - ${FIXED_EMPTY_HEIGHT}px)`,
borderTopRightRadius: sm, borderTopRightRadius: sm,
borderTopLeftRadius: sm, borderTopLeftRadius: sm,
backgroundColor: 'white', backgroundColor: 'white',
@ -155,7 +155,6 @@ class GnoTable extends React.Component<any, any> {
sortedData = sortedData.slice(page * displayRows, page * displayRows + displayRows) sortedData = sortedData.slice(page * displayRows, page * displayRows + displayRows)
} }
const emptyRows = displayRows - Math.min(displayRows, data.size - page * displayRows)
const isEmpty = size === 0 && !disableLoadingOnEmptyTable const isEmpty = size === 0 && !disableLoadingOnEmptyTable
return ( return (
@ -167,7 +166,7 @@ class GnoTable extends React.Component<any, any> {
</Table> </Table>
)} )}
{isEmpty && ( {isEmpty && (
<Row className={classes.loader} style={this.getEmptyStyle(emptyRows + 1)}> <Row className={classes.loader} style={this.getEmptyStyle()}>
<Loader size="sm" /> <Loader size="sm" />
</Row> </Row>
)} )}