Skip to content

Commit 0fef1b1

Browse files
committed
Administration list adjustments
1 parent cd6631e commit 0fef1b1

File tree

4 files changed

+35
-3
lines changed

4 files changed

+35
-3
lines changed

src/Administration/Users/UsersList/UsersList.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ const UsersList = ({ match }) => {
6868
label: 'Email',
6969
isSortable: true,
7070
},
71+
{
72+
id: 'status',
73+
label: 'Status',
74+
isSortable: true,
75+
},
7176
{
7277
id: 'createdAt',
7378
label: 'Created',

src/Administration/Users/UsersList/UsersListTableItems.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react'
22
import PropTypes from 'prop-types'
33
import { FormattedDate } from 'react-intl'
44
import { Link } from 'react-router-dom'
5-
import { makeStyles, TableCell, TableRow, Avatar } from '@material-ui/core'
5+
import { makeStyles, TableCell, TableRow, Avatar, Chip } from '@material-ui/core'
66
import { Skeleton } from '@material-ui/lab'
77

88
import { Edit as EditIcon, Delete as DeleteIcon } from '@material-ui/icons/'
@@ -39,6 +39,9 @@ const UsersListTableItems = ({ users, rowsPerPage = 10, rowsExpected = 10 }) =>
3939
<TableCell>
4040
<Skeleton variant="text" />
4141
</TableCell>
42+
<TableCell>
43+
<Skeleton variant="text" />
44+
</TableCell>
4245
</TableRow>
4346
))}
4447
{users.map(row => (
@@ -52,6 +55,14 @@ const UsersListTableItems = ({ users, rowsPerPage = 10, rowsExpected = 10 }) =>
5255
<TableCell>{row.lastName}</TableCell>
5356
<TableCell>{row.username}</TableCell>
5457
<TableCell>{row.email}</TableCell>
58+
<TableCell>
59+
<Chip
60+
label={row.status}
61+
variant="outlined"
62+
size="small"
63+
color={row.status === 'active' ? 'secondary' : 'default'}
64+
/>
65+
</TableCell>
5566
<TableCell>
5667
<FormattedDate
5768
value={new Date(row.createdAt)}
@@ -81,8 +92,8 @@ UsersListTableItems.propTypes = {}
8192

8293
const useStyles = makeStyles(theme => ({
8394
link: {
84-
color: "inherit"
85-
}
95+
color: 'inherit',
96+
},
8697
}))
8798

8899
export default UsersListTableItems

src/_api/_mocks/_data/usersData.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const list: User[] = [
1414
1515
avatarUrl: 'https://avatars3.githubusercontent.com/u/3959008?v=3&s=40',
1616
globalRole: 'admin',
17+
status: 'active',
1718
},
1819
{
1920
id: 2,
@@ -23,6 +24,7 @@ const list: User[] = [
2324
2425
avatarUrl:
2526
'https://tinyfac.es/data/avatars/475605E3-69C5-4D2B-8727-61B7BB8C4699-500w.jpeg',
27+
status: 'active',
2628
},
2729
{
2830
id: 3,
@@ -32,6 +34,7 @@ const list: User[] = [
3234
3335
avatarUrl:
3436
'https://images-na.ssl-images-amazon.com/images/M/MV5BMjA3NjYzMzE1MV5BMl5BanBnXkFtZTgwNTA4NDY4OTE@._V1_UX172_CR0,0,172,256_AL_.jpg',
37+
status: 'active',
3538
},
3639
{
3740
id: 4,
@@ -41,6 +44,7 @@ const list: User[] = [
4144
4245
avatarUrl:
4346
'https://images-na.ssl-images-amazon.com/images/M/MV5BMTc0MzgxMzQ5N15BMl5BanBnXkFtZTgwMzMzNjkwOTE@._V1_UX172_CR0,0,172,256_AL_.jpg',
47+
status: 'active',
4448
},
4549
{
4650
id: 5,
@@ -49,6 +53,7 @@ const list: User[] = [
4953
5054
avatarUrl:
5155
'https://images-na.ssl-images-amazon.com/images/M/MV5BMTgxMTc1MTYzM15BMl5BanBnXkFtZTgwNzI5NjMwOTE@._V1_UY256_CR16,0,172,256_AL_.jpg',
56+
status: 'disabled',
5257
},
5358
{
5459
id: 6,
@@ -58,6 +63,7 @@ const list: User[] = [
5863
5964
avatarUrl: 'https://randomuser.me/api/portraits/women/29.jpg',
6065
globalRole: 'admin',
66+
status: 'active',
6167
},
6268
{
6369
id: 7,
@@ -66,6 +72,7 @@ const list: User[] = [
6672
username: 'sanders',
6773
6874
avatarUrl: 'https://randomuser.me/api/portraits/women/26.jpg',
75+
status: 'active',
6976
},
7077
{
7178
id: 8,
@@ -74,6 +81,7 @@ const list: User[] = [
7481
username: 'scjx',
7582
7683
avatarUrl: 'https://randomuser.me/api/portraits/men/87.jpg',
84+
status: 'pending',
7785
},
7886
{
7987
id: 9,
@@ -82,13 +90,15 @@ const list: User[] = [
8290
username: null,
8391
8492
avatarUrl: 'https://randomuser.me/api/portraits/men/88.jpg',
93+
status: 'pending',
8594
},
8695
{
8796
id: 10,
8897
firstName: 'Penny',
8998
lastName: 'Lawrence',
9099
91100
avatarUrl: 'https://randomuser.me/api/portraits/women/79.jpg',
101+
status: 'active',
92102
},
93103
{
94104
id: 11,
@@ -98,6 +108,7 @@ const list: User[] = [
98108
99109
avatarUrl: 'https://randomuser.me/api/portraits/men/85.jpg',
100110
globalRole: 'admin',
111+
status: 'disabled',
101112
},
102113
{
103114
id: 12,
@@ -107,6 +118,7 @@ const list: User[] = [
107118
108119
avatarUrl:
109120
'https://images.unsplash.com/photo-1510227272981-87123e259b17?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=200&fit=max&s=3759e09a5b9fbe53088b23c615b6312e',
121+
status: 'pending',
110122
},
111123
{
112124
id: 13,
@@ -116,6 +128,7 @@ const list: User[] = [
116128
117129
avatarUrl:
118130
'https://images.unsplash.com/photo-1456327102063-fb5054efe647?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=200&fit=max&s=f05c14dd4db49f08a789e6449604c490',
131+
status: 'active',
119132
},
120133
{
121134
id: 14,
@@ -125,13 +138,15 @@ const list: User[] = [
125138
126139
avatarUrl:
127140
'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=200&fit=max&s=a72ca28288878f8404a795f39642a46f',
141+
status: 'active',
128142
},
129143
{
130144
id: 15,
131145
firstName: 'Lucy',
132146
lastName: 'Walker',
133147
134148
avatarUrl: 'https://randomuser.me/api/portraits/women/0.jpg',
149+
status: 'active',
135150
},
136151
].map(user => {
137152
const userToOrganization = usersToOrganizationsData.byUserId[user.id] || []

src/_api/_types/User.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export interface UserSubmissionData {
1818
password?: string
1919
avatarUrl?: string
2020
globalRole?: string
21+
status?: string
2122
}
2223

2324
export default interface User extends UserSubmissionData, Entity {

0 commit comments

Comments
 (0)