From 2cd374bb9fa941d7e2a6fd8aa5079893a158c98f Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 8 May 2022 13:16:57 -0700 Subject: Reorganize remaining files --- modern/src/UserPage.js | 194 ------------------------------------------------- 1 file changed, 194 deletions(-) delete mode 100644 modern/src/UserPage.js (limited to 'modern/src/UserPage.js') diff --git a/modern/src/UserPage.js b/modern/src/UserPage.js deleted file mode 100644 index cb643b8a..00000000 --- a/modern/src/UserPage.js +++ /dev/null @@ -1,194 +0,0 @@ -import React, { useState } from 'react'; -import TextField from '@material-ui/core/TextField'; - -import { - 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'; -import EditItemView from './EditItemView'; -import EditAttributesView from './attributes/EditAttributesView'; -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: { - flexDirection: 'column', - }, -})); - -const UserPage = () => { - const classes = useStyles(); - const dispatch = useDispatch(); - const t = useTranslation(); - - const currentUserId = useSelector((state) => state.session.user.id); - - const userAttributes = useUserAttributes(t); - - const [item, setItem] = useState(); - - const onItemSaved = (result) => { - if (result.id === currentUserId) { - dispatch(sessionActions.updateUser(result)); - } - }; - - const validate = () => item && item.name && item.email && (item.id || item.password); - - return ( - - {item && ( - <> - - }> - - {t('sharedRequired')} - - - - setItem({ ...item, name: event.target.value })} - label={t('sharedName')} - variant="filled" - /> - setItem({ ...item, email: event.target.value })} - label={t('userEmail')} - variant="filled" - /> - setItem({ ...item, password: event.target.value })} - label={t('userPassword')} - variant="filled" - /> - - - - }> - - {t('sharedPreferences')} - - - - setItem({ ...item, phone: event.target.value })} - label={t('sharedPhone')} - variant="filled" - /> - - {t('settingsSpeedUnit')} - - - - {t('settingsDistanceUnit')} - - - - {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" - /> - setItem({ ...item, poiLayer: event.target.value })} - label={t('mapPoiLayer')} - variant="filled" - /> - - - - }> - - {t('sharedAttributes')} - - - - setItem({ ...item, attributes })} - definitions={userAttributes} - /> - - - {item.id && ( - - }> - - {t('sharedConnections')} - - - - - - - - )} - - )} - - ); -}; - -export default UserPage; -- cgit v1.2.3