|
7 | 7 | CardActions, |
8 | 8 | Button, |
9 | 9 | Typography, |
| 10 | + Box, |
10 | 11 | } from "@material-ui/core"; |
11 | 12 | import { useAuthState, useAuthDispatch, update } from "../contexts"; |
12 | 13 | import { usersService } from "../services"; |
@@ -64,138 +65,142 @@ const ProfilePage = () => { |
64 | 65 | }; |
65 | 66 |
|
66 | 67 | return ( |
67 | | - <Grid |
68 | | - container |
69 | | - spacing={4} |
70 | | - direction="column" |
71 | | - alignItems="center" |
72 | | - justify="center" |
73 | | - style={{ minHeight: "60vh" }} |
74 | | - > |
75 | | - <Grid item> |
76 | | - <Card variant="outlined"> |
77 | | - <CardContent> |
78 | | - <Typography>apiKey: {user?.apiKey}</Typography> |
79 | | - </CardContent> |
80 | | - </Card> |
81 | | - </Grid> |
82 | | - <Grid item> |
83 | | - <form onSubmit={handleUserUpdateSubmit}> |
| 68 | + <Box mt={2}> |
| 69 | + <Grid |
| 70 | + container |
| 71 | + spacing={4} |
| 72 | + direction="column" |
| 73 | + alignItems="center" |
| 74 | + justify="center" |
| 75 | + style={{ minHeight: "60vh" }} |
| 76 | + > |
| 77 | + <Grid item> |
84 | 78 | <Card variant="outlined"> |
85 | 79 | <CardContent> |
86 | | - <Grid container spacing={2}> |
87 | | - <Grid item xs={6}> |
88 | | - <TextField |
89 | | - id="firstName" |
90 | | - name="firstName" |
91 | | - value={firstName} |
92 | | - label={"First name"} |
93 | | - type="text" |
94 | | - variant="outlined" |
95 | | - required |
96 | | - fullWidth |
97 | | - inputProps={{ |
98 | | - onChange: (event) => |
99 | | - setFirstName((event.target as HTMLInputElement).value), |
100 | | - "data-testid": "firstName", |
101 | | - }} |
102 | | - /> |
103 | | - </Grid> |
104 | | - <Grid item xs={6}> |
105 | | - <TextField |
106 | | - id="lastName" |
107 | | - name="lastName" |
108 | | - value={lastName} |
109 | | - label={"Last name"} |
110 | | - type="text" |
111 | | - variant="outlined" |
112 | | - required |
113 | | - fullWidth |
114 | | - inputProps={{ |
115 | | - onChange: (event) => |
116 | | - setLastName((event.target as HTMLInputElement).value), |
117 | | - "data-testid": "lastName", |
118 | | - }} |
119 | | - /> |
120 | | - </Grid> |
121 | | - <Grid item xs={12}> |
122 | | - <TextField |
123 | | - id="email" |
124 | | - name="email" |
125 | | - value={email} |
126 | | - label={"Email address"} |
127 | | - type="text" |
128 | | - variant="outlined" |
129 | | - required |
130 | | - fullWidth |
131 | | - inputProps={{ |
132 | | - onChange: (event) => |
133 | | - setEmail((event.target as HTMLInputElement).value), |
134 | | - "data-testid": "email", |
135 | | - }} |
136 | | - /> |
137 | | - </Grid> |
138 | | - </Grid> |
| 80 | + <Typography>apiKey: {user?.apiKey}</Typography> |
139 | 81 | </CardContent> |
140 | | - <CardActions> |
141 | | - <Grid container justify="center"> |
142 | | - <Grid item> |
143 | | - <Button |
144 | | - type="submit" |
145 | | - color="primary" |
146 | | - variant="outlined" |
147 | | - data-testid="submit" |
148 | | - > |
149 | | - Update |
150 | | - </Button> |
151 | | - </Grid> |
152 | | - </Grid> |
153 | | - </CardActions> |
154 | 82 | </Card> |
155 | | - </form> |
156 | | - </Grid> |
157 | | - <Grid item> |
158 | | - <form onSubmit={handlePasswordUpdateSubmit}> |
159 | | - <Card variant="outlined"> |
160 | | - <CardContent> |
161 | | - <Grid container spacing={2}> |
162 | | - <Grid item xs={12}> |
163 | | - <TextField |
164 | | - id="password" |
165 | | - name="password" |
166 | | - value={password} |
167 | | - label={"New password"} |
168 | | - type="password" |
169 | | - variant="outlined" |
170 | | - required |
171 | | - fullWidth |
172 | | - inputProps={{ |
173 | | - onChange: (event) => |
174 | | - setPassword((event.target as HTMLInputElement).value), |
175 | | - "data-testid": "password", |
176 | | - }} |
177 | | - /> |
| 83 | + </Grid> |
| 84 | + <Grid item> |
| 85 | + <form onSubmit={handleUserUpdateSubmit}> |
| 86 | + <Card variant="outlined"> |
| 87 | + <CardContent> |
| 88 | + <Grid container spacing={2}> |
| 89 | + <Grid item xs={6}> |
| 90 | + <TextField |
| 91 | + id="firstName" |
| 92 | + name="firstName" |
| 93 | + value={firstName} |
| 94 | + label={"First name"} |
| 95 | + type="text" |
| 96 | + variant="outlined" |
| 97 | + required |
| 98 | + fullWidth |
| 99 | + inputProps={{ |
| 100 | + onChange: (event) => |
| 101 | + setFirstName( |
| 102 | + (event.target as HTMLInputElement).value |
| 103 | + ), |
| 104 | + "data-testid": "firstName", |
| 105 | + }} |
| 106 | + /> |
| 107 | + </Grid> |
| 108 | + <Grid item xs={6}> |
| 109 | + <TextField |
| 110 | + id="lastName" |
| 111 | + name="lastName" |
| 112 | + value={lastName} |
| 113 | + label={"Last name"} |
| 114 | + type="text" |
| 115 | + variant="outlined" |
| 116 | + required |
| 117 | + fullWidth |
| 118 | + inputProps={{ |
| 119 | + onChange: (event) => |
| 120 | + setLastName((event.target as HTMLInputElement).value), |
| 121 | + "data-testid": "lastName", |
| 122 | + }} |
| 123 | + /> |
| 124 | + </Grid> |
| 125 | + <Grid item xs={12}> |
| 126 | + <TextField |
| 127 | + id="email" |
| 128 | + name="email" |
| 129 | + value={email} |
| 130 | + label={"Email address"} |
| 131 | + type="text" |
| 132 | + variant="outlined" |
| 133 | + required |
| 134 | + fullWidth |
| 135 | + inputProps={{ |
| 136 | + onChange: (event) => |
| 137 | + setEmail((event.target as HTMLInputElement).value), |
| 138 | + "data-testid": "email", |
| 139 | + }} |
| 140 | + /> |
| 141 | + </Grid> |
178 | 142 | </Grid> |
179 | | - </Grid> |
180 | | - </CardContent> |
181 | | - <CardActions> |
182 | | - <Grid container justify="center"> |
183 | | - <Grid item> |
184 | | - <Button |
185 | | - type="submit" |
186 | | - color="primary" |
187 | | - variant="outlined" |
188 | | - data-testid="submit" |
189 | | - > |
190 | | - Update |
191 | | - </Button> |
| 143 | + </CardContent> |
| 144 | + <CardActions> |
| 145 | + <Grid container justify="center"> |
| 146 | + <Grid item> |
| 147 | + <Button |
| 148 | + type="submit" |
| 149 | + color="primary" |
| 150 | + variant="outlined" |
| 151 | + data-testid="submit" |
| 152 | + > |
| 153 | + Update |
| 154 | + </Button> |
| 155 | + </Grid> |
192 | 156 | </Grid> |
193 | | - </Grid> |
194 | | - </CardActions> |
195 | | - </Card> |
196 | | - </form> |
| 157 | + </CardActions> |
| 158 | + </Card> |
| 159 | + </form> |
| 160 | + </Grid> |
| 161 | + <Grid item> |
| 162 | + <form onSubmit={handlePasswordUpdateSubmit}> |
| 163 | + <Card variant="outlined"> |
| 164 | + <CardContent> |
| 165 | + <Grid container spacing={2}> |
| 166 | + <Grid item xs={12}> |
| 167 | + <TextField |
| 168 | + id="password" |
| 169 | + name="password" |
| 170 | + value={password} |
| 171 | + label={"New password"} |
| 172 | + type="password" |
| 173 | + variant="outlined" |
| 174 | + required |
| 175 | + fullWidth |
| 176 | + inputProps={{ |
| 177 | + onChange: (event) => |
| 178 | + setPassword((event.target as HTMLInputElement).value), |
| 179 | + "data-testid": "password", |
| 180 | + }} |
| 181 | + /> |
| 182 | + </Grid> |
| 183 | + </Grid> |
| 184 | + </CardContent> |
| 185 | + <CardActions> |
| 186 | + <Grid container justify="center"> |
| 187 | + <Grid item> |
| 188 | + <Button |
| 189 | + type="submit" |
| 190 | + color="primary" |
| 191 | + variant="outlined" |
| 192 | + data-testid="submit" |
| 193 | + > |
| 194 | + Update |
| 195 | + </Button> |
| 196 | + </Grid> |
| 197 | + </Grid> |
| 198 | + </CardActions> |
| 199 | + </Card> |
| 200 | + </form> |
| 201 | + </Grid> |
197 | 202 | </Grid> |
198 | | - </Grid> |
| 203 | + </Box> |
199 | 204 | ); |
200 | 205 | }; |
201 | 206 |
|
|
0 commit comments