From 4e84fa64bfe7d92cd2eff6a0411140953dc3fdb9 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 6 May 2022 15:02:43 -0700 Subject: Add timezone attribute --- modern/src/UserPage.js | 18 +++++++++++++++--- modern/src/admin/ServerPage.js | 18 +++++++++++++++--- modern/src/attributes/EditAttributesView.js | 2 +- modern/src/attributes/useUserAttributes.js | 8 ++------ 4 files changed, 33 insertions(+), 13 deletions(-) (limited to 'modern') diff --git a/modern/src/UserPage.js b/modern/src/UserPage.js index d53777a5..89e04dde 100644 --- a/modern/src/UserPage.js +++ b/modern/src/UserPage.js @@ -12,6 +12,7 @@ import LinkField from './form/LinkField'; import { useTranslation } from './LocalizationProvider'; import useUserAttributes from './attributes/useUserAttributes'; import { sessionActions } from './store'; +import SelectField from './form/SelectField'; const useStyles = makeStyles(() => ({ details: { @@ -90,7 +91,7 @@ const UserPage = () => { {t('settingsSpeedUnit')} setItem({ ...item, attributes: { ...item.attributes, distanceUnit: event.target.value } })} + onChange={(e) => setItem({ ...item, attributes: { ...item.attributes, distanceUnit: e.target.value } })} > {t('sharedKm')} {t('sharedMi')} @@ -112,13 +113,24 @@ const UserPage = () => { {t('settingsVolumeUnit')} + setItem({ ...item, attributes: { ...item.attributes, timezone: e.target.value } })} + endpoint="/api/server/timezones" + keyGetter={(it) => it} + titleGetter={(it) => it} + label={t('sharedTimezone')} + variant="filled" + /> ({ container: { @@ -113,7 +114,7 @@ const ServerPage = () => { {t('settingsSpeedUnit')} setItem({ ...item, attributes: { ...item.attributes, distanceUnit: event.target.value } })} + onChange={(e) => setItem({ ...item, attributes: { ...item.attributes, distanceUnit: e.target.value } })} > {t('sharedKm')} {t('sharedMi')} @@ -135,13 +136,24 @@ const ServerPage = () => { {t('settingsVolumeUnit')} + setItem({ ...item, attributes: { ...item.attributes, timezone: e.target.value } })} + endpoint="/api/server/timezones" + keyGetter={(it) => it} + titleGetter={(it) => it} + label={t('sharedTimezone')} + variant="filled" + /> { const convertToList = (attributes) => { const booleanList = []; const otherList = []; - const excludeAttributes = ['speedUnit', 'distanceUnit', 'volumeUnit']; + const excludeAttributes = ['speedUnit', 'distanceUnit', 'volumeUnit', 'timezone']; Object.keys(attributes || []).filter((key) => !excludeAttributes.includes(key)).forEach((key) => { const value = attributes[key]; const type = getAttributeType(value); diff --git a/modern/src/attributes/useUserAttributes.js b/modern/src/attributes/useUserAttributes.js index 3c5ea019..9275596b 100644 --- a/modern/src/attributes/useUserAttributes.js +++ b/modern/src/attributes/useUserAttributes.js @@ -5,7 +5,7 @@ export default (t) => useMemo(() => ({ name: t('attributeNotificationTokens'), type: 'string', }, - 'web.liveRouteLength': { + /*'web.liveRouteLength': { name: t('attributeWebLiveRouteLength'), type: 'number', }, @@ -44,9 +44,5 @@ export default (t) => useMemo(() => ({ 'ui.hidePositionAttributes': { name: t('attributeUiHidePositionAttributes'), type: 'string', - }, - timezone: { - name: t('sharedTimezone'), - type: 'string', - }, + },*/ }), [t]); -- cgit v1.2.3