diff options
Diffstat (limited to 'modern/src/reports/StatisticsPage.js')
-rw-r--r-- | modern/src/reports/StatisticsPage.js | 58 |
1 files changed, 35 insertions, 23 deletions
diff --git a/modern/src/reports/StatisticsPage.js b/modern/src/reports/StatisticsPage.js index b9b14902..bb9926f7 100644 --- a/modern/src/reports/StatisticsPage.js +++ b/modern/src/reports/StatisticsPage.js @@ -1,7 +1,8 @@ import React, { useState } from 'react'; import { - TableContainer, Table, TableRow, TableCell, TableHead, TableBody, + Table, TableRow, TableCell, TableHead, TableBody, } from '@mui/material'; +import { makeStyles } from '@mui/styles'; import { formatDate } from '../common/util/formatter'; import { useTranslation } from '../common/components/LocalizationProvider'; import PageLayout from '../common/components/PageLayout'; @@ -25,7 +26,18 @@ const columnsArray = [ ]; const columnsMap = new Map(columnsArray); +const useStyles = makeStyles(() => ({ + header: { + position: 'sticky', + left: 0, + display: 'flex', + flexDirection: 'column', + alignItems: 'stretch', + }, +})); + const StatisticsPage = () => { + const classes = useStyles(); const t = useTranslation(); const [columns, setColumns] = usePersistedState('statisticsColumns', ['captureTime', 'activeUsers', 'activeDevices', 'messagesStored']); @@ -43,29 +55,29 @@ const StatisticsPage = () => { return ( <PageLayout menu={<ReportsMenu />} breadcrumbs={['reportTitle', 'statisticsTitle']}> - <ReportFilter handleSubmit={handleSubmit} showOnly ignoreDevice> - <ColumnSelect columns={columns} setColumns={setColumns} columnsArray={columnsArray} /> - </ReportFilter> - <TableContainer> - <Table> - <TableHead> - <TableRow> - {columns.map((key) => (<TableCell key={key}>{t(columnsMap.get(key))}</TableCell>))} + <div className={classes.header}> + <ReportFilter handleSubmit={handleSubmit} showOnly ignoreDevice> + <ColumnSelect columns={columns} setColumns={setColumns} columnsArray={columnsArray} /> + </ReportFilter> + </div> + <Table> + <TableHead> + <TableRow> + {columns.map((key) => (<TableCell key={key}>{t(columnsMap.get(key))}</TableCell>))} + </TableRow> + </TableHead> + <TableBody> + {items.map((item) => ( + <TableRow key={item.id}> + {columns.map((key) => ( + <TableCell key={key}> + {key === 'captureTime' ? formatDate(item[key]) : item[key]} + </TableCell> + ))} </TableRow> - </TableHead> - <TableBody> - {items.map((item) => ( - <TableRow key={item.id}> - {columns.map((key) => ( - <TableCell key={key}> - {key === 'captureTime' ? formatDate(item[key]) : item[key]} - </TableCell> - ))} - </TableRow> - ))} - </TableBody> - </Table> - </TableContainer> + ))} + </TableBody> + </Table> </PageLayout> ); }; |