diff options
author | Anton Tananaev <anton@traccar.org> | 2022-05-27 07:20:07 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-05-27 07:20:07 -0700 |
commit | 8e0fa926ee03a025ad284b06280132f55be22e28 (patch) | |
tree | 9f68909944f2623beb6aed44602a8961346edff8 /modern/src/reports/StopReportPage.js | |
parent | 32cb5f8d90df09fd45a54c96491bc3568f14690b (diff) | |
download | trackermap-web-8e0fa926ee03a025ad284b06280132f55be22e28.tar.gz trackermap-web-8e0fa926ee03a025ad284b06280132f55be22e28.tar.bz2 trackermap-web-8e0fa926ee03a025ad284b06280132f55be22e28.zip |
Improve page scrolling
Diffstat (limited to 'modern/src/reports/StopReportPage.js')
-rw-r--r-- | modern/src/reports/StopReportPage.js | 58 |
1 files changed, 35 insertions, 23 deletions
diff --git a/modern/src/reports/StopReportPage.js b/modern/src/reports/StopReportPage.js index 55091292..6cf8be07 100644 --- a/modern/src/reports/StopReportPage.js +++ b/modern/src/reports/StopReportPage.js @@ -1,7 +1,8 @@ import React, { useState } from 'react'; import { - Table, TableBody, TableCell, TableContainer, TableHead, TableRow, + Table, TableBody, TableCell, TableHead, TableRow, } from '@mui/material'; +import { makeStyles } from '@mui/styles'; import { formatDistance, formatHours, formatDate, formatVolume, } from '../common/util/formatter'; @@ -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 StopReportPage = () => { + const classes = useStyles(); const t = useTranslation(); const distanceUnit = useAttributePreference('distanceUnit'); @@ -73,29 +85,29 @@ const StopReportPage = () => { return ( <PageLayout menu={<ReportsMenu />} breadcrumbs={['reportTitle', 'reportStops']}> - <ReportFilter handleSubmit={handleSubmit}> - <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}> + <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.positionId}> + {columns.map((key) => ( + <TableCell key={key}> + {formatValue(item, key)} + </TableCell> + ))} </TableRow> - </TableHead> - <TableBody> - {items.map((item) => ( - <TableRow key={item.positionId}> - {columns.map((key) => ( - <TableCell key={key}> - {formatValue(item, key)} - </TableCell> - ))} - </TableRow> - ))} - </TableBody> - </Table> - </TableContainer> + ))} + </TableBody> + </Table> </PageLayout> ); }; |