aboutsummaryrefslogtreecommitdiff
path: root/modern/src/settings/MaintenancePage.js
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/settings/MaintenancePage.js')
-rw-r--r--modern/src/settings/MaintenancePage.js18
1 files changed, 7 insertions, 11 deletions
diff --git a/modern/src/settings/MaintenancePage.js b/modern/src/settings/MaintenancePage.js
index c434f11e..987789d5 100644
--- a/modern/src/settings/MaintenancePage.js
+++ b/modern/src/settings/MaintenancePage.js
@@ -11,7 +11,6 @@ import {
Select,
} from '@mui/material';
import makeStyles from '@mui/styles/makeStyles';
-import InputAdornment from '@mui/material/InputAdornment';
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import { prefixString } from '../common/util/stringUtils';
import EditItemView from './components/EditItemView';
@@ -42,8 +41,8 @@ const MaintenancePage = () => {
const [item, setItem] = useState();
const [labels, setLabels] = useState({ start: '', period: '' });
- const speedUnit = useAttributePreference('speedUnit');
- const distanceUnit = useAttributePreference('distanceUnit');
+ const speedUnit = useAttributePreference('speedUnit', 'kn');
+ const distanceUnit = useAttributePreference('distanceUnit', 'km');
const convertToList = (attributes) => {
const otherList = [];
@@ -72,8 +71,11 @@ const MaintenancePage = () => {
setLabels({ ...labels, start: t(prefixString('shared', speedUnit)), period: t(prefixString('shared', speedUnit)) });
break;
default:
+ setLabels({ ...labels, start: null, period: null });
break;
}
+ } else {
+ setLabels({ ...labels, start: null, period: null });
}
};
@@ -148,19 +150,13 @@ const MaintenancePage = () => {
type="number"
value={rawToValue(item.start) || ''}
onChange={(event) => setItem({ ...item, start: valueToRaw(event.target.value) })}
- label={t('maintenanceStart')}
- InputProps={{
- endAdornment: <InputAdornment position="start">{labels.start}</InputAdornment>,
- }}
+ label={labels.start ? `${t('maintenanceStart')} (${labels.start})` : t('maintenanceStart')}
/>
<TextField
type="number"
value={rawToValue(item.period) || ''}
onChange={(event) => setItem({ ...item, period: valueToRaw(event.target.value) })}
- label={t('maintenancePeriod')}
- InputProps={{
- endAdornment: <InputAdornment position="start">{labels.period}</InputAdornment>,
- }}
+ label={labels.period ? `${t('maintenancePeriod')} (${labels.period})` : t('maintenancePeriod')}
/>
</AccordionDetails>
</Accordion>