diff options
Diffstat (limited to 'modern/src/reports/TripReportPage.js')
-rw-r--r-- | modern/src/reports/TripReportPage.js | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/modern/src/reports/TripReportPage.js b/modern/src/reports/TripReportPage.js index 45a7786c..5f414f44 100644 --- a/modern/src/reports/TripReportPage.js +++ b/modern/src/reports/TripReportPage.js @@ -1,10 +1,11 @@ import React, { useState } from 'react'; import { DataGrid } from '@material-ui/data-grid'; -import t from '../common/localization'; +import { useTheme } from "@material-ui/core/styles"; import { formatDistance, formatSpeed, formatHours, formatDate, formatVolume } from '../common/formatter'; import ReportFilter from './ReportFilter'; import ReportLayoutPage from './ReportLayoutPage'; import { useAttributePreference } from '../common/preferences'; +import t from '../common/localization'; const Filter = ({ setItems }) => { @@ -27,6 +28,8 @@ const Filter = ({ setItems }) => { } const TripReportPage = () => { + + const theme = useTheme(); const distanceUnit = useAttributePreference('distanceUnit'); const speedUnit = useAttributePreference('speedUnit'); @@ -38,74 +41,74 @@ const TripReportPage = () => { headerName: t('reportStartTime'), field: 'startTime', type: 'dateTime', - flex: 1, + width: theme.dimensions.columnWidthDate, valueFormatter: ({ value }) => formatDate(value), }, { headerName: t('reportStartOdometer'), field: 'startOdometer', type: 'number', - flex: 1, + width: theme.dimensions.columnWidthNumber, valueFormatter: ({ value }) => formatDistance(value, distanceUnit), }, { headerName: t('reportStartAddress'), field: 'startAddress', type: 'string', hide: true, - flex: 1, + width: theme.dimensions.columnWidthString, }, { headerName: t('reportEndTime'), field: 'endTime', type: 'dateTime', - flex: 1, + width: theme.dimensions.columnWidthDate, valueFormatter: ({ value }) => formatDate(value), }, { headerName: t('reportEndOdometer'), field: 'endOdometer', type: 'number', - flex: 1, + width: theme.dimensions.columnWidthNumber, valueFormatter: ({ value }) => formatDistance(value, distanceUnit), }, { headerName: t('reportEndAddress'), field: 'endAddress', type: 'string', hide: true, - flex: 1, + width: theme.dimensions.columnWidthString, }, { headerName: t('sharedDistance'), field: 'distance', type: 'number', - flex: 1, + width: theme.dimensions.columnWidthNumber, valueFormatter: ({ value }) => formatDistance(value, distanceUnit), }, { headerName: t('reportAverageSpeed'), field: 'averageSpeed', type: 'number', - flex: 1, + width: theme.dimensions.columnWidthNumber, valueFormatter: ({ value }) => formatSpeed(value, speedUnit), }, { headerName: t('reportMaximumSpeed'), field: 'maxSpeed', type: 'number', - flex: 1, + width: theme.dimensions.columnWidthNumber, valueFormatter: ({ value }) => formatSpeed(value, speedUnit), }, { headerName: t('reportDuration'), field: 'duration', type: 'string', - flex: 1, + width: theme.dimensions.columnWidthString, valueFormatter: ({ value }) => formatHours(value), }, { headerName: t('reportSpentFuel'), field: 'spentFuel', type: 'number', - flex: 1, + width: theme.dimensions.columnWidthNumber, hide: true, valueFormatter: ({ value }) => formatVolume(value, volumeUnit), }, { headerName: t('sharedDriver'), field: 'driverName', type: 'string', - flex: 1, + width: theme.dimensions.columnWidthString, hide: true }] |