@capillarytech/creatives-library 3.1.7 → 3.1.9
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 +2 -2
- package/translations/en.json +1 -1
- package/v2Components/CapTagList/index.js +1 -1
- package/v2Components/CapTagList/messages.js +1 -1
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +0 -1
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +1 -3
- package/v2Containers/Templates/index.js +7 -12
- package/v2Containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +3 -0
- package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +2 -4
- package/containers/Cap/messsages.js +0 -63
- package/v2Components/DateFilter/index.js +0 -349
- package/v2Components/DateFilter/messages.js +0 -17
- package/v2Components/DateFilter/tests/index.test.js +0 -15
- package/v2Components/DateRange/index.js +0 -113
- package/v2Components/DateRange/messages.js +0 -13
- package/v2Components/DateRange/tests/index.test.js +0 -10
- package/v2Components/Header/index.js +0 -46
- package/v2Components/Header/tests/index.test.js +0 -10
- package/v2Components/PageHeader/_pageHeader.scss +0 -22
- package/v2Components/PageHeader/index.js +0 -37
- package/v2Components/PageHeader/messages.js +0 -13
- package/v2Components/PageHeader/tests/index.test.js +0 -10
- package/v2Components/Sidebar/_sidebar.scss +0 -115
- package/v2Components/Sidebar/index.js +0 -208
- package/v2Components/Sidebar/messages.js +0 -21
- package/v2Components/Sidebar/tests/index.test.js +0 -10
- package/v2Components/SmsEditor/index.js +0 -55
- package/v2Components/SmsEditor/tests/index.test.js +0 -10
- package/v2Components/TopBar/_topbar.scss +0 -46
- package/v2Containers/TemplatesV2/_templatesV2.scss +0 -5
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* DateRange
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
|
|
9
|
-
import React from 'react';
|
|
10
|
-
// import styled from 'styled-components';
|
|
11
|
-
|
|
12
|
-
import { FormattedMessage } from 'react-intl';
|
|
13
|
-
import { Grid, Button } from 'semantic-ui-react';
|
|
14
|
-
|
|
15
|
-
import DatePicker from 'react-datepicker';
|
|
16
|
-
import 'react-datepicker/dist/react-datepicker.css';
|
|
17
|
-
|
|
18
|
-
import moment from 'moment';
|
|
19
|
-
|
|
20
|
-
class DateRange extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
21
|
-
constructor(props) {
|
|
22
|
-
super(props);
|
|
23
|
-
this.state = {
|
|
24
|
-
startDate: this.props.prevSelectedDate.startDate,
|
|
25
|
-
endDate: this.props.prevSelectedDate.endDate,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
this.handleChangeStart = this.handleChangeStart.bind(this);
|
|
29
|
-
this.handleChangeEnd = this.handleChangeEnd.bind(this);
|
|
30
|
-
this.closeAndUpdate = this.closeAndUpdate.bind(this);
|
|
31
|
-
this.closeAndCancel = this.closeAndCancel.bind(this);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
handleChangeStart(date) {
|
|
35
|
-
this.setState({ startDate: date });
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
handleChangeEnd(date) {
|
|
39
|
-
this.setState({ endDate: date });
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
closeAndUpdate() {
|
|
43
|
-
this.props.handleDatePickerApply(this.state.startDate, this.state.endDate, 'custom');
|
|
44
|
-
this.props.handleDatePickerCancel();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
closeAndCancel() {
|
|
48
|
-
this.props.handleDatePickerCancel();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
render() {
|
|
52
|
-
const { startDate, endDate } = this.state;
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<Grid className="dateRangeWrapper" columns={2}>
|
|
56
|
-
<Grid.Row className="selectedDateTitleWrapper">
|
|
57
|
-
<Grid.Column style={{ paddingLeft: 0, paddingBottom: `${8}px` }}>
|
|
58
|
-
<span className="selectedDateTitle">From</span>
|
|
59
|
-
<input className="selectedDateRange" type="text" readOnly defaultValue={moment(startDate).format('MM/DD/YYYY').toString()} />
|
|
60
|
-
<i className="calenderIcon material-icons">today</i>
|
|
61
|
-
</Grid.Column>
|
|
62
|
-
<Grid.Column style={{ paddingLeft: 0 }}>
|
|
63
|
-
<span className="selectedDateTitle">To</span>
|
|
64
|
-
<input className="selectedDateRange" readOnly type="text" defaultValue={moment(endDate).format('MM/DD/YYYY').toString()} />
|
|
65
|
-
<i className="calenderIcon material-icons">today</i>
|
|
66
|
-
</Grid.Column>
|
|
67
|
-
</Grid.Row>
|
|
68
|
-
<Grid.Row style={{ paddingTop: 0, paddingBottom: `${2}px` }}>
|
|
69
|
-
<Grid.Column style={{ paddingLeft: 0 }}>
|
|
70
|
-
<DatePicker
|
|
71
|
-
inline
|
|
72
|
-
selected={startDate}
|
|
73
|
-
startDate={startDate}
|
|
74
|
-
endDate={endDate}
|
|
75
|
-
onChange={this.handleChangeStart}
|
|
76
|
-
showMonthDropdown
|
|
77
|
-
showYearDropdown
|
|
78
|
-
dropdownMode="select"
|
|
79
|
-
/>
|
|
80
|
-
</Grid.Column>
|
|
81
|
-
<Grid.Column style={{ paddingLeft: 0 }}>
|
|
82
|
-
<DatePicker
|
|
83
|
-
inline
|
|
84
|
-
selected={endDate}
|
|
85
|
-
startDate={startDate}
|
|
86
|
-
endDate={endDate}
|
|
87
|
-
minDate={startDate}
|
|
88
|
-
maxDate={moment()}
|
|
89
|
-
onChange={this.handleChangeEnd}
|
|
90
|
-
showMonthDropdown
|
|
91
|
-
showYearDropdown
|
|
92
|
-
dropdownMode="select"
|
|
93
|
-
/>
|
|
94
|
-
</Grid.Column>
|
|
95
|
-
</Grid.Row>
|
|
96
|
-
<Grid.Row>
|
|
97
|
-
<Grid.Column width={16} style={{ paddingLeft: 0 }}>
|
|
98
|
-
<Button onClick={this.closeAndUpdate} className="btn-primary" floated="left"><FormattedMessage id="customdatepicker.done" defaultMessage="Done" /></Button>
|
|
99
|
-
<Button onClick={this.closeAndCancel} className="btn-secondary" floated="left"><FormattedMessage id="customdatepicker.cancel" defaultMessage="Cancel" /></Button>
|
|
100
|
-
</Grid.Column>
|
|
101
|
-
</Grid.Row>
|
|
102
|
-
</Grid>
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
DateRange.propTypes = {
|
|
108
|
-
prevSelectedDate: PropTypes.object.isRequired,
|
|
109
|
-
handleDatePickerCancel: PropTypes.func,
|
|
110
|
-
handleDatePickerApply: PropTypes.func,
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
export default DateRange;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* DateRange Messages
|
|
3
|
-
*
|
|
4
|
-
* This contains all the text for the DateRange component.
|
|
5
|
-
*/
|
|
6
|
-
import { defineMessages } from 'react-intl';
|
|
7
|
-
|
|
8
|
-
export default defineMessages({
|
|
9
|
-
header: {
|
|
10
|
-
id: 'app.components.DateRange.header',
|
|
11
|
-
defaultMessage: 'This is the DateRange component !',
|
|
12
|
-
},
|
|
13
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* Header
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
|
|
9
|
-
import React from 'react';
|
|
10
|
-
// import styled from 'styled-components';
|
|
11
|
-
import { FormattedMessage } from 'react-intl';
|
|
12
|
-
|
|
13
|
-
import { CapRow, CapColumn, CapInput, CapButton } from '@capillarytech/cap-ui-library';
|
|
14
|
-
import messages from './messages';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function Header(props) {
|
|
18
|
-
return (
|
|
19
|
-
<div>
|
|
20
|
-
<CapRow className="template-form-header">
|
|
21
|
-
<CapColumn span={10}>
|
|
22
|
-
<CapInput id="template-name" placeholder="Enter template name*" defaultValue={props.templateName} type="input" onChange={props.templateNameHandler}/>
|
|
23
|
-
</CapColumn>
|
|
24
|
-
{/* <CapColumn span={2} offset={8}>
|
|
25
|
-
<CapButton id="preview-button" type="cancel" onClick={props.previewHandler}> <FormattedMessage {...messages.preview} /> </CapButton>
|
|
26
|
-
</CapColumn>
|
|
27
|
-
<CapColumn span={2}>
|
|
28
|
-
<CapButton id="cancel-button" type="cancel" onClick={props.cancelHandler}> <FormattedMessage {...messages.cancel} /> </CapButton>
|
|
29
|
-
</CapColumn>
|
|
30
|
-
<CapColumn span={2}>
|
|
31
|
-
<CapButton id="save-button" type="primary" onClick={props.saveHandler}> <FormattedMessage {...messages.save} /> </CapButton>
|
|
32
|
-
</CapColumn> */}
|
|
33
|
-
</CapRow>
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
Header.propTypes = {
|
|
39
|
-
templateNameHandler: PropTypes.func,
|
|
40
|
-
previewHandler: PropTypes.func,
|
|
41
|
-
cancelHandler: PropTypes.func,
|
|
42
|
-
saveHandler: PropTypes.func,
|
|
43
|
-
templateName: PropTypes.string,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export default Header;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
.pageHeader{
|
|
2
|
-
.pageHeader-wrapper{
|
|
3
|
-
padding-top: 8px;
|
|
4
|
-
padding-bottom: 8px;
|
|
5
|
-
|
|
6
|
-
.title-container {
|
|
7
|
-
padding-left: 0px !important;
|
|
8
|
-
|
|
9
|
-
.title {
|
|
10
|
-
font-size: 24px;
|
|
11
|
-
line-height: 32px;
|
|
12
|
-
color: #323B4E;
|
|
13
|
-
font-family: 'Proxima-Nova';
|
|
14
|
-
font-weight: 600;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
.action-buttons{
|
|
18
|
-
text-align: right;
|
|
19
|
-
padding-right: 0 !important;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
// import styled from 'styled-components';
|
|
4
|
-
|
|
5
|
-
import { Grid } from 'semantic-ui-react';
|
|
6
|
-
import './_pageHeader.scss';
|
|
7
|
-
|
|
8
|
-
// import { FormattedMessage } from 'react-intl';
|
|
9
|
-
// import messages from './messages';
|
|
10
|
-
|
|
11
|
-
class PageHeader extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
12
|
-
render() {
|
|
13
|
-
return (
|
|
14
|
-
<Grid className="pageHeader">
|
|
15
|
-
<Grid.Row className="pageHeader-wrapper">
|
|
16
|
-
<Grid.Column width={8} className="title-container">
|
|
17
|
-
<h2 className="title">{this.props.pageHeading}</h2>
|
|
18
|
-
</Grid.Column>
|
|
19
|
-
<Grid.Column className="action-buttons" width={8}>
|
|
20
|
-
{this.props.actionComponents}
|
|
21
|
-
</Grid.Column>
|
|
22
|
-
</Grid.Row>
|
|
23
|
-
</Grid>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
PageHeader.propTypes = {
|
|
29
|
-
// Need Formatted Message in pageHeading Props
|
|
30
|
-
pageHeading: PropTypes.oneOfType([
|
|
31
|
-
PropTypes.element,
|
|
32
|
-
PropTypes.string,
|
|
33
|
-
]),
|
|
34
|
-
actionComponents: PropTypes.element,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export default PageHeader;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* PageHeader Messages
|
|
3
|
-
*
|
|
4
|
-
* This contains all the text for the PageHeader component.
|
|
5
|
-
*/
|
|
6
|
-
import { defineMessages } from 'react-intl';
|
|
7
|
-
|
|
8
|
-
export default defineMessages({
|
|
9
|
-
header: {
|
|
10
|
-
id: 'app.components.PageHeader.header',
|
|
11
|
-
defaultMessage: 'This is the PageHeader component !',
|
|
12
|
-
},
|
|
13
|
-
});
|
|
@@ -1,115 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
// import styled from 'styled-components';
|
|
4
|
-
import { Accordion, Icon, Input, Button } from 'semantic-ui-react';
|
|
5
|
-
import { FormattedMessage } from 'react-intl';
|
|
6
|
-
import _ from 'lodash';
|
|
7
|
-
import { Link } from 'react-router';
|
|
8
|
-
import messages from './messages';
|
|
9
|
-
import './_sidebar.scss';
|
|
10
|
-
|
|
11
|
-
class Sidebar extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
12
|
-
constructor(props) {
|
|
13
|
-
super(props);
|
|
14
|
-
this.state = {
|
|
15
|
-
isOpen: false,
|
|
16
|
-
activeItem: '',
|
|
17
|
-
activeIndex: 0,
|
|
18
|
-
menuItems: this.props.menuData,
|
|
19
|
-
searchText: '',
|
|
20
|
-
visible: true,
|
|
21
|
-
};
|
|
22
|
-
this.handleItemClick = this.handleItemClick.bind(this);
|
|
23
|
-
this.handleTitleClick = this.handleTitleClick.bind(this);
|
|
24
|
-
this.handleSearch = this.handleSearch.bind(this);
|
|
25
|
-
this.toggleSideNav = this.toggleSideNav.bind(this);
|
|
26
|
-
this.getLinkElement = this.getLinkElement.bind(this);
|
|
27
|
-
this.selectActiveLinkFromUrl = this.selectActiveLinkFromUrl.bind(this);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
componentWillMount() {
|
|
31
|
-
this.selectActiveLinkFromUrl(this.props);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
componentWillReceiveProps(nextProp) {
|
|
35
|
-
this.selectActiveLinkFromUrl(nextProp);
|
|
36
|
-
this.setState({ menuItems: nextProp.menuData });
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
getAccordian(content, keyValue) {
|
|
40
|
-
return (<Accordion key={keyValue}>{content}</Accordion>);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
getAccordionTitle(title) {
|
|
44
|
-
return (<Accordion.Title>
|
|
45
|
-
<div className="header item">
|
|
46
|
-
<Icon name="dropdown" /> {title}
|
|
47
|
-
</div>
|
|
48
|
-
</Accordion.Title>);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
getAccordionContent(links, keyValue) {
|
|
52
|
-
return (<Accordion.Content key={keyValue}>{links}</Accordion.Content>);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
getLinkElement(to, text, value, isExternal) {
|
|
56
|
-
const selectedItem = (value && value.trim().toLowerCase() === this.state.activeItem) ? 'selected' : '';
|
|
57
|
-
if (text.toLowerCase().includes(this.state.searchText.toLowerCase())) {
|
|
58
|
-
if (isExternal) {
|
|
59
|
-
return ((text.toLowerCase().includes(this.state.searchText.toLowerCase())) ? <a key={to} className={`item menu-item ${selectedItem}`} href={to}>{text}</a> : '');
|
|
60
|
-
}
|
|
61
|
-
return (
|
|
62
|
-
(text.toLowerCase().includes(this.state.searchText.toLowerCase())) ?
|
|
63
|
-
<Link to={to} className={`item menu-item ${selectedItem}`} onClick={this.handleItemClick} key={to} title={text}>{text}</Link>
|
|
64
|
-
: ''
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
return '';
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
selectActiveLinkFromUrl(props) {
|
|
71
|
-
const activeRoute = props.router.routes[props.router.routes.length - 1];
|
|
72
|
-
const activeRouteName = (activeRoute.name && activeRoute.name.trim().toLowerCase()) || '';
|
|
73
|
-
let selectedItem = '';
|
|
74
|
-
let selectedIndex = -1;
|
|
75
|
-
_.forEach(props.menuData, (menuItem, menuIndex) => {
|
|
76
|
-
if (menuItem.items && typeof menuItem.items === 'object') {
|
|
77
|
-
_.forEach(menuItem.items, (menuData) => {
|
|
78
|
-
// console.log('Menua Data ', menuData, activeRouteName, menuItem);
|
|
79
|
-
if ((menuItem.id && menuData.id.toLowerCase() === activeRouteName.toLowerCase()) || (menuData.value.toLowerCase() === activeRouteName.toLowerCase())) {
|
|
80
|
-
selectedIndex = menuIndex;
|
|
81
|
-
selectedItem = activeRouteName.toLowerCase();
|
|
82
|
-
} else if (activeRouteName === 'assets') {
|
|
83
|
-
selectedIndex = menuIndex;
|
|
84
|
-
selectedItem = 'gallery';
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
} else if (menuItem.value.toLowerCase() === activeRouteName.toLowerCase()) {
|
|
88
|
-
selectedIndex = menuIndex;
|
|
89
|
-
selectedItem = activeRouteName.toLowerCase();
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
this.setState({ activeIndex: selectedIndex, activeItem: selectedItem });
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
toggleSideNav(e) {
|
|
96
|
-
e.preventDefault();
|
|
97
|
-
this.setState({ visible: !this.state.visible }, () => {
|
|
98
|
-
window.dispatchEvent(new Event('resize'));
|
|
99
|
-
if (!this.state.visible) {
|
|
100
|
-
document.getElementById('cap-sidebar').classList.add('sidebar-collapse');
|
|
101
|
-
} else {
|
|
102
|
-
document.getElementById('cap-sidebar').classList.remove('sidebar-collapse');
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
createAccordianElements(title, contentItems) {
|
|
108
|
-
const accordian = [];
|
|
109
|
-
accordian.push(this.getAccordionTitle(title));
|
|
110
|
-
const contentLink = contentItems.map((key) =>
|
|
111
|
-
this.getLinkElement(key.link, key.text, key.value, key.external),
|
|
112
|
-
);
|
|
113
|
-
accordian.push(this.getAccordionContent(contentLink));
|
|
114
|
-
return accordian;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
createNavigationElement(menuItems) {
|
|
118
|
-
const navArray = [];
|
|
119
|
-
_.forEach(menuItems, (key, index) => {
|
|
120
|
-
const headerTitle = key.group;
|
|
121
|
-
const isCategory = Object.prototype.hasOwnProperty.call(key, 'categories');
|
|
122
|
-
if (isCategory) { // attach nested Accordion
|
|
123
|
-
const accordian = [];
|
|
124
|
-
const nestedAcordian = [];
|
|
125
|
-
accordian.push(this.getAccordionTitle(headerTitle));
|
|
126
|
-
const contentAccordian = this.getAccordian(this.createNavigationElement(key.categories), `nestedAccordian-${index}`);
|
|
127
|
-
nestedAcordian.push(contentAccordian);
|
|
128
|
-
const content = this.getAccordionContent(nestedAcordian, `content-${index}`);
|
|
129
|
-
accordian.push(content);
|
|
130
|
-
navArray.push(accordian);
|
|
131
|
-
} else { // attach items to existing accordian
|
|
132
|
-
const accordianElem = this.createAccordianElements(headerTitle, key.items);
|
|
133
|
-
navArray.push(accordianElem);
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
// const selectedItem = (this.state.activeItem === 'gallery') ? 'selected' : '';
|
|
137
|
-
// navArray.push(
|
|
138
|
-
// <Link
|
|
139
|
-
// to={'/assets'}
|
|
140
|
-
// className={`item menu-item ${selectedItem} assetItem`}
|
|
141
|
-
// key={'assets'}
|
|
142
|
-
// title={'Gallery'}
|
|
143
|
-
// onClick={(e) => this.handleItemClick(e)}
|
|
144
|
-
// >Gallery</Link>
|
|
145
|
-
// );
|
|
146
|
-
return navArray;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
handleOpen() {
|
|
150
|
-
this.setState({ isOpen: true });
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
handleClose() {
|
|
154
|
-
this.setState({ isOpen: false });
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
handleItemClick(e) {
|
|
158
|
-
this.setState({ activeItem: (e.target.text && e.target.text.trim().toLowerCase()) || '' });
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
handleTitleClick(e, i) {
|
|
162
|
-
this.setState({ activeIndex: this.state.activeIndex === i ? -1 : i });
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
handleSearch(e) {
|
|
166
|
-
this.setState({ searchText: e.target.value });
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
render() {
|
|
171
|
-
const visible = this.state.visible;
|
|
172
|
-
const push = !visible ? 'push' : '';
|
|
173
|
-
const collapse = !visible ? 'collapse' : '';
|
|
174
|
-
const toggle = visible ? 'hide' : '';
|
|
175
|
-
|
|
176
|
-
// const types = [{ text: 'Creatives', value: 'Creatives' }];
|
|
177
|
-
return (
|
|
178
|
-
<div className="sidebar-container">
|
|
179
|
-
<div className={`sidebar sidebar-width ${collapse}`}>
|
|
180
|
-
<div className="searchbar">
|
|
181
|
-
<FormattedMessage {...messages.inputPlaceholder}>{(message) => <Input icon="search" className="sidebar-search" placeholder={message} fluid onChange={this.handleSearch} />}</FormattedMessage>
|
|
182
|
-
<a href="" onClick={this.toggleSideNav}><i className="material-icons control-arrow">arrow_back</i></a>
|
|
183
|
-
</div>
|
|
184
|
-
|
|
185
|
-
<div className="menu-header">
|
|
186
|
-
<span className="menu-title"><FormattedMessage {...messages.menuTitle} /> </span>
|
|
187
|
-
{this.props.actionComponents}
|
|
188
|
-
</div>
|
|
189
|
-
<Accordion className="sidebar-accordian" activeIndex={this.state.activeIndex} onTitleClick={this.handleTitleClick}>
|
|
190
|
-
{this.props.menuData && this.createNavigationElement(this.props.menuData)}
|
|
191
|
-
</Accordion>
|
|
192
|
-
</div>
|
|
193
|
-
<div className={`togglebar ${toggle} ${push}`}>
|
|
194
|
-
<Button icon className="btn-toggle" onClick={this.toggleSideNav}>
|
|
195
|
-
<Icon name="bars" />
|
|
196
|
-
</Button>
|
|
197
|
-
</div>
|
|
198
|
-
</div>
|
|
199
|
-
);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
Sidebar.propTypes = {
|
|
204
|
-
menuData: PropTypes.array.isRequired,
|
|
205
|
-
actionComponents: PropTypes.oneOfType([PropTypes.element, PropTypes.string]),
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
export default Sidebar;
|
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
});
|