aboutsummaryrefslogtreecommitdiff
path: root/modern/src/UserPage.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-09-20 21:28:52 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-09-20 21:28:52 -0700
commit787c9dc0ec684d3524ec060b6422ffbaea5012ac (patch)
treed8e125759f8e54de2921127365f90016013c3c2c /modern/src/UserPage.js
parent9801338e03965ec28af9369b850f339ba534003f (diff)
downloadtrackermap-web-787c9dc0ec684d3524ec060b6422ffbaea5012ac.tar.gz
trackermap-web-787c9dc0ec684d3524ec060b6422ffbaea5012ac.tar.bz2
trackermap-web-787c9dc0ec684d3524ec060b6422ffbaea5012ac.zip
Add user edit page
Diffstat (limited to 'modern/src/UserPage.js')
-rw-r--r--modern/src/UserPage.js53
1 files changed, 53 insertions, 0 deletions
diff --git a/modern/src/UserPage.js b/modern/src/UserPage.js
new file mode 100644
index 00000000..da8ba1b6
--- /dev/null
+++ b/modern/src/UserPage.js
@@ -0,0 +1,53 @@
+import React, { useState } from 'react';
+import TextField from '@material-ui/core/TextField';
+
+import t from './common/localization';
+import EditPage from './EditPage';
+
+const UserPage = () => {
+ const [item, setItem] = useState();
+
+ const [name, setName] = useState('');
+ const [email, setEmail] = useState('');
+ const [password, setPassword] = useState('');
+
+ const getItem = () => {
+ const updatedItem = item;
+ updatedItem.name = name;
+ updatedItem.email = email;
+ updatedItem.password = password;
+ return updatedItem;
+ };
+
+ return (
+ <EditPage endpoint="users" setItem={setItem} getItem={getItem}>
+ {item &&
+ <>
+ <TextField
+ margin="normal"
+ fullWidth
+ defaultValue={item.name}
+ onChange={(event) => setName(event.target.value)}
+ label={t('sharedName')}
+ variant="filled" />
+ <TextField
+ margin="normal"
+ fullWidth
+ defaultValue={item.email}
+ onChange={(event) => setEmail(event.target.value)}
+ label={t('userEmail')}
+ variant="filled" />
+ <TextField
+ margin="normal"
+ fullWidth
+ type="password"
+ onChange={(event) => setPassword(event.target.value)}
+ label={t('userPassword')}
+ variant="filled" />
+ </>
+ }
+ </EditPage>
+ );
+}
+
+export default UserPage;