Skip to content

Commit 0418e6d

Browse files
committed
#1506 | Styling Fixes
- Fixed users page
1 parent 85d3d92 commit 0418e6d

File tree

3 files changed

+100
-59
lines changed

3 files changed

+100
-59
lines changed

src/adminApp/UserHelper.jsx

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ import {
99
Toolbar
1010
} from "react-admin";
1111
import { isValidPhoneNumber } from "libphonenumber-js";
12+
import { styled } from "@mui/material/styles";
13+
14+
const StyledTextInput = styled(TextInput)({
15+
"& .MuiInputBase-input": {
16+
backgroundColor: "white"
17+
},
18+
"& .RaResettableTextField-clearButton": {
19+
backgroundColor: "white"
20+
}
21+
});
1222

1323
export const UserTitle = ({ record, titlePrefix }) => {
1424
return (
@@ -32,16 +42,31 @@ export const formatRoles = roles =>
3242
.join(", ");
3343

3444
export const UserFilter = [
35-
<TextInput label="Login ID" source="username" alwaysOn resettable />,
36-
<TextInput
45+
<StyledTextInput
46+
label="Login ID"
47+
source="username"
48+
alwaysOn
49+
resettable={false}
50+
/>,
51+
<StyledTextInput
3752
label="Name"
3853
source="name"
3954
alwaysOn
4055
autoComplete="off"
41-
resettable
56+
resettable={false}
4257
/>,
43-
<TextInput label="Email Address" source="email" alwaysOn resettable />,
44-
<TextInput label="Phone Number" source="phoneNumber" alwaysOn resettable />
58+
<StyledTextInput
59+
label="Email Address"
60+
source="email"
61+
alwaysOn
62+
resettable={false}
63+
/>,
64+
<StyledTextInput
65+
label="Phone Number"
66+
source="phoneNumber"
67+
alwaysOn
68+
resettable={false}
69+
/>
4570
];
4671

4772
export const CustomToolbar = props => (

src/adminApp/user.jsx

Lines changed: 69 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,15 @@ import {
3838
useResourceContext
3939
} from "react-admin";
4040
import { useFormContext, useWatch } from "react-hook-form";
41-
import { Paper, Grid, Chip, Typography, CardActions } from "@mui/material";
41+
import {
42+
Paper,
43+
Grid,
44+
Chip,
45+
Typography,
46+
CardActions,
47+
styled,
48+
Box
49+
} from "@mui/material";
4250
import { CatchmentSelectInput } from "./components/CatchmentSelectInput";
4351
import { LineBreak } from "../common/components/utils";
4452
import {
@@ -88,6 +96,14 @@ const StringToLabelObject = ({ children, ...props }) => {
8896
return cloneElement(children, { ...props, record: labelRecord });
8997
};
9098

99+
const StyledBox = styled(Box)(({ theme }) => ({
100+
marginTop: theme.spacing(3.5),
101+
marginRight: theme.spacing(1.5),
102+
boxShadow: theme.shadows[2],
103+
padding: theme.spacing(3),
104+
backgroundColor: theme.palette.background.paper
105+
}));
106+
91107
export const UserCreate = ({ user, organisation, userInfo, ...props }) => (
92108
<Paper>
93109
<DocumentationContainer filename={"User.md"}>
@@ -115,56 +131,58 @@ export const UserEdit = ({ organisation, ...props }) => (
115131
export const UserList = ({ ...props }) => {
116132
const { organisation } = useContext(OrgManagerContext);
117133
return (
118-
<List
119-
{...props}
120-
hasCreate={false}
121-
filter={{ organisationId: organisation.id }}
122-
filters={UserFilter}
123-
title={`${organisation.name} Users`}
124-
>
125-
<Datagrid rowClick="show">
126-
<TextField label="Login ID" source="username" />
127-
<TextField source="name" label="Name of the Person" />
128-
<ReferenceField
129-
label="Catchment"
130-
source="catchmentId"
131-
reference="catchment"
132-
link="show"
133-
emptyText=""
134-
>
135-
<TextField source="name" />
136-
</ReferenceField>
137-
<TextField source="email" label="Email Address" />
138-
<TextField source="phoneNumber" label="Phone Number" />
139-
<FunctionField
140-
label="User Groups"
141-
render={record => (
142-
<div style={{ maxWidth: "40em" }}>
143-
{_.isArrayLike(record.userGroups) &&
144-
record.userGroups
145-
.filter(ug => ug && !ug.voided)
146-
.map(userGroup => (
147-
<Chip
148-
style={{ margin: "0.2em" }}
149-
label={userGroup.groupName}
150-
key={userGroup.groupName}
151-
/>
152-
))}
153-
</div>
154-
)}
155-
/>
156-
<FunctionField
157-
label="Status"
158-
render={user =>
159-
user.voided === true
160-
? "Deleted"
161-
: user.disabledInCognito === true
162-
? "Disabled"
163-
: "Active"
164-
}
165-
/>
166-
</Datagrid>
167-
</List>
134+
<StyledBox>
135+
<List
136+
{...props}
137+
hasCreate={false}
138+
filter={{ organisationId: organisation.id }}
139+
filters={UserFilter}
140+
title={`${organisation.name} Users`}
141+
>
142+
<Datagrid rowClick="show">
143+
<TextField label="Login ID" source="username" />
144+
<TextField source="name" label="Name of the Person" />
145+
<ReferenceField
146+
label="Catchment"
147+
source="catchmentId"
148+
reference="catchment"
149+
link="show"
150+
emptyText=""
151+
>
152+
<TextField source="name" />
153+
</ReferenceField>
154+
<TextField source="email" label="Email Address" />
155+
<TextField source="phoneNumber" label="Phone Number" />
156+
<FunctionField
157+
label="User Groups"
158+
render={record => (
159+
<div style={{ maxWidth: "40em" }}>
160+
{_.isArrayLike(record.userGroups) &&
161+
record.userGroups
162+
.filter(ug => ug && !ug.voided)
163+
.map(userGroup => (
164+
<Chip
165+
style={{ margin: "0.2em" }}
166+
label={userGroup.groupName}
167+
key={userGroup.groupName}
168+
/>
169+
))}
170+
</div>
171+
)}
172+
/>
173+
<FunctionField
174+
label="Status"
175+
render={user =>
176+
user.voided === true
177+
? "Deleted"
178+
: user.disabledInCognito === true
179+
? "Disabled"
180+
: "Active"
181+
}
182+
/>
183+
</Datagrid>
184+
</List>
185+
</StyledBox>
168186
);
169187
};
170188

src/dataEntryApp/views/GlobalSearch/SearchFilterForm.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
/* SearchFilterForm.js */
2-
3-
import React, { Fragment, useEffect, useState } from "react";
1+
import { Fragment, useEffect, useState } from "react";
42
import { styled } from "@mui/material/styles";
53
import { Link, useLocation } from "react-router-dom";
64
import { useSelector, useDispatch } from "react-redux";

0 commit comments

Comments
 (0)