@truedat/auth 6.16.1 → 6.16.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/auth",
3
- "version": "6.16.1",
3
+ "version": "6.16.5",
4
4
  "description": "Truedat Web Auth",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -109,5 +109,5 @@
109
109
  "react-dom": ">= 16.8.6 < 17",
110
110
  "semantic-ui-react": ">= 2.0.3 < 2.2"
111
111
  },
112
- "gitHead": "717d91b523c2e29e373791fef9c12b3a561449b7"
112
+ "gitHead": "c48a14cb239ca2b3e559467c9e153f19513a7521"
113
113
  }
@@ -37,6 +37,13 @@ export const User = ({ user }) => {
37
37
  <UserActions />
38
38
  </Grid.Column>
39
39
  <Grid.Column width={8}>
40
+ {user.external_id == null ? (
41
+ user.external_id
42
+ ) : (
43
+ <>
44
+ {user.external_id} <br />
45
+ </>
46
+ )}
40
47
  {user.full_name}
41
48
  <br />
42
49
  {user.email}
@@ -6,14 +6,17 @@ import { Link } from "react-router-dom";
6
6
  import { linkTo } from "@truedat/core/routes";
7
7
  import { deleteUser } from "../routines";
8
8
 
9
- export const UserCard = ({ user: { user_name, id, full_name, email } }) => (
9
+ export const UserCard = ({
10
+ user: { user_name, id, full_name, email, external_id },
11
+ showFullName = true,
12
+ }) => (
10
13
  <Card key={id}>
11
14
  <Card.Content>
12
15
  <Card.Header as={Link} to={linkTo.USER({ id })}>
13
16
  <Icon name="user" /> {user_name}
14
17
  </Card.Header>
15
18
  <Card.Description>
16
- {full_name}
19
+ {showFullName ? full_name : external_id}
17
20
  <br />
18
21
  {email}
19
22
  </Card.Description>
@@ -23,6 +26,7 @@ export const UserCard = ({ user: { user_name, id, full_name, email } }) => (
23
26
 
24
27
  UserCard.propTypes = {
25
28
  user: PropTypes.object,
29
+ showFullName: PropTypes.bool,
26
30
  };
27
31
 
28
32
  export default connect(null, { deleteUser })(UserCard);
@@ -10,7 +10,7 @@ import { USERS_NEW } from "@truedat/core/routes";
10
10
  import { filterUsers } from "../selectors/filterUsers";
11
11
  import UserCard from "./UserCard";
12
12
 
13
- export const UserCards = ({ users: allUsers }) => {
13
+ export const UserCards = ({ users: allUsers, showFullName }) => {
14
14
  const [filter, setFilter] = useState("");
15
15
  const { formatMessage } = useIntl();
16
16
  const users = _.flow(_.sortBy("user_name"), filterUsers(filter))(allUsers);
@@ -43,7 +43,7 @@ export const UserCards = ({ users: allUsers }) => {
43
43
  />
44
44
  <Card.Group>
45
45
  {users.map((user, i) => (
46
- <UserCard key={i} user={user} />
46
+ <UserCard key={i} user={user} showFullname={showFullName} />
47
47
  ))}
48
48
  </Card.Group>
49
49
  </React.Fragment>
@@ -65,8 +65,13 @@ export const UserCards = ({ users: allUsers }) => {
65
65
 
66
66
  UserCards.propTypes = {
67
67
  users: PropTypes.array,
68
+ showFullName: PropTypes.bool,
68
69
  };
69
70
 
70
- export const mapStateToProps = ({ users }) => ({ users });
71
+ export const mapStateToProps = (state) => ({
72
+ users: state.users,
73
+ UserCard: state.userCard,
74
+ showFullName: state.userCardFullName,
75
+ });
71
76
 
72
77
  export default connect(mapStateToProps)(UserCards);
@@ -10,11 +10,17 @@ describe("<UserCard />", () => {
10
10
  role: "admin",
11
11
  full_name: "Joe Bloggs",
12
12
  email: "joe@bloggs.net",
13
+ uid: "uID00001",
13
14
  };
14
- const props = { user, deleteUser };
15
+ const props_fullname = { user, deleteUser, showFullname: true };
16
+ const props_uid = { user, deleteUser, showFullname: false };
15
17
 
16
18
  it("matches the latest snapshot", () => {
17
- const wrapper = shallow(<UserCard {...props} />);
19
+ const wrapper = shallow(<UserCard {...props_fullname} />);
20
+ expect(wrapper).toMatchSnapshot();
21
+ });
22
+ it("matches the latest snapshot", () => {
23
+ const wrapper = shallow(<UserCard {...props_uid} />);
18
24
  expect(wrapper).toMatchSnapshot();
19
25
  });
20
26
  });
@@ -37,3 +37,41 @@ exports[`<UserCard /> matches the latest snapshot 1`] = `
37
37
  </CardContent>
38
38
  </Card>
39
39
  `;
40
+
41
+ exports[`<UserCard /> matches the latest snapshot 2`] = `
42
+ <Card
43
+ key="1"
44
+ >
45
+ <CardContent>
46
+ <CardHeader
47
+ as={
48
+ {
49
+ "$$typeof": Symbol(react.forward_ref),
50
+ "displayName": "Link",
51
+ "propTypes": {
52
+ "innerRef": [Function],
53
+ "onClick": [Function],
54
+ "replace": [Function],
55
+ "target": [Function],
56
+ "to": [Function],
57
+ },
58
+ "render": [Function],
59
+ }
60
+ }
61
+ to="/users/1"
62
+ >
63
+ <Icon
64
+ as="i"
65
+ name="user"
66
+ />
67
+
68
+ joe
69
+ </CardHeader>
70
+ <CardDescription>
71
+ Joe Bloggs
72
+ <br />
73
+ joe@bloggs.net
74
+ </CardDescription>
75
+ </CardContent>
76
+ </Card>
77
+ `;