From 4810bef487c36c263326ecd7f4626a6354ecfdf5 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 6 May 2022 14:46:42 -0700 Subject: Special attributes for units --- modern/src/UserPage.js | 35 ++++++++++++++++++++++++++++- modern/src/admin/ServerPage.js | 33 +++++++++++++++++++++++++++ modern/src/attributes/EditAttributesView.js | 3 ++- modern/src/attributes/useUserAttributes.js | 12 ---------- 4 files changed, 69 insertions(+), 14 deletions(-) diff --git a/modern/src/UserPage.js b/modern/src/UserPage.js index c6274af9..d53777a5 100644 --- a/modern/src/UserPage.js +++ b/modern/src/UserPage.js @@ -2,7 +2,7 @@ import React, { useState } from 'react'; import TextField from '@material-ui/core/TextField'; import { - Accordion, AccordionSummary, AccordionDetails, makeStyles, Typography, + Accordion, AccordionSummary, AccordionDetails, makeStyles, Typography, FormControl, InputLabel, Select, MenuItem, } from '@material-ui/core'; import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; import { useDispatch, useSelector } from 'react-redux'; @@ -86,6 +86,39 @@ const UserPage = () => { label={t('sharedPhone')} variant="filled" /> + + {t('settingsSpeedUnit')} + + + + {t('settingsDistanceUnit')} + + + + {t('settingsVolumeUnit')} + + { {t('sharedDegreesMinutesSeconds')} + + {t('settingsSpeedUnit')} + + + + {t('settingsDistanceUnit')} + + + + {t('settingsVolumeUnit')} + + { const convertToList = (attributes) => { const booleanList = []; const otherList = []; - Object.keys(attributes || []).forEach((key) => { + const excludeAttributes = ['speedUnit', 'distanceUnit', 'volumeUnit']; + Object.keys(attributes || []).filter((key) => !excludeAttributes.includes(key)).forEach((key) => { const value = attributes[key]; const type = getAttributeType(value); const subtype = getAttributeSubtype(key); diff --git a/modern/src/attributes/useUserAttributes.js b/modern/src/attributes/useUserAttributes.js index 0101d2f5..3c5ea019 100644 --- a/modern/src/attributes/useUserAttributes.js +++ b/modern/src/attributes/useUserAttributes.js @@ -45,18 +45,6 @@ export default (t) => useMemo(() => ({ name: t('attributeUiHidePositionAttributes'), type: 'string', }, - distanceUnit: { - name: t('settingsDistanceUnit'), - type: 'string', - }, - speedUnit: { - name: t('settingsSpeedUnit'), - type: 'string', - }, - volumeUnit: { - name: t('settingsVolumeUnit'), - type: 'string', - }, timezone: { name: t('sharedTimezone'), type: 'string', -- cgit v1.2.3