@capillarytech/creatives-library 0.1.29 → 0.1.31
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/components/FormBuilder/_formBuilder.scss +19 -0
- package/components/FormBuilder/index.js +30 -12
- package/components/NewSidebar/_newsidebar.scss +115 -0
- package/components/NewSidebar/index.js +234 -0
- package/components/NewSidebar/messages.js +21 -0
- package/components/NewSidebar/tests/index.test.js +10 -0
- package/components/NewTopBar/_newtopbar.scss +84 -0
- package/components/NewTopBar/assets/images/capillary_logo.png +0 -0
- package/components/NewTopBar/assets/images/capillary_logo_2.png +0 -0
- package/components/NewTopBar/index.js +195 -0
- package/components/NewTopBar/messages.js +29 -0
- package/components/NewTopBar/tests/index.test.js +10 -0
- package/components/PreviewSideBar/index.js +1 -0
- package/components/TemplatePreview/_templatePreview.scss +120 -39
- package/components/TemplatePreview/index.js +36 -6
- package/components/TemplatePreview/messages.js +11 -3
- package/containers/Cap/index.js +37 -4
- package/containers/Cap/reducer.js +1 -2
- package/containers/Cap/selectors.js +1 -0
- package/containers/Line/Create/index.js +3 -2
- package/containers/Line/Create/sagas.js +1 -2
- package/containers/Sms/Create/index.js +3 -2
- package/containers/Sms/Edit/index.js +4 -4
- package/containers/Templates/index.js +55 -42
- package/containers/WeChat/index.js +1 -0
- package/package.json +3 -1
- package/utils/smsCharCountV2.js +143 -0
|
@@ -64,3 +64,22 @@
|
|
|
64
64
|
.ant-notification-notice-description {
|
|
65
65
|
word-wrap: break-word;
|
|
66
66
|
}
|
|
67
|
+
|
|
68
|
+
.preview-chars{
|
|
69
|
+
margin-top: 8px;
|
|
70
|
+
div{
|
|
71
|
+
display: inline-block;
|
|
72
|
+
font-size: 16px;
|
|
73
|
+
margin: 4px;
|
|
74
|
+
font-family: Open-Sans;
|
|
75
|
+
text-align: center;
|
|
76
|
+
width: 24px;
|
|
77
|
+
height: 24px;
|
|
78
|
+
line-height: 24px;
|
|
79
|
+
padding: 0 4px 4px 4px;
|
|
80
|
+
border: 0.5px solid;
|
|
81
|
+
&.invalid{
|
|
82
|
+
border-color: #F34F56;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -9,7 +9,7 @@ import React, { PropTypes } from 'react';
|
|
|
9
9
|
import { Label } from 'semantic-ui-react';
|
|
10
10
|
import _ from 'lodash';
|
|
11
11
|
import { Tabs, Row, Col, Table, Modal, notification} from 'antd';
|
|
12
|
-
import { CapButton, CapInput, CapPopover, CapTextArea, CapCheckbox, CapRadio, CapRadioGroup, CapSelect, CapTable} from '@capillarytech/cap-react-ui-library';
|
|
12
|
+
import { CapButton, CapInput, CapPopover, CapTextArea, CapCheckbox, CapRadio, CapRadioGroup, CapSelect, CapTable, CapColumn} from '@capillarytech/cap-react-ui-library';
|
|
13
13
|
import TemplatePreview from '../../components/TemplatePreview';
|
|
14
14
|
// import { CapCheckbox } from '@capillarytech/cap-react-ui-library/basic/checkbox';
|
|
15
15
|
import TagList from '../../containers/TagList';
|
|
@@ -21,6 +21,7 @@ import CKEditor from "../../components/Ckeditor/";
|
|
|
21
21
|
import EDMEditor from "../../components/Edmeditor";
|
|
22
22
|
import CustomPopOver from '../../components/CustomPopOver';
|
|
23
23
|
import './_formBuilder.scss';
|
|
24
|
+
import {updateCharCount, checkUnicode} from "../../utils/smsCharCountV2";
|
|
24
25
|
const TabPane = Tabs.TabPane;
|
|
25
26
|
const {Column} = Table;
|
|
26
27
|
// import styled from 'styled-components';
|
|
@@ -463,7 +464,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
463
464
|
}
|
|
464
465
|
const content = this.state.formData[count][`sms-editor${index > 1 ? index : ''}`];
|
|
465
466
|
const unicodeCheck = this.state.formData[count][`unicode-validity${index > 1 ? index : ''}`];
|
|
466
|
-
const ifUnicode = content && content !== '' ?
|
|
467
|
+
const ifUnicode = content && content !== '' ? checkUnicode(content) : false;
|
|
467
468
|
console.log('characters are', ifUnicode, unicodeCheck);
|
|
468
469
|
const tagValidationResponse = this.validateTags(content, tags, injectedTags);
|
|
469
470
|
console.log('tag valid response', tagValidationResponse);
|
|
@@ -515,14 +516,17 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
515
516
|
}
|
|
516
517
|
}
|
|
517
518
|
|
|
518
|
-
if ( (this.state.formData['0'].image !== undefined)){
|
|
519
|
+
if ( (this.state.formData['0'].image !== undefined) && (this.state.formData['0'].imagePreview !== undefined)){
|
|
519
520
|
const imgContentLength = this.state.formData['0'].image.length;
|
|
520
|
-
|
|
521
|
+
const imgContentLengthPreview = this.state.formData['0'].imagePreview.length;
|
|
522
|
+
if ( (imgContentLength < 1) && (imgContentLengthPreview < 1) ) {
|
|
521
523
|
console.log('line error validation image content is empty');
|
|
522
524
|
errorData['0'].image = true;
|
|
525
|
+
errorData['0'].imagePreview = true;
|
|
523
526
|
isValid = false;
|
|
524
527
|
}else{
|
|
525
528
|
errorData['0'].image = false;
|
|
529
|
+
errorData['0'].imagePreview = false;
|
|
526
530
|
}
|
|
527
531
|
}
|
|
528
532
|
if(type !== 'embedded' && (!this.state.formData['template-name'] || this.state.formData['template-name'] === '')) {
|
|
@@ -1037,9 +1041,12 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1037
1041
|
const ifSkipped = this.skipTags(tagValue);
|
|
1038
1042
|
if (ifSkipped) {
|
|
1039
1043
|
ifSupported = true;
|
|
1040
|
-
|
|
1041
|
-
if(
|
|
1042
|
-
response.missingTags.
|
|
1044
|
+
let isUnsubscribeSkipped = tagValue.indexOf("unsubscribe") != -1 ;
|
|
1045
|
+
if (isUnsubscribeSkipped) {
|
|
1046
|
+
const missingTagIndex = response.missingTags.indexOf("unsubscribe");
|
|
1047
|
+
if(missingTagIndex != -1) { //skip regex tags for mandatory tags also
|
|
1048
|
+
response.missingTags.splice(missingTagIndex, 1);
|
|
1049
|
+
}
|
|
1043
1050
|
}
|
|
1044
1051
|
}
|
|
1045
1052
|
ifSupported = ifSupported || this.checkIfSupportedTag(tagValue, injectedTags);
|
|
@@ -1047,6 +1054,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1047
1054
|
response.unsupportedTags.push(tagValue);
|
|
1048
1055
|
response.valid = false;
|
|
1049
1056
|
}
|
|
1057
|
+
if (response.unsupportedTags.length == 0 && response.missingTags.length == 0 ) {
|
|
1058
|
+
response.valid = true;
|
|
1059
|
+
}
|
|
1050
1060
|
}
|
|
1051
1061
|
return response;
|
|
1052
1062
|
}
|
|
@@ -1326,7 +1336,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1326
1336
|
delete tempFormData[key];
|
|
1327
1337
|
} else if (typeof element === "object") {
|
|
1328
1338
|
_.forEach(element, (innerElement, innerKey) => {
|
|
1329
|
-
if (innerKey !== "tabKey" && innerKey !== "base" && innerKey !== 'name' && this.formElements.indexOf(innerKey) === -1) {
|
|
1339
|
+
if (innerKey !== "tabKey" && innerKey !== "base" && innerKey !== 'name' && innerKey !== 'imagePreview' && this.formElements.indexOf(innerKey) === -1) {
|
|
1330
1340
|
delete tempFormData[key][innerKey];
|
|
1331
1341
|
}
|
|
1332
1342
|
});
|
|
@@ -2273,6 +2283,12 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2273
2283
|
);
|
|
2274
2284
|
}
|
|
2275
2285
|
break;
|
|
2286
|
+
case "contentPreview":
|
|
2287
|
+
const content = isVersionEnable ? this.state.formData[this.state.currentTab - 1]['sms-editor'] : this.state.formData['sms-editor'];
|
|
2288
|
+
const charList = updateCharCount(content).char_list;
|
|
2289
|
+
columns.push(<CapColumn id={val.id} className={"preview-chars"} span={val.width}>
|
|
2290
|
+
{charList.map((char) => char)}
|
|
2291
|
+
</CapColumn>);
|
|
2276
2292
|
case "checkbox":
|
|
2277
2293
|
ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2278
2294
|
if (styling === 'semantic') {
|
|
@@ -2325,13 +2341,14 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2325
2341
|
return true;
|
|
2326
2342
|
}
|
|
2327
2343
|
content = isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][`sms-editor${this.state.currentTab > 1 ? this.state.currentTab : ''}`] : this.state.formData[val.id];
|
|
2328
|
-
|
|
2344
|
+
const unicodeEnabled = isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][`unicode-validity${this.state.currentTab > 1 ? this.state.currentTab : ''}`] : this.state.formData['unicode-validity'];
|
|
2329
2345
|
columns.push(
|
|
2330
2346
|
<Col key="input" span={10}>
|
|
2331
2347
|
<TemplatePreview
|
|
2332
2348
|
channel={val.channel ? val.channel : 'SMS'}
|
|
2333
2349
|
content={content}
|
|
2334
2350
|
charCounterEnabled={val.charCounterEnabled}
|
|
2351
|
+
unicodeEnabled={unicodeEnabled}
|
|
2335
2352
|
>
|
|
2336
2353
|
</TemplatePreview>
|
|
2337
2354
|
</Col>
|
|
@@ -2770,7 +2787,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2770
2787
|
return true;
|
|
2771
2788
|
}
|
|
2772
2789
|
content = isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][`sms-editor${this.state.currentTab > 1 ? this.state.currentTab : ''}`] : this.state.formData[val.id];
|
|
2773
|
-
|
|
2790
|
+
const unicodeEnabled = isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][`unicode-validity${this.state.currentTab > 1 ? this.state.currentTab : ''}`] : this.state.formData['unicode-validity'];
|
|
2774
2791
|
columns.push(
|
|
2775
2792
|
<Col key="input" span={23} offset={1}>
|
|
2776
2793
|
<TemplatePreview
|
|
@@ -2779,6 +2796,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2779
2796
|
channel={val.channel ? val.channel : 'SMS'}
|
|
2780
2797
|
content={content}
|
|
2781
2798
|
charCounterEnabled={val.charCounterEnabled}
|
|
2799
|
+
unicodeEnabled={unicodeEnabled}
|
|
2782
2800
|
>
|
|
2783
2801
|
</TemplatePreview>
|
|
2784
2802
|
</Col>
|
|
@@ -2786,10 +2804,10 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2786
2804
|
}
|
|
2787
2805
|
break;
|
|
2788
2806
|
case "line-preview": {
|
|
2789
|
-
console.log("lipak inside", this.state.formData['0'].
|
|
2807
|
+
console.log("lipak inside imagePreview@@@", this.state.formData['0'].imagePreview);
|
|
2790
2808
|
const content = {
|
|
2791
2809
|
bodyText: isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][`message-editor${this.state.currentTab > 1 ? this.state.currentTab : ''}`] : this.state.formData[val.id],
|
|
2792
|
-
bodyImage: this.state.formData[`${this.state.currentTab - 1}`].
|
|
2810
|
+
bodyImage: this.state.formData[`${this.state.currentTab - 1}`].imagePreview,
|
|
2793
2811
|
};
|
|
2794
2812
|
if (!this.state.formData[`${this.state.currentTab - 1}`]) {
|
|
2795
2813
|
return true;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
#cap-sidebar{
|
|
2
|
+
padding: 8px 0 8px 0;
|
|
3
|
+
max-width: 200px;
|
|
4
|
+
min-width: 200px;
|
|
5
|
+
width: 16%;
|
|
6
|
+
overflow-y: hidden;
|
|
7
|
+
// height: 100%;
|
|
8
|
+
// display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
|
|
9
|
+
// display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
|
|
10
|
+
// display: -ms-flexbox; /* TWEENER - IE 10 */
|
|
11
|
+
// display: -webkit-flex; /* NEW - Chrome */
|
|
12
|
+
// display: flex;
|
|
13
|
+
overflow-x: hidden;
|
|
14
|
+
.header.item{
|
|
15
|
+
padding-left: 8px !important;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.sidebar-container {
|
|
20
|
+
display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
|
|
21
|
+
display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
|
|
22
|
+
display: -ms-flexbox; /* TWEENER - IE 10 */
|
|
23
|
+
display: -webkit-flex; /* NEW - Chrome */
|
|
24
|
+
display: flex;
|
|
25
|
+
flex: 1;
|
|
26
|
+
-webkit-box-flex: 1;
|
|
27
|
+
-webkit-flex: 1;
|
|
28
|
+
-ms-flex: 1;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.sidebar-accordian .content .item.menu-item:hover{
|
|
32
|
+
margin-left: 0 !important;
|
|
33
|
+
text-indent: 0 !important;
|
|
34
|
+
}
|
|
35
|
+
.sidebar-accordian .content .item.menu-item.selected{
|
|
36
|
+
margin-left: 0 !important;
|
|
37
|
+
text-indent: 0 !important;
|
|
38
|
+
}
|
|
39
|
+
.ui.accordion.sidebar-accordian .content .item.selected{
|
|
40
|
+
background: #F2F3F7 !important;
|
|
41
|
+
padding-left: 40px !important;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.item.menu-item{
|
|
45
|
+
// margin-left: 0px;
|
|
46
|
+
padding-left: 40px !important;
|
|
47
|
+
border-left-width: 0 !important;
|
|
48
|
+
text-decoration: none;
|
|
49
|
+
}
|
|
50
|
+
.item.menu-item.selected{
|
|
51
|
+
border-left: 4px solid #2e89df !important;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.item.menu-item.assetItem{
|
|
55
|
+
padding-left: 28px !important;
|
|
56
|
+
line-height: 28px;
|
|
57
|
+
padding-top: 8px;
|
|
58
|
+
padding-bottom: 8px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.ui.accordion.sidebar-accordian {
|
|
62
|
+
padding-top: 8px !important;
|
|
63
|
+
margin-left: 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.ui.accordion.sidebar-accordian .title{
|
|
67
|
+
font-size: 12px !important;
|
|
68
|
+
line-height: 32px !important;
|
|
69
|
+
padding-top: 0 !important;
|
|
70
|
+
padding-bottom: 0 !important;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.sidebar-width {
|
|
74
|
+
// width: 200px !important;
|
|
75
|
+
max-width: 250px;
|
|
76
|
+
min-width: 190px;
|
|
77
|
+
width: 200px;
|
|
78
|
+
}
|
|
79
|
+
.module-menu-header {
|
|
80
|
+
padding-top: 8px!important;
|
|
81
|
+
line-height: 32px!important;
|
|
82
|
+
font-size: 16px!important;
|
|
83
|
+
margin-left: 0!important;
|
|
84
|
+
padding-left: 8px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// .searchbar {
|
|
88
|
+
// height: 32px;
|
|
89
|
+
// padding-left: 8px;
|
|
90
|
+
// }
|
|
91
|
+
|
|
92
|
+
.menu-header {
|
|
93
|
+
font-size: 12px!important;
|
|
94
|
+
line-height: 32px!important;
|
|
95
|
+
margin: 0!important;
|
|
96
|
+
padding: 0 0 0 8px!important;
|
|
97
|
+
width: 100%;
|
|
98
|
+
}
|
|
99
|
+
.menu-title {
|
|
100
|
+
flex: 0 0 90%!important;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.product-select-menu {
|
|
104
|
+
width: 100%;
|
|
105
|
+
padding-left: 2px;
|
|
106
|
+
background: #F2F3F7;
|
|
107
|
+
font-family: proxima-nova;
|
|
108
|
+
font-size: 16px !important;
|
|
109
|
+
font-weight: 600;
|
|
110
|
+
|
|
111
|
+
.ant-select-selection {
|
|
112
|
+
background: #F2F3F7;
|
|
113
|
+
border: none !important;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import React, { PropTypes } from 'react';
|
|
2
|
+
// import styled from 'styled-components';
|
|
3
|
+
import { Accordion, Icon, Button, Input } from 'semantic-ui-react';
|
|
4
|
+
import { Select } from 'antd';
|
|
5
|
+
import { FormattedMessage } from 'react-intl';
|
|
6
|
+
import _ from 'lodash';
|
|
7
|
+
import { Link } from 'react-router';
|
|
8
|
+
import messages from './messages';
|
|
9
|
+
import './_newsidebar.scss';
|
|
10
|
+
|
|
11
|
+
const Option = Select.Option;
|
|
12
|
+
|
|
13
|
+
class NewSidebar extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
14
|
+
constructor(props) {
|
|
15
|
+
super(props);
|
|
16
|
+
this.state = {
|
|
17
|
+
isOpen: false,
|
|
18
|
+
activeItem: '',
|
|
19
|
+
activeIndex: 0,
|
|
20
|
+
menuItems: this.props.menuData,
|
|
21
|
+
searchText: '',
|
|
22
|
+
visible: true,
|
|
23
|
+
};
|
|
24
|
+
this.handleItemClick = this.handleItemClick.bind(this);
|
|
25
|
+
this.handleTitleClick = this.handleTitleClick.bind(this);
|
|
26
|
+
this.handleSearch = this.handleSearch.bind(this);
|
|
27
|
+
this.toggleSideNav = this.toggleSideNav.bind(this);
|
|
28
|
+
this.getLinkElement = this.getLinkElement.bind(this);
|
|
29
|
+
this.selectActiveLinkFromUrl = this.selectActiveLinkFromUrl.bind(this);
|
|
30
|
+
this.onProductChange = this.onProductChange.bind(this);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
componentWillMount() {
|
|
34
|
+
this.selectActiveLinkFromUrl(this.props);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
componentWillReceiveProps(nextProp) {
|
|
38
|
+
this.selectActiveLinkFromUrl(nextProp);
|
|
39
|
+
this.setState({ menuItems: nextProp.menuData });
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
onProductChange(value) {
|
|
43
|
+
const selectedProductIndex = _.findIndex(this.props.productMenuData, {value: value.toLowerCase()});
|
|
44
|
+
window.location = this.props.productMenuData[selectedProductIndex].url;
|
|
45
|
+
// console.log('On Product selected ', value, selectedProductIndex);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
getAccordian(content, keyValue) {
|
|
49
|
+
return (<Accordion key={keyValue}>{content}</Accordion>);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
getAccordionTitle(title) {
|
|
53
|
+
return (<Accordion.Title>
|
|
54
|
+
<div className="header item">
|
|
55
|
+
<Icon name="dropdown" /> {title}
|
|
56
|
+
</div>
|
|
57
|
+
</Accordion.Title>);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
getAccordionContent(links, keyValue) {
|
|
61
|
+
return (<Accordion.Content key={keyValue}>{links}</Accordion.Content>);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
getLinkElement(to, text, value, isExternal) {
|
|
65
|
+
const selectedItem = (value && value.trim().toLowerCase() === this.state.activeItem) ? 'selected' : '';
|
|
66
|
+
if (text.toLowerCase().includes(this.state.searchText.toLowerCase())) {
|
|
67
|
+
if (isExternal) {
|
|
68
|
+
return ((text.toLowerCase().includes(this.state.searchText.toLowerCase())) ? <a key={to} className={`item menu-item ${selectedItem}`} href={to}>{text}</a> : '');
|
|
69
|
+
}
|
|
70
|
+
return (
|
|
71
|
+
(text.toLowerCase().includes(this.state.searchText.toLowerCase())) ?
|
|
72
|
+
<Link to={to} className={`item menu-item ${selectedItem}`} onClick={this.handleItemClick} key={to} title={text}>{text}</Link>
|
|
73
|
+
: ''
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
return '';
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
selectActiveLinkFromUrl(props) {
|
|
80
|
+
const activeRoute = props.router.routes[props.router.routes.length - 1];
|
|
81
|
+
const activeRouteName = (activeRoute.name && activeRoute.name.trim().toLowerCase()) || '';
|
|
82
|
+
let selectedItem = '';
|
|
83
|
+
let selectedIndex = -1;
|
|
84
|
+
_.forEach(props.menuData, (menuItem, menuIndex) => {
|
|
85
|
+
if (menuItem.items && typeof menuItem.items === 'object') {
|
|
86
|
+
_.forEach(menuItem.items, (menuData) => {
|
|
87
|
+
// console.log('Menua Data ', menuData, activeRouteName, menuItem);
|
|
88
|
+
if ((menuItem.id && menuData.id.toLowerCase() === activeRouteName.toLowerCase()) || (menuData.value.toLowerCase() === activeRouteName.toLowerCase())) {
|
|
89
|
+
selectedIndex = menuIndex;
|
|
90
|
+
selectedItem = activeRouteName.toLowerCase();
|
|
91
|
+
} else if (activeRouteName === 'assets') {
|
|
92
|
+
selectedIndex = menuIndex;
|
|
93
|
+
selectedItem = 'gallery';
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
} else if (menuItem.value.toLowerCase() === activeRouteName.toLowerCase()) {
|
|
97
|
+
selectedIndex = menuIndex;
|
|
98
|
+
selectedItem = activeRouteName.toLowerCase();
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
this.setState({ activeIndex: selectedIndex, activeItem: selectedItem });
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
toggleSideNav(e) {
|
|
105
|
+
e.preventDefault();
|
|
106
|
+
this.setState({ visible: !this.state.visible }, () => {
|
|
107
|
+
window.dispatchEvent(new Event('resize'));
|
|
108
|
+
if (!this.state.visible) {
|
|
109
|
+
document.getElementById('cap-sidebar').classList.add('sidebar-collapse');
|
|
110
|
+
} else {
|
|
111
|
+
document.getElementById('cap-sidebar').classList.remove('sidebar-collapse');
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
createAccordianElements(title, contentItems) {
|
|
117
|
+
const accordian = [];
|
|
118
|
+
accordian.push(this.getAccordionTitle(title));
|
|
119
|
+
const contentLink = contentItems.map((key) =>
|
|
120
|
+
this.getLinkElement(key.link, key.text, key.value, key.external),
|
|
121
|
+
);
|
|
122
|
+
accordian.push(this.getAccordionContent(contentLink));
|
|
123
|
+
return accordian;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
createNavigationElement(menuItems) {
|
|
127
|
+
const navArray = [];
|
|
128
|
+
_.forEach(menuItems, (key, index) => {
|
|
129
|
+
const headerTitle = key.group;
|
|
130
|
+
const isCategory = Object.prototype.hasOwnProperty.call(key, 'categories');
|
|
131
|
+
if (isCategory) { // attach nested Accordion
|
|
132
|
+
const accordian = [];
|
|
133
|
+
const nestedAcordian = [];
|
|
134
|
+
accordian.push(this.getAccordionTitle(headerTitle));
|
|
135
|
+
const contentAccordian = this.getAccordian(this.createNavigationElement(key.categories), `nestedAccordian-${index}`);
|
|
136
|
+
nestedAcordian.push(contentAccordian);
|
|
137
|
+
const content = this.getAccordionContent(nestedAcordian, `content-${index}`);
|
|
138
|
+
accordian.push(content);
|
|
139
|
+
navArray.push(accordian);
|
|
140
|
+
} else { // attach items to existing accordian
|
|
141
|
+
const accordianElem = this.createAccordianElements(headerTitle, key.items);
|
|
142
|
+
navArray.push(accordianElem);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
// const selectedItem = (this.state.activeItem === 'gallery') ? 'selected' : '';
|
|
146
|
+
// navArray.push(
|
|
147
|
+
// <Link
|
|
148
|
+
// to={'/assets'}
|
|
149
|
+
// className={`item menu-item ${selectedItem} assetItem`}
|
|
150
|
+
// key={'assets'}
|
|
151
|
+
// title={'Gallery'}
|
|
152
|
+
// onClick={(e) => this.handleItemClick(e)}
|
|
153
|
+
// >Gallery</Link>
|
|
154
|
+
// );
|
|
155
|
+
return navArray;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
handleOpen() {
|
|
159
|
+
this.setState({ isOpen: true });
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
handleClose() {
|
|
163
|
+
this.setState({ isOpen: false });
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
handleItemClick(e) {
|
|
167
|
+
this.setState({ activeItem: (e.target.text && e.target.text.trim().toLowerCase()) || '' });
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
handleTitleClick(e, i) {
|
|
171
|
+
this.setState({ activeIndex: this.state.activeIndex === i ? -1 : i });
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
handleSearch(e) {
|
|
175
|
+
this.setState({ searchText: e.target.value });
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
render() {
|
|
180
|
+
const visible = this.state.visible;
|
|
181
|
+
const push = !visible ? 'push' : '';
|
|
182
|
+
const collapse = !visible ? 'collapse' : '';
|
|
183
|
+
const toggle = visible ? 'hide' : '';
|
|
184
|
+
|
|
185
|
+
// const types = [{ text: 'Creatives', value: 'Creatives' }];
|
|
186
|
+
const productOptions = [];
|
|
187
|
+
if (this.props.productMenuData.length > 1) {
|
|
188
|
+
_.forEach(this.props.productMenuData, (product) => {
|
|
189
|
+
productOptions.push(
|
|
190
|
+
<Option key={product.text} value={product.text}>{product.text}</Option>
|
|
191
|
+
);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
return (
|
|
195
|
+
<div className="sidebar-container">
|
|
196
|
+
<div className={`sidebar sidebar-width ${collapse}`}>
|
|
197
|
+
<div className="searchbar">
|
|
198
|
+
<FormattedMessage {...messages.inputPlaceholder}>{(message) => <Input icon="search" className="sidebar-search" placeholder={message} fluid onChange={this.handleSearch} />}</FormattedMessage>
|
|
199
|
+
<a href="" onClick={this.toggleSideNav}><i className="material-icons control-arrow">arrow_back</i></a>
|
|
200
|
+
</div>
|
|
201
|
+
|
|
202
|
+
{ this.props.productMenuData.length > 1 ?
|
|
203
|
+
<Select className="icon product-select-menu" defaultValue={'CAMPAIGNS'} onChange={this.onProductChange}>
|
|
204
|
+
{productOptions}
|
|
205
|
+
</Select>
|
|
206
|
+
:
|
|
207
|
+
<div className="module-menu-header">{this.props.productMenuData[0].text}</div>
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
<div className="menu-header">
|
|
211
|
+
<span className="menu-title"><FormattedMessage {...messages.menuTitle} /> </span>
|
|
212
|
+
{this.props.actionComponents}
|
|
213
|
+
</div>
|
|
214
|
+
<Accordion className="sidebar-accordian" activeIndex={this.state.activeIndex} onTitleClick={this.handleTitleClick}>
|
|
215
|
+
{this.props.menuData && this.createNavigationElement(this.props.menuData)}
|
|
216
|
+
</Accordion>
|
|
217
|
+
</div>
|
|
218
|
+
<div className={`togglebar ${toggle} ${push}`}>
|
|
219
|
+
<Button icon className="btn-toggle" onClick={this.toggleSideNav}>
|
|
220
|
+
<Icon name="bars" />
|
|
221
|
+
</Button>
|
|
222
|
+
</div>
|
|
223
|
+
</div>
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
NewSidebar.propTypes = {
|
|
229
|
+
menuData: PropTypes.array.isRequired,
|
|
230
|
+
productMenuData: PropTypes.array.isRequired,
|
|
231
|
+
actionComponents: PropTypes.oneOfType([PropTypes.element, PropTypes.string]),
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
export default NewSidebar;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Sidebar Messages
|
|
3
|
+
*
|
|
4
|
+
* This contains all the text for the Sidebar component.
|
|
5
|
+
*/
|
|
6
|
+
import { defineMessages } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
export default defineMessages({
|
|
9
|
+
inputPlaceholder: {
|
|
10
|
+
id: 'app.components.Sidebar.input.placeholder',
|
|
11
|
+
defaultMessage: 'Search...',
|
|
12
|
+
},
|
|
13
|
+
menuTitle: {
|
|
14
|
+
id: 'app.components.Sidebar.menuTitle',
|
|
15
|
+
defaultMessage: 'Menu',
|
|
16
|
+
},
|
|
17
|
+
creatives: {
|
|
18
|
+
id: 'app.components.Sidebar.creatives',
|
|
19
|
+
defaultMessage: 'Creatives',
|
|
20
|
+
},
|
|
21
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
.ui.navbar.menu {
|
|
2
|
+
height: 40px !important;
|
|
3
|
+
}
|
|
4
|
+
.ui.menu.navbar .item>img.logo{
|
|
5
|
+
height: 1.5rem !important;
|
|
6
|
+
padding: 0!important;
|
|
7
|
+
margin: 0rem;
|
|
8
|
+
width: 2rem;
|
|
9
|
+
}
|
|
10
|
+
.ui.menu.navbar .ui.selection.dropdown{
|
|
11
|
+
height: 40px !important;
|
|
12
|
+
}
|
|
13
|
+
.ui.menu .ui.dropdown .menu>.selected.item {
|
|
14
|
+
background: #151821;
|
|
15
|
+
}
|
|
16
|
+
.org-list-drp-dwn .menu > .item{
|
|
17
|
+
height: 40px !important;
|
|
18
|
+
}
|
|
19
|
+
.ui.menu.navbar .ui.dropdown .menu>.item{
|
|
20
|
+
height: 40px !important;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ui.search.selection.dropdown>input.search{
|
|
24
|
+
padding-left: 12px !important;
|
|
25
|
+
padding-top: 8px !important;
|
|
26
|
+
padding-bottom: 8px !important;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.ui.menu:not(.vertical) .right.item, .ui.menu:not(.vertical) .right.menu {
|
|
30
|
+
padding-right: 4px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// .ui.menu .item {
|
|
34
|
+
|
|
35
|
+
// }
|
|
36
|
+
|
|
37
|
+
.ui.secondary.vertical.menu>.item {
|
|
38
|
+
margin-bottom: 0 !important;
|
|
39
|
+
padding: 8px 16px !important;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.ui.menu.navbar .item.dropdownItem {
|
|
43
|
+
padding: 0px !important;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.navbarPopover {
|
|
47
|
+
left: 0 !important;
|
|
48
|
+
top: 40px !important;
|
|
49
|
+
padding-top: 0px !important;
|
|
50
|
+
}
|
|
51
|
+
.navbarPopover .ant-popover-arrow {
|
|
52
|
+
display: none;
|
|
53
|
+
}
|
|
54
|
+
.navbarPopover .ant-popover-inner-content {
|
|
55
|
+
padding: 0 !important;
|
|
56
|
+
}
|
|
57
|
+
.displayOrg {
|
|
58
|
+
color: white;
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
}
|
|
61
|
+
.orgDetails {
|
|
62
|
+
display: flex;
|
|
63
|
+
}
|
|
64
|
+
.popoverTitle {
|
|
65
|
+
padding: 1rem 1rem 0.5rem 1rem;
|
|
66
|
+
}
|
|
67
|
+
.org-list-drp-dwn {
|
|
68
|
+
border-top: none !important;
|
|
69
|
+
border-left: none !important;
|
|
70
|
+
border-right: none !important;
|
|
71
|
+
height: 2.5rem;
|
|
72
|
+
}
|
|
73
|
+
.productOption {
|
|
74
|
+
height: 2rem;
|
|
75
|
+
padding-left: 1rem;
|
|
76
|
+
}
|
|
77
|
+
.navbarMenuOptions {
|
|
78
|
+
padding: 0 0 0 24px !important;
|
|
79
|
+
margin: 0 !important;
|
|
80
|
+
}
|
|
81
|
+
.navbarIcon {
|
|
82
|
+
color: white !important;
|
|
83
|
+
font-size: 1rem;
|
|
84
|
+
}
|
|
Binary file
|
|
Binary file
|