@truedat/dd 6.1.1 → 6.1.2

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/dd",
3
- "version": "6.1.1",
3
+ "version": "6.1.2",
4
4
  "description": "Truedat Web Data Dictionary",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -34,7 +34,7 @@
34
34
  "@testing-library/jest-dom": "^5.16.5",
35
35
  "@testing-library/react": "^12.0.0",
36
36
  "@testing-library/user-event": "^13.2.1",
37
- "@truedat/test": "6.1.1",
37
+ "@truedat/test": "6.1.2",
38
38
  "babel-jest": "^28.1.0",
39
39
  "babel-plugin-dynamic-import-node": "^2.3.3",
40
40
  "babel-plugin-lodash": "^3.3.4",
@@ -88,9 +88,9 @@
88
88
  },
89
89
  "dependencies": {
90
90
  "@apollo/client": "^3.7.1",
91
- "@truedat/auth": "6.1.1",
92
- "@truedat/core": "6.1.1",
93
- "@truedat/df": "6.1.1",
91
+ "@truedat/auth": "6.1.2",
92
+ "@truedat/core": "6.1.2",
93
+ "@truedat/df": "6.1.2",
94
94
  "lodash": "^4.17.21",
95
95
  "moment": "^2.29.4",
96
96
  "path-to-regexp": "^1.7.0",
@@ -115,5 +115,5 @@
115
115
  "react-dom": ">= 16.8.6 < 17",
116
116
  "semantic-ui-react": ">= 2.0.3 < 2.2"
117
117
  },
118
- "gitHead": "8ba2e1d68380956d654d6927a6117734f1c50076"
118
+ "gitHead": "34f3dad97550142a4a23048fee3214ce04e957bf"
119
119
  }
@@ -2,10 +2,11 @@ import _ from "lodash/fp";
2
2
  import React from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { Button, Dropdown, Popup, Header } from "semantic-ui-react";
5
- import { useIntl } from "react-intl";
5
+ import { FormattedMessage, useIntl } from "react-intl";
6
6
  import { useHistory } from "react-router-dom";
7
7
  import { linkTo } from "@truedat/core/routes";
8
8
  import { Date } from "@truedat/core/components";
9
+ import { config } from "@truedat/core/truedatConfig";
9
10
 
10
11
  import GrantChangeRequest from "./GrantChangeRequest";
11
12
  import GrantRequestCancel from "./GrantRequestCancel";
@@ -97,6 +98,9 @@ export const StructureGrantDropdown = ({
97
98
  header: isModification
98
99
  ? "structure.grant.requested_modification"
99
100
  : "structure.grant.requested_access",
101
+ buttonContent: isModification
102
+ ? "structure.grant.requested_modification.short"
103
+ : "structure.grant.requested_access.short",
100
104
  },
101
105
  processingRequest: {
102
106
  color: "grey",
@@ -104,11 +108,15 @@ export const StructureGrantDropdown = ({
104
108
  header: isModification
105
109
  ? "structure.grant.modification.attended"
106
110
  : "structure.grant.access.attended",
111
+ buttonContent: isModification
112
+ ? "structure.grant.modification.attended.short"
113
+ : "structure.grant.access.attended.short",
107
114
  },
108
115
  activeGrant: {
109
116
  color: "green",
110
117
  options: [actions["requestChange"]],
111
118
  header: "structure.grant.has_grant",
119
+ buttonContent: "structure.grant.has_grant.short",
112
120
  },
113
121
  };
114
122
 
@@ -145,11 +153,23 @@ export const StructureGrantDropdown = ({
145
153
  </>
146
154
  );
147
155
 
156
+ const buttonContent = (
157
+ <FormattedMessage
158
+ id={stateProps?.buttonContent}
159
+ defaultMessage={stateProps?.buttonContent}
160
+ />
161
+ );
162
+
148
163
  const optionsWithCart =
149
164
  authorized && !requested
150
165
  ? [actions["addToCart"], ...stateProps.options]
151
166
  : stateProps?.options;
152
167
 
168
+ const { iconName, hasText } = config?.structureGrantRequestButton || {
169
+ iconName: "shield",
170
+ hasText: false,
171
+ };
172
+
153
173
  const trigger = (
154
174
  <Dropdown
155
175
  icon={null}
@@ -159,7 +179,8 @@ export const StructureGrantDropdown = ({
159
179
  <Button
160
180
  color={stateProps.color}
161
181
  className="button basic icon group-actions"
162
- icon="shield"
182
+ icon={iconName || null}
183
+ content={hasText ? buttonContent : null}
163
184
  />
164
185
  }
165
186
  >
@@ -1,8 +1,9 @@
1
1
  import React from "react";
2
2
  import PropTypes from "prop-types";
3
- import { Button, Icon, Popup } from "semantic-ui-react";
3
+ import { Button, Popup } from "semantic-ui-react";
4
4
  import { connect } from "react-redux";
5
5
  import { useIntl } from "react-intl";
6
+ import { config } from "@truedat/core/truedatConfig";
6
7
  import { addGrantRequestToCart, removeGrantRequestFromCart } from "../routines";
7
8
 
8
9
  export const StructureGrantRequestButton = ({
@@ -12,6 +13,10 @@ export const StructureGrantRequestButton = ({
12
13
  addGrantRequestToCart,
13
14
  removeGrantRequestFromCart,
14
15
  }) => {
16
+ const { iconName, hasText } = config?.structureGrantRequestButton || {
17
+ iconName: "shield",
18
+ hasText: false,
19
+ };
15
20
  const { formatMessage } = useIntl();
16
21
  const addRequest = () => {
17
22
  addGrantRequestToCart(structure);
@@ -20,14 +25,24 @@ export const StructureGrantRequestButton = ({
20
25
  const removeRequest = () => {
21
26
  removeGrantRequestFromCart(structure);
22
27
  };
23
- const content = formatMessage({
28
+ const popupContent = formatMessage({
24
29
  id: requested
25
30
  ? "structure.grant.requested_grant"
26
31
  : "structure.grant.request_grant",
27
32
  });
28
- const trigger = (
33
+
34
+ const buttonContentMessageId = requested
35
+ ? "structure.grant.requested_grant.short"
36
+ : "structure.grant.request_grant.short";
37
+ const buttonContent = formatMessage({
38
+ id: buttonContentMessageId,
39
+ defaultMessage: buttonContentMessageId,
40
+ });
41
+
42
+ const button = (
29
43
  <Button
30
- icon={<Icon name="shield" />}
44
+ icon={iconName || null}
45
+ content={hasText ? buttonContent : null}
31
46
  className="button basic icon group-actions"
32
47
  color={requested ? "blue" : "orange"}
33
48
  onClick={requested ? removeRequest : addRequest}
@@ -35,7 +50,7 @@ export const StructureGrantRequestButton = ({
35
50
  );
36
51
 
37
52
  return authorized ? (
38
- <Popup content={content} position="top center" trigger={trigger} />
53
+ <Popup content={popupContent} position="top center" trigger={button} />
39
54
  ) : null;
40
55
  };
41
56