@bento-core/table 1.0.1-ccdiintegrated.4 → 1.0.1-ccdiintegrated.6
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/dist/body/DisplayBodyCell.js +5 -4
- package/dist/body/components/CustomLinkView.js +1 -1
- package/dist/body/components/DataFormatView.js +1 -1
- package/dist/index.js +6 -0
- package/dist/util/Dataformat.js +16 -3
- package/dist/wrapper/components/AddFiles.js +2 -0
- package/dist/wrapper/components/AddToCart/AddToCartView.js +5 -3
- package/dist/wrapper/components/AddToCart/ReduxAddToCart.js +1 -0
- package/dist/wrapper/components/CPIFilesView/CPIFilesView.js +1 -1
- package/dist/wrapper/components/ReduxAddFile.js +1 -0
- package/dist/wrapper/components/Snackbar/Snackbar.js +3 -1
- package/package.json +2 -2
- package/src/body/DisplayBodyCell.js +14 -5
- package/src/body/components/CustomLinkView.js +4 -2
- package/src/body/components/DataFormatView.js +4 -2
- package/src/index.js +6 -1
- package/src/util/Dataformat.js +8 -0
- package/src/wrapper/components/AddFiles.js +2 -0
- package/src/wrapper/components/AddToCart/AddToCartView.js +4 -2
- package/src/wrapper/components/AddToCart/ReduxAddToCart.js +1 -0
- package/src/wrapper/components/CPIFilesView/CPIFilesView.js +1 -1
- package/src/wrapper/components/ReduxAddFile.js +1 -0
- package/src/wrapper/components/Snackbar/Snackbar.js +3 -3
|
@@ -31,10 +31,11 @@ const CustomComponent = _ref => {
|
|
|
31
31
|
dataField,
|
|
32
32
|
customCellRender
|
|
33
33
|
} = column;
|
|
34
|
-
const
|
|
34
|
+
const raw = row[dataField];
|
|
35
|
+
const value = (0, _Dataformat.isBracketStripEnabled)(column) ? (0, _Dataformat.stripSurroundingBrackets)(raw) : raw;
|
|
35
36
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, customCellRender(_objectSpread(_objectSpread(_objectSpread({}, row), column), {}, {
|
|
36
|
-
[dataField]:
|
|
37
|
-
label:
|
|
37
|
+
[dataField]: value,
|
|
38
|
+
label: value
|
|
38
39
|
})));
|
|
39
40
|
};
|
|
40
41
|
|
|
@@ -90,7 +91,7 @@ const ViewCell = _ref2 => {
|
|
|
90
91
|
column: column
|
|
91
92
|
});
|
|
92
93
|
default:
|
|
93
|
-
return /*#__PURE__*/_react.default.createElement(_core.Typography, null, (0, _Dataformat.formatValueForDisplay)(row[column.dataField]));
|
|
94
|
+
return /*#__PURE__*/_react.default.createElement(_core.Typography, null, (0, _Dataformat.isBracketStripEnabled)(column) ? (0, _Dataformat.formatValueForDisplay)(row[column.dataField]) : row[column.dataField]);
|
|
94
95
|
}
|
|
95
96
|
};
|
|
96
97
|
const DisplayCell = _ref3 => {
|
|
@@ -25,7 +25,7 @@ const CustomLinkView = _ref => {
|
|
|
25
25
|
return /*#__PURE__*/_react.default.createElement(_core.Link, {
|
|
26
26
|
href: url,
|
|
27
27
|
className: _Types.cellTypes.LINK
|
|
28
|
-
}, /*#__PURE__*/_react.default.createElement(_core.Typography, null, (0, _Dataformat.formatValueForDisplay)(row[column === null || column === void 0 ? void 0 : column.dataField])));
|
|
28
|
+
}, /*#__PURE__*/_react.default.createElement(_core.Typography, null, (0, _Dataformat.isBracketStripEnabled)(column) ? (0, _Dataformat.formatValueForDisplay)(row[column === null || column === void 0 ? void 0 : column.dataField]) : row[column === null || column === void 0 ? void 0 : column.dataField]));
|
|
29
29
|
};
|
|
30
30
|
var _default = CustomLinkView;
|
|
31
31
|
exports.default = _default;
|
|
@@ -26,7 +26,7 @@ const CellView = _ref => {
|
|
|
26
26
|
case _Types.dataFormatTypes.FORMAT_BYTES:
|
|
27
27
|
return /*#__PURE__*/_react.default.createElement(_core.Typography, null, (0, _Dataformat.formatBytes)(value));
|
|
28
28
|
default:
|
|
29
|
-
return /*#__PURE__*/_react.default.createElement(_core.Typography, null, (0, _Dataformat.formatValueForDisplay)(value));
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement(_core.Typography, null, (0, _Dataformat.isBracketStripEnabled)(column) ? (0, _Dataformat.formatValueForDisplay)(value) : value);
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
const DataFormatView = _ref2 => {
|
package/dist/index.js
CHANGED
|
@@ -57,6 +57,12 @@ Object.defineProperty(exports, "headerTypes", {
|
|
|
57
57
|
return _Types.headerTypes;
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
|
+
Object.defineProperty(exports, "isBracketStripEnabled", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function get() {
|
|
63
|
+
return _Dataformat.isBracketStripEnabled;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
60
66
|
Object.defineProperty(exports, "stripSurroundingBrackets", {
|
|
61
67
|
enumerable: true,
|
|
62
68
|
get: function get() {
|
package/dist/util/Dataformat.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.formatBytes = formatBytes;
|
|
7
|
-
exports.stripSurroundingBrackets = exports.formatValueForDisplay = exports.formatColumnValues = void 0;
|
|
7
|
+
exports.stripSurroundingBrackets = exports.isBracketStripEnabled = exports.formatValueForDisplay = exports.formatColumnValues = void 0;
|
|
8
8
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
9
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
10
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -53,11 +53,21 @@ const formatColumnValues = (columns, data) => {
|
|
|
53
53
|
return data;
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Column flag `stripSurroundingBrackets: false` disables OpenSearch
|
|
58
|
+
* bracket-stripping for that column. Default (undefined/true) is enabled.
|
|
59
|
+
*/
|
|
60
|
+
exports.formatColumnValues = formatColumnValues;
|
|
61
|
+
const isBracketStripEnabled = function isBracketStripEnabled() {
|
|
62
|
+
let column = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
63
|
+
return column.stripSurroundingBrackets !== false;
|
|
64
|
+
};
|
|
65
|
+
|
|
56
66
|
/**
|
|
57
67
|
* Remove wrapping square brackets from OpenSearch array-as-string values.
|
|
58
68
|
* "[Complete Response]" => "Complete Response"; "[]" => "".
|
|
59
69
|
*/
|
|
60
|
-
exports.
|
|
70
|
+
exports.isBracketStripEnabled = isBracketStripEnabled;
|
|
61
71
|
const stripSurroundingBrackets = value => {
|
|
62
72
|
if (value == null) {
|
|
63
73
|
return value;
|
|
@@ -65,7 +75,10 @@ const stripSurroundingBrackets = value => {
|
|
|
65
75
|
if (Array.isArray(value)) {
|
|
66
76
|
return value.map(item => stripSurroundingBrackets(item));
|
|
67
77
|
}
|
|
68
|
-
|
|
78
|
+
if (typeof value !== 'string') {
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
81
|
+
const text = value.trim();
|
|
69
82
|
if (text === '[]') {
|
|
70
83
|
return '';
|
|
71
84
|
}
|
|
@@ -26,6 +26,7 @@ exports.btnTypes = btnTypes;
|
|
|
26
26
|
const AddFilesView = props => {
|
|
27
27
|
const {
|
|
28
28
|
count,
|
|
29
|
+
alreadyInCartCount,
|
|
29
30
|
alertMessage,
|
|
30
31
|
cartFiles,
|
|
31
32
|
buttonStyle
|
|
@@ -52,6 +53,7 @@ const AddFilesView = props => {
|
|
|
52
53
|
})), /*#__PURE__*/_react.default.createElement(_Snackbar.default, {
|
|
53
54
|
open: openSnackbar,
|
|
54
55
|
count: count,
|
|
56
|
+
alreadyInCartCount: alreadyInCartCount,
|
|
55
57
|
onClose: () => setOpenSnackbar(false)
|
|
56
58
|
}), displayAlter && /*#__PURE__*/_react.default.createElement(_AddToCartDialogAlertView.default, {
|
|
57
59
|
alertMessage: alertMessage,
|
|
@@ -69,7 +69,8 @@ const AddToCartView = props => {
|
|
|
69
69
|
fileId,
|
|
70
70
|
buttonStyle,
|
|
71
71
|
addFiles,
|
|
72
|
-
count
|
|
72
|
+
count,
|
|
73
|
+
alreadyInCartCount
|
|
73
74
|
} = props;
|
|
74
75
|
|
|
75
76
|
// const [isDataloading, setIsDataloading] = useState(false);
|
|
@@ -90,14 +91,14 @@ const AddToCartView = props => {
|
|
|
90
91
|
*/
|
|
91
92
|
const addAllFiles = () => {
|
|
92
93
|
const idsInitial = fileId || [];
|
|
93
|
-
const ids = [idsInitial];
|
|
94
|
+
const ids = Array.isArray(idsInitial) ? idsInitial : [idsInitial];
|
|
94
95
|
const fileCount = ids.length;
|
|
95
96
|
const upperLimit = 200000;
|
|
96
97
|
const cartCount = cartFiles.length;
|
|
97
98
|
if (fileCount <= upperLimit && cartCount < upperLimit) {
|
|
98
99
|
const newIds = checkDuplicate(cartFiles, ids);
|
|
99
100
|
if (cartCount + newIds.length <= upperLimit) {
|
|
100
|
-
addFiles(
|
|
101
|
+
addFiles(ids);
|
|
101
102
|
setOpenSnackbar(true);
|
|
102
103
|
} else {
|
|
103
104
|
setAlterDisplay(true);
|
|
@@ -115,6 +116,7 @@ const AddToCartView = props => {
|
|
|
115
116
|
}, "ADD TO CART"), /*#__PURE__*/_react.default.createElement(_Snackbar.default, {
|
|
116
117
|
open: openSnackbar,
|
|
117
118
|
count: count,
|
|
119
|
+
alreadyInCartCount: alreadyInCartCount,
|
|
118
120
|
onClose: () => setOpenSnackbar(false)
|
|
119
121
|
}), displayAlter && /*#__PURE__*/_react.default.createElement(_AddToCartDialogAlertView.default, {
|
|
120
122
|
alertMessage: "The cart is limited to 200,000 files. Please narrow the search criteria or remove some files from the cart to add more.",
|
|
@@ -16,6 +16,7 @@ const AddToCartRedux = props => /*#__PURE__*/_react.default.createElement(_AddTo
|
|
|
16
16
|
*/
|
|
17
17
|
const mapStateToProps = state => ({
|
|
18
18
|
count: state.cartReducer && state.cartReducer.count,
|
|
19
|
+
alreadyInCartCount: state.cartReducer && state.cartReducer.alreadyInCartCount,
|
|
19
20
|
cartFiles: state.cartReducer && state.cartReducer.filesId
|
|
20
21
|
});
|
|
21
22
|
const mapDispatchToProps = dispatch => ({
|
|
@@ -139,7 +139,7 @@ const CPIFilesComponent = props => {
|
|
|
139
139
|
const newIds = checkDuplicate(cartFiles, ids);
|
|
140
140
|
if (cartCount + newIds.length <= upperLimit) {
|
|
141
141
|
setOpen(true);
|
|
142
|
-
setAddFilesId(
|
|
142
|
+
setAddFilesId(ids);
|
|
143
143
|
} else {
|
|
144
144
|
setAlterDisplay(true);
|
|
145
145
|
}
|
|
@@ -16,6 +16,7 @@ const AddFilesRedux = props => /*#__PURE__*/_react.default.createElement(_AddFil
|
|
|
16
16
|
*/
|
|
17
17
|
const mapStateToProps = state => ({
|
|
18
18
|
count: state.cartReducer && state.cartReducer.count,
|
|
19
|
+
alreadyInCartCount: state.cartReducer && state.cartReducer.alreadyInCartCount,
|
|
19
20
|
cartFiles: state.cartReducer && state.cartReducer.filesId
|
|
20
21
|
});
|
|
21
22
|
const mapDispatchToProps = dispatch => ({
|
|
@@ -6,11 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _core = require("@material-ui/core");
|
|
9
|
+
var _cart = require("@bento-core/cart");
|
|
9
10
|
var _SuccessOutlined = _interopRequireDefault(require("./SuccessOutlined"));
|
|
10
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
12
|
const SnackbarView = props => {
|
|
12
13
|
const {
|
|
13
14
|
count,
|
|
15
|
+
alreadyInCartCount = 0,
|
|
14
16
|
open,
|
|
15
17
|
onClose
|
|
16
18
|
} = props;
|
|
@@ -38,7 +40,7 @@ const SnackbarView = props => {
|
|
|
38
40
|
className: "snackBarMessageIcon"
|
|
39
41
|
}, /*#__PURE__*/_react.default.createElement(_SuccessOutlined.default, null), ' '), /*#__PURE__*/_react.default.createElement("span", {
|
|
40
42
|
className: "snackBarText"
|
|
41
|
-
},
|
|
43
|
+
}, (0, _cart.formatCartAddMessage)(count, alreadyInCartCount)))
|
|
42
44
|
}));
|
|
43
45
|
};
|
|
44
46
|
var _default = SnackbarView;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bento-core/table",
|
|
3
|
-
"version": "1.0.1-ccdiintegrated.
|
|
3
|
+
"version": "1.0.1-ccdiintegrated.6",
|
|
4
4
|
"homepage": "https://github.com/CBIIT/bento-frontend#readme",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/CBIIT/bento-frontend/issues"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@apollo/client": "^3.8.3",
|
|
23
|
-
"@bento-core/cart": "1.0.1-ccdiintegrated.
|
|
23
|
+
"@bento-core/cart": "1.0.1-ccdiintegrated.2",
|
|
24
24
|
"@bento-core/tool-tip": "1.0.1-ccdiintegrated.1",
|
|
25
25
|
"@bento-core/util": "1.0.1-ccdiintegrated.1",
|
|
26
26
|
"clsx": "^2.1.1",
|
|
@@ -4,7 +4,11 @@ import {
|
|
|
4
4
|
Typography,
|
|
5
5
|
} from '@material-ui/core';
|
|
6
6
|
import { cellTypes } from '../util/Types';
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
formatValueForDisplay,
|
|
9
|
+
isBracketStripEnabled,
|
|
10
|
+
stripSurroundingBrackets,
|
|
11
|
+
} from '../util/Dataformat';
|
|
8
12
|
import CustomLinkView from './components/CustomLinkView';
|
|
9
13
|
import DataFormatView from './components/DataFormatView';
|
|
10
14
|
import CPIView from './components/CPIView';
|
|
@@ -19,14 +23,17 @@ const CustomComponent = ({
|
|
|
19
23
|
column,
|
|
20
24
|
}) => {
|
|
21
25
|
const { dataField, customCellRender } = column;
|
|
22
|
-
const
|
|
26
|
+
const raw = row[dataField];
|
|
27
|
+
const value = isBracketStripEnabled(column)
|
|
28
|
+
? stripSurroundingBrackets(raw)
|
|
29
|
+
: raw;
|
|
23
30
|
return (
|
|
24
31
|
<>
|
|
25
32
|
{customCellRender({
|
|
26
33
|
...row,
|
|
27
34
|
...column,
|
|
28
|
-
[dataField]:
|
|
29
|
-
label:
|
|
35
|
+
[dataField]: value,
|
|
36
|
+
label: value,
|
|
30
37
|
})}
|
|
31
38
|
</>
|
|
32
39
|
);
|
|
@@ -95,7 +102,9 @@ const ViewCell = ({
|
|
|
95
102
|
default:
|
|
96
103
|
return (
|
|
97
104
|
<Typography>
|
|
98
|
-
{
|
|
105
|
+
{isBracketStripEnabled(column)
|
|
106
|
+
? formatValueForDisplay(row[column.dataField])
|
|
107
|
+
: row[column.dataField]}
|
|
99
108
|
</Typography>
|
|
100
109
|
);
|
|
101
110
|
}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
Link, Typography,
|
|
4
4
|
} from '@material-ui/core';
|
|
5
5
|
import { cellTypes } from '../../util/Types';
|
|
6
|
-
import { formatValueForDisplay } from '../../util/Dataformat';
|
|
6
|
+
import { formatValueForDisplay, isBracketStripEnabled } from '../../util/Dataformat';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Custom Link component
|
|
@@ -17,7 +17,9 @@ const CustomLinkView = ({
|
|
|
17
17
|
return (
|
|
18
18
|
<Link href={url} className={cellTypes.LINK}>
|
|
19
19
|
<Typography>
|
|
20
|
-
{
|
|
20
|
+
{isBracketStripEnabled(column)
|
|
21
|
+
? formatValueForDisplay(row[column?.dataField])
|
|
22
|
+
: row[column?.dataField]}
|
|
21
23
|
</Typography>
|
|
22
24
|
</Link>
|
|
23
25
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Typography } from '@material-ui/core';
|
|
3
3
|
import { dataFormatTypes } from '../../util/Types';
|
|
4
|
-
import { formatBytes, formatValueForDisplay } from '../../util/Dataformat';
|
|
4
|
+
import { formatBytes, formatValueForDisplay, isBracketStripEnabled } from '../../util/Dataformat';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* dataformat view for file size (byte, MB, GB)
|
|
@@ -23,7 +23,9 @@ const CellView = ({
|
|
|
23
23
|
default:
|
|
24
24
|
return (
|
|
25
25
|
<Typography>
|
|
26
|
-
{
|
|
26
|
+
{isBracketStripEnabled(column)
|
|
27
|
+
? formatValueForDisplay(value)
|
|
28
|
+
: value}
|
|
27
29
|
</Typography>
|
|
28
30
|
);
|
|
29
31
|
}
|
package/src/index.js
CHANGED
|
@@ -6,5 +6,10 @@ export {
|
|
|
6
6
|
ComponentTypes,
|
|
7
7
|
dataFormatTypes,
|
|
8
8
|
} from './util/Types';
|
|
9
|
-
export {
|
|
9
|
+
export {
|
|
10
|
+
formatBytes,
|
|
11
|
+
stripSurroundingBrackets,
|
|
12
|
+
formatValueForDisplay,
|
|
13
|
+
isBracketStripEnabled,
|
|
14
|
+
} from './util/Dataformat';
|
|
10
15
|
export { default as AddToCart } from './wrapper/components/AddToCart/ReduxAddToCart';
|
package/src/util/Dataformat.js
CHANGED
|
@@ -32,6 +32,14 @@ export const formatColumnValues = (columns, data) => {
|
|
|
32
32
|
return data;
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Column flag `stripSurroundingBrackets: false` disables OpenSearch
|
|
37
|
+
* bracket-stripping for that column. Default (undefined/true) is enabled.
|
|
38
|
+
*/
|
|
39
|
+
export const isBracketStripEnabled = (column = {}) => (
|
|
40
|
+
column.stripSurroundingBrackets !== false
|
|
41
|
+
);
|
|
42
|
+
|
|
35
43
|
/**
|
|
36
44
|
* Remove wrapping square brackets from OpenSearch array-as-string values.
|
|
37
45
|
* "[Complete Response]" => "Complete Response"; "[]" => "".
|
|
@@ -16,6 +16,7 @@ export const btnTypes = {
|
|
|
16
16
|
const AddFilesView = (props) => {
|
|
17
17
|
const {
|
|
18
18
|
count,
|
|
19
|
+
alreadyInCartCount,
|
|
19
20
|
alertMessage,
|
|
20
21
|
cartFiles,
|
|
21
22
|
buttonStyle,
|
|
@@ -46,6 +47,7 @@ const AddFilesView = (props) => {
|
|
|
46
47
|
<SnackbarView
|
|
47
48
|
open={openSnackbar}
|
|
48
49
|
count={count}
|
|
50
|
+
alreadyInCartCount={alreadyInCartCount}
|
|
49
51
|
onClose={() => setOpenSnackbar(false)}
|
|
50
52
|
/>
|
|
51
53
|
{(displayAlter) && (
|
|
@@ -66,6 +66,7 @@ const AddToCartView = (props) => {
|
|
|
66
66
|
buttonStyle,
|
|
67
67
|
addFiles,
|
|
68
68
|
count,
|
|
69
|
+
alreadyInCartCount,
|
|
69
70
|
} = props;
|
|
70
71
|
|
|
71
72
|
// const [isDataloading, setIsDataloading] = useState(false);
|
|
@@ -85,14 +86,14 @@ const AddToCartView = (props) => {
|
|
|
85
86
|
*/
|
|
86
87
|
const addAllFiles = () => {
|
|
87
88
|
const idsInitial = fileId || [];
|
|
88
|
-
const ids = [idsInitial];
|
|
89
|
+
const ids = Array.isArray(idsInitial) ? idsInitial : [idsInitial];
|
|
89
90
|
const fileCount = ids.length;
|
|
90
91
|
const upperLimit = 200000;
|
|
91
92
|
const cartCount = cartFiles.length;
|
|
92
93
|
if (fileCount <= upperLimit && cartCount < upperLimit) {
|
|
93
94
|
const newIds = checkDuplicate(cartFiles, ids);
|
|
94
95
|
if (cartCount + newIds.length <= upperLimit) {
|
|
95
|
-
addFiles(
|
|
96
|
+
addFiles(ids);
|
|
96
97
|
setOpenSnackbar(true);
|
|
97
98
|
} else {
|
|
98
99
|
setAlterDisplay(true);
|
|
@@ -116,6 +117,7 @@ const AddToCartView = (props) => {
|
|
|
116
117
|
<SnackbarView
|
|
117
118
|
open={openSnackbar}
|
|
118
119
|
count={count}
|
|
120
|
+
alreadyInCartCount={alreadyInCartCount}
|
|
119
121
|
onClose={() => setOpenSnackbar(false)}
|
|
120
122
|
/>
|
|
121
123
|
{displayAlter && (
|
|
@@ -10,6 +10,7 @@ const AddToCartRedux = (props) => <AddToCartView {...props} />;
|
|
|
10
10
|
*/
|
|
11
11
|
const mapStateToProps = (state) => ({
|
|
12
12
|
count: state.cartReducer && state.cartReducer.count,
|
|
13
|
+
alreadyInCartCount: state.cartReducer && state.cartReducer.alreadyInCartCount,
|
|
13
14
|
cartFiles: state.cartReducer && state.cartReducer.filesId,
|
|
14
15
|
});
|
|
15
16
|
|
|
@@ -139,7 +139,7 @@ const CPIFilesComponent = (props) => {
|
|
|
139
139
|
const newIds = checkDuplicate(cartFiles, ids);
|
|
140
140
|
if (cartCount + newIds.length <= upperLimit) {
|
|
141
141
|
setOpen(true);
|
|
142
|
-
setAddFilesId(
|
|
142
|
+
setAddFilesId(ids);
|
|
143
143
|
} else {
|
|
144
144
|
setAlterDisplay(true);
|
|
145
145
|
}
|
|
@@ -10,6 +10,7 @@ const AddFilesRedux = (props) => <AddFiles {...props} />;
|
|
|
10
10
|
*/
|
|
11
11
|
const mapStateToProps = (state) => ({
|
|
12
12
|
count: state.cartReducer && state.cartReducer.count,
|
|
13
|
+
alreadyInCartCount: state.cartReducer && state.cartReducer.alreadyInCartCount,
|
|
13
14
|
cartFiles: state.cartReducer && state.cartReducer.filesId,
|
|
14
15
|
});
|
|
15
16
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Snackbar } from '@material-ui/core';
|
|
3
|
+
import { formatCartAddMessage } from '@bento-core/cart';
|
|
3
4
|
import SuccessOutlinedIcon from './SuccessOutlined';
|
|
4
5
|
|
|
5
6
|
const SnackbarView = (props) => {
|
|
6
7
|
const {
|
|
7
8
|
count,
|
|
9
|
+
alreadyInCartCount = 0,
|
|
8
10
|
open,
|
|
9
11
|
onClose,
|
|
10
12
|
} = props;
|
|
@@ -30,9 +32,7 @@ const SnackbarView = (props) => {
|
|
|
30
32
|
{' '}
|
|
31
33
|
</span>
|
|
32
34
|
<span className="snackBarText">
|
|
33
|
-
{count}
|
|
34
|
-
{' '}
|
|
35
|
-
File(s) successfully added to your cart
|
|
35
|
+
{formatCartAddMessage(count, alreadyInCartCount)}
|
|
36
36
|
</span>
|
|
37
37
|
</div>
|
|
38
38
|
)}
|