@capillarytech/creatives-library 0.1.30 → 0.1.32
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/containers/Sms/Edit/index.js +1 -1
- package/package.json +1 -1
- package/components/NewSidebar/_newsidebar.scss +0 -115
- package/components/NewSidebar/index.js +0 -234
- package/components/NewSidebar/messages.js +0 -21
- package/components/NewSidebar/tests/index.test.js +0 -10
- package/components/NewTopBar/_newtopbar.scss +0 -84
- 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 +0 -195
- package/components/NewTopBar/messages.js +0 -29
- package/components/NewTopBar/tests/index.test.js +0 -10
|
@@ -89,7 +89,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
89
89
|
}
|
|
90
90
|
componentDidMount() {
|
|
91
91
|
if (this.props.location.query && this.props.location.query.module === 'library') {
|
|
92
|
-
if (this.props.params.id) {
|
|
92
|
+
if (this.props.params && this.props.params.id) {
|
|
93
93
|
this.props.actions.getTemplateDetails(this.props.params.id);
|
|
94
94
|
} else {
|
|
95
95
|
this.props.actions.setTemplateDetails(this.props.templateData);
|
package/package.json
CHANGED
|
@@ -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,234 +0,0 @@
|
|
|
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;
|
|
@@ -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
|
-
});
|
|
@@ -1,84 +0,0 @@
|
|
|
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
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import React, { PropTypes } from 'react';
|
|
2
|
-
// import styled from 'styled-components';
|
|
3
|
-
|
|
4
|
-
import { Menu, Image, Dropdown, Popup } from 'semantic-ui-react';
|
|
5
|
-
import { FormattedMessage } from 'react-intl';
|
|
6
|
-
import { Link } from 'react-router';
|
|
7
|
-
import { loadItem } from 'services/localStorageApi';
|
|
8
|
-
import messages from './messages';
|
|
9
|
-
import './_newtopbar.scss';
|
|
10
|
-
import { CapPopover, CapTreeSelect } from '@capillarytech/cap-react-ui-library';
|
|
11
|
-
|
|
12
|
-
const logo = require('./assets/images/capillary_logo_2.png');
|
|
13
|
-
|
|
14
|
-
class NewTopBar extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
15
|
-
constructor(props) {
|
|
16
|
-
super(props);
|
|
17
|
-
this.state = {
|
|
18
|
-
activeItem: '',
|
|
19
|
-
orgList: [],
|
|
20
|
-
subOrgList: [],
|
|
21
|
-
selectedOrg: loadItem('orgID'),
|
|
22
|
-
selectedSubOrg: loadItem('subOrgID'),
|
|
23
|
-
};
|
|
24
|
-
this.handleItemClick = this.handleItemClick.bind(this);
|
|
25
|
-
this.logout = this.logout.bind(this);
|
|
26
|
-
this.handleOrgChange = this.handleOrgChange.bind(this);
|
|
27
|
-
this.handleSubOrgChange = this.handleSubOrgChange.bind(this);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
componentDidUpdate(prevProps) {
|
|
31
|
-
if (prevProps.orgID !== this.props.orgID) {
|
|
32
|
-
this.props.navigateToDashboard();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
handleOrgChange(data) {
|
|
37
|
-
const orgId = data.value;
|
|
38
|
-
if (this.state.selectedOrg !== orgId) {
|
|
39
|
-
this.props.changeOrg(orgId);
|
|
40
|
-
this.setState({ selectedOrg: orgId });
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
handleSubOrgChange(data) {
|
|
45
|
-
const subOrgId = data.value;
|
|
46
|
-
if (this.state.selectedSubOrg !== subOrgId) {
|
|
47
|
-
this.props.changeSubOrg(subOrgId);
|
|
48
|
-
this.setState({ selectedSubOrg: subOrgId });
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
handleItemClick(e) {
|
|
53
|
-
this.setState({ activeItem: e.target.id });
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
logout(e) {
|
|
57
|
-
e.preventDefault();
|
|
58
|
-
this.props.logout();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
render() {
|
|
62
|
-
console.log("topbarprops", this.props);
|
|
63
|
-
const proxyOrgList = this.props.proxyOrgList;
|
|
64
|
-
const proxySubOrgList = this.props.proxySubOrgList;
|
|
65
|
-
const defaultOrgName = this.props.orgName;
|
|
66
|
-
const defaultSubOrgName = this.props.subOrgName;
|
|
67
|
-
const currentOrgName = this.props.currentOrgName;
|
|
68
|
-
const selectedOrg = loadItem('orgID');
|
|
69
|
-
const selectedSubOrg = loadItem('subOrgID');
|
|
70
|
-
const productOptions = [];
|
|
71
|
-
if (this.props.productMenuData.length > 1) {
|
|
72
|
-
_.forEach(this.props.productMenuData, (product) => {
|
|
73
|
-
productOptions.push(
|
|
74
|
-
<li className="productOption" key={product.text} value={product.text}>{product.text}</li>
|
|
75
|
-
);
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const content = (
|
|
80
|
-
<div>
|
|
81
|
-
{ proxyOrgList.length > 1 ?
|
|
82
|
-
<Menu.Item className="dropdownItem" key="orgSelection">
|
|
83
|
-
<div className="popoverTitle">Organization</div>
|
|
84
|
-
<FormattedMessage {...messages.dropdownMessage}>
|
|
85
|
-
{(message) => <CapTreeSelect
|
|
86
|
-
showSearch="true"
|
|
87
|
-
placeholder={message}
|
|
88
|
-
className="org-list-drp-dwn"
|
|
89
|
-
defaultValue={selectedOrg}
|
|
90
|
-
treeData={proxyOrgList}
|
|
91
|
-
onChange={(data) => this.handleOrgChange(data)}
|
|
92
|
-
/>}
|
|
93
|
-
</FormattedMessage>
|
|
94
|
-
</Menu.Item> :
|
|
95
|
-
<Menu.Item key="default-org">
|
|
96
|
-
{defaultOrgName}
|
|
97
|
-
</Menu.Item>
|
|
98
|
-
}
|
|
99
|
-
{ proxySubOrgList.length > 1 ?
|
|
100
|
-
<Menu.Item className="dropdownItem" key="subOrgSelection">
|
|
101
|
-
<FormattedMessage {...messages.dropdownMessage}>
|
|
102
|
-
{(message) => <Dropdown
|
|
103
|
-
placeholder={message}
|
|
104
|
-
className="org-list-drp-dwn"
|
|
105
|
-
defaultValue={selectedSubOrg}
|
|
106
|
-
search
|
|
107
|
-
options={proxySubOrgList}
|
|
108
|
-
selection
|
|
109
|
-
onChange={(event, data) => this.handleSubOrgChange(data)}
|
|
110
|
-
/>}
|
|
111
|
-
</FormattedMessage>
|
|
112
|
-
</Menu.Item> :
|
|
113
|
-
<Menu.Item key="default-subOrg">
|
|
114
|
-
{defaultSubOrgName}
|
|
115
|
-
</Menu.Item>
|
|
116
|
-
}
|
|
117
|
-
{ this.props.productMenuData.length > 1 ?
|
|
118
|
-
<div>
|
|
119
|
-
<div className="popoverTitle">Products</div>
|
|
120
|
-
<ul defaultValue={'CAMPAIGNS'} >
|
|
121
|
-
{productOptions}
|
|
122
|
-
</ul>
|
|
123
|
-
</div>
|
|
124
|
-
:
|
|
125
|
-
<div className="module-menu-header">{this.props.productMenuData[0].text}</div>
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
</div>
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
return (
|
|
132
|
-
<Menu className="navbar" key="navbar">
|
|
133
|
-
|
|
134
|
-
<Menu.Item key="logo" as={Link} to="/" name="logo" className="logo-container" onClick={this.handleItemClick}>
|
|
135
|
-
<Image className="logo" src={logo} alt="Capillary Technologies" />
|
|
136
|
-
</Menu.Item>
|
|
137
|
-
|
|
138
|
-
<CapPopover overlayClassName="navbarPopover" placement="topLeft" content={content} trigger="click">
|
|
139
|
-
<div className="displayOrg">
|
|
140
|
-
<div className="orgDetails">
|
|
141
|
-
<div className="orgName">{currentOrgName}</div>
|
|
142
|
-
<div className="subOrgName">/ {this.props.subOrgName}</div>
|
|
143
|
-
</div>
|
|
144
|
-
<div className="moduleName">Campaigns
|
|
145
|
-
</div>
|
|
146
|
-
</div>
|
|
147
|
-
</CapPopover>
|
|
148
|
-
|
|
149
|
-
<Menu.Menu position="right">
|
|
150
|
-
<Menu.Item className="navbarMenuOptions" key="name">
|
|
151
|
-
{this.props.firstName} {this.props.lastName}
|
|
152
|
-
</Menu.Item>
|
|
153
|
-
<Menu.Item className="navbarMenuOptions" key="notifications">
|
|
154
|
-
<i className="material-icons navbarIcon">notifications</i>
|
|
155
|
-
</Menu.Item>
|
|
156
|
-
<Menu.Item className="navbarMenuOptions" key="user-details">
|
|
157
|
-
<Popup
|
|
158
|
-
trigger={<i className="material-icons navbarIcon">person</i>}
|
|
159
|
-
content={< div className="ui secondary vertical menu">
|
|
160
|
-
<a href="" className="item hide"><FormattedMessage {...messages.profile} /><i className="user icon" /></a>
|
|
161
|
-
<a href="" className="item hide"><FormattedMessage {...messages.settings} /> <i className="settings icon" /></a>
|
|
162
|
-
<a href="" className="item" onClick={this.logout}><FormattedMessage {...messages.logout} />
|
|
163
|
-
<i className="sign out icon" /></a> </div >}
|
|
164
|
-
on="click" position="bottom right" offset={7}
|
|
165
|
-
/>
|
|
166
|
-
</Menu.Item>
|
|
167
|
-
<Menu.Item className="navbarMenuOptions" key="help">
|
|
168
|
-
<i className="material-icons navbarIcon">help</i>
|
|
169
|
-
</Menu.Item>
|
|
170
|
-
</Menu.Menu>
|
|
171
|
-
</Menu>
|
|
172
|
-
|
|
173
|
-
);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
NewTopBar.propTypes = {
|
|
178
|
-
userName: PropTypes.string,
|
|
179
|
-
firstName: PropTypes.string,
|
|
180
|
-
lastName: PropTypes.string,
|
|
181
|
-
proxyOrgList: PropTypes.array,
|
|
182
|
-
proxySubOrgList: PropTypes.array,
|
|
183
|
-
orgName: PropTypes.string,
|
|
184
|
-
currentOrgName: PropTypes.string,
|
|
185
|
-
subOrgName: PropTypes.string,
|
|
186
|
-
orgID: PropTypes.number,
|
|
187
|
-
subOrgID: PropTypes.number,
|
|
188
|
-
navigateToDashboard: PropTypes.func,
|
|
189
|
-
changeOrg: PropTypes.func,
|
|
190
|
-
changeSubOrg: PropTypes.func,
|
|
191
|
-
logout: PropTypes.func,
|
|
192
|
-
productMenuData: PropTypes.array.isRequired,
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
export default NewTopBar;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* TopBar Messages
|
|
3
|
-
*
|
|
4
|
-
* This contains all the text for the TopBar component.
|
|
5
|
-
*/
|
|
6
|
-
import { defineMessages } from 'react-intl';
|
|
7
|
-
|
|
8
|
-
export default defineMessages({
|
|
9
|
-
profile: {
|
|
10
|
-
id: 'reon.components.TopBar.profile',
|
|
11
|
-
defaultMessage: 'Profile',
|
|
12
|
-
},
|
|
13
|
-
settings: {
|
|
14
|
-
id: 'reon.components.TopBar.settings',
|
|
15
|
-
defaultMessage: 'Settings',
|
|
16
|
-
},
|
|
17
|
-
logout: {
|
|
18
|
-
id: 'reon.components.TopBar.logout',
|
|
19
|
-
defaultMessage: 'Logout',
|
|
20
|
-
},
|
|
21
|
-
dropdownMessage: {
|
|
22
|
-
id: 'reon.components.TopBar.brand.dropdown',
|
|
23
|
-
defaultMessage: 'Select Brand',
|
|
24
|
-
},
|
|
25
|
-
hi: {
|
|
26
|
-
id: 'app.components.TopBar.brand.dropdown',
|
|
27
|
-
defaultMessage: 'Hi',
|
|
28
|
-
},
|
|
29
|
-
});
|