@plusscommunities/pluss-core-web 1.7.3-beta.0 → 1.7.3-beta.1
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/.babelrc +3 -0
- package/dist/components.js +390 -33094
- package/dist/components.js.map +1 -1
- package/dist/index.cjs.js +10388 -0
- package/dist/index.esm.js +10349 -0
- package/dist/index.js +394 -33098
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +10361 -0
- package/package.json +31 -22
- package/rollup.config.js +57 -0
- package/src/actions/AuthActions.js +83 -0
- package/src/actions/LocalActions.js +8 -0
- package/src/actions/NavActions.js +8 -0
- package/src/actions/ScheduledActionsActions.js +8 -0
- package/src/actions/TemplateActions.js +15 -0
- package/src/actions/UsersActions.js +95 -0
- package/src/actions/index.js +6 -0
- package/src/actions/types.js +23 -0
- package/src/analytics.js +183 -0
- package/src/apis/analyticsActions.js +53 -0
- package/src/apis/authActions.js +58 -0
- package/src/apis/fileActions.js +152 -0
- package/src/apis/index.js +10 -0
- package/src/apis/profileActions.js +133 -0
- package/src/apis/scheduledActionsActions.js +12 -0
- package/src/apis/stringActions.js +25 -0
- package/src/apis/templateActions.js +41 -0
- package/src/apis/typeActions.js +186 -0
- package/src/apis/userActions.js +169 -0
- package/src/apis/utilityActions.js +35 -0
- package/src/colours.js +134 -0
- package/src/components/AddButton.js +27 -0
- package/src/components/AnalyticsFilter.js +115 -0
- package/src/components/Attachment.js +27 -0
- package/src/components/AudienceIncluder.js +175 -0
- package/src/components/AudienceSelector.js +700 -0
- package/src/components/Button.js +66 -0
- package/src/components/CheckBox.js +77 -0
- package/src/components/ColourOptions.js +197 -0
- package/src/components/ColourPicker.js +267 -0
- package/src/components/Comment.js +46 -0
- package/src/components/CommentSection.js +116 -0
- package/src/components/DatePicker.js +290 -0
- package/src/components/DropdownInput.js +223 -0
- package/src/components/DurationInput.js +51 -0
- package/src/components/ExportCsvPopup.js +222 -0
- package/src/components/FileInput.js +389 -0
- package/src/components/GenericInput.js +169 -0
- package/src/components/Header.js +82 -0
- package/src/components/HubSidebar.js +134 -0
- package/src/components/ImageInput.js +987 -0
- package/src/components/InputGroup.js +18 -0
- package/src/components/MakerPopup.js +310 -0
- package/src/components/MoreMenu.js +22 -0
- package/src/components/OptionsSection.js +84 -0
- package/src/components/OverlayPage.js +74 -0
- package/src/components/OverlayPageBottomButtons.js +48 -0
- package/src/components/OverlayPageContents.js +48 -0
- package/src/components/OverlayPageSection.js +38 -0
- package/src/components/P60Icon.js +40 -0
- package/src/components/PageTitle.js +13 -0
- package/src/components/Popup.js +104 -0
- package/src/components/ProfilePic.js +50 -0
- package/src/components/RadioButton.js +144 -0
- package/src/components/Reactions.js +77 -0
- package/src/components/SVGIcon.js +33 -0
- package/src/components/SideNavItem.js +98 -0
- package/src/components/StatBox.js +49 -0
- package/src/components/StatusButton.js +22 -0
- package/src/components/SuccessPopup.js +57 -0
- package/src/components/Tabs.js +56 -0
- package/src/components/Tag.js +62 -0
- package/src/components/Text.js +20 -0
- package/src/components/TextFormatPopup.js +54 -0
- package/src/components/TimePicker.js +225 -0
- package/src/components/UserListing.js +111 -0
- package/src/components/index.js +46 -0
- package/src/components/svg-icons.json +821 -0
- package/src/config.js +25 -0
- package/src/helper/HelpDeskWidget.js +16 -0
- package/src/helper/api/getUrl.js +15 -0
- package/src/helper/api/getUrlParams.js +9 -0
- package/src/helper/api/safeReadParams.js +6 -0
- package/src/helper/auth/getUserFromState.js +8 -0
- package/src/helper/colours/getAppColourFromState.js +10 -0
- package/src/helper/files/canvasImageUploader.js +159 -0
- package/src/helper/files/generateImageName.js +10 -0
- package/src/helper/files/get1400.js +32 -0
- package/src/helper/files/getExtension.js +9 -0
- package/src/helper/files/getFileName.js +13 -0
- package/src/helper/files/getThumb300.js +36 -0
- package/src/helper/files/isVideo.js +8 -0
- package/src/helper/helper.js +97 -0
- package/src/helper/index.js +44 -0
- package/src/helper/site/getMerchantsFromState.js +9 -0
- package/src/helper/site/getSiteLevelFromState.js +34 -0
- package/src/helper/site/getSiteName.js +16 -0
- package/src/helper/site/getSiteNameFromRoles.js +12 -0
- package/src/helper/site/getSiteSettingFromState.js +10 -0
- package/src/helper/storage/readJSONFromStorage.js +9 -0
- package/src/helper/storage/readStorageWithCookie.js +22 -0
- package/src/helper/storage/setLocalStorage.js +5 -0
- package/src/helper/strings/getFirstName.js +10 -0
- package/src/helper/strings/htmlDecode.js +4 -0
- package/src/helper/strings/htmlEncode.js +4 -0
- package/src/helper/strings/isEmail.js +11 -0
- package/src/helper/strings/isUrl.js +13 -0
- package/src/helper/strings/onlyAlphanumeric.js +8 -0
- package/src/helper/strings/randomString.js +10 -0
- package/src/helper/strings/toParagraphed.js +17 -0
- package/src/index.js +12 -0
- package/src/reducers/ScheduledActionsReducer.js +14 -0
- package/src/reducers/TemplatesReducer.js +29 -0
- package/src/reducers/index.js +7 -0
- package/src/session.js +289 -0
- package/src/urls.js +21 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import FontAwesome from 'react-fontawesome';
|
|
3
|
+
import _ from 'lodash';
|
|
4
|
+
import { Button } from './Button';
|
|
5
|
+
import { COLOUR_DUSK_LIGHT } from '../colours';
|
|
6
|
+
import { SVGIcon } from './SVGIcon';
|
|
7
|
+
|
|
8
|
+
class Popup extends Component {
|
|
9
|
+
renderClose() {
|
|
10
|
+
if (!this.props.onClose) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return <SVGIcon colour={COLOUR_DUSK_LIGHT} icon="close" className="popup_closeIcon" onClick={this.props.onClose} />;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
renderTitle() {
|
|
17
|
+
if (_.isEmpty(this.props.title)) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return <p className="popup_title">{this.props.title}</p>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
renderSubtitle() {
|
|
24
|
+
if (_.isEmpty(this.props.subtitle)) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return <p className="popup_subtitle">{this.props.subtitle}</p>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
renderButtons() {
|
|
31
|
+
if (_.isEmpty(this.props.buttons)) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
if (this.props.verticalButtonStack) {
|
|
35
|
+
return (
|
|
36
|
+
<div className={`flex flex-1 marginTop-20${this.props.verticalButtonStack ? ' flex-column flex-center' : ' flex-center-row'}`}>
|
|
37
|
+
{this.props.buttons.map((b, index) => {
|
|
38
|
+
return (
|
|
39
|
+
<Button
|
|
40
|
+
key={index}
|
|
41
|
+
buttonType={b.type}
|
|
42
|
+
style={{ marginLeft: 8, marginRight: 8, ...b.style }}
|
|
43
|
+
className={b.className}
|
|
44
|
+
onClick={b.onClick}
|
|
45
|
+
isActive={b.isActive}
|
|
46
|
+
>
|
|
47
|
+
{b.loading ? <FontAwesome name="spinner fa-pulse fa-fw" /> : b.text}
|
|
48
|
+
</Button>
|
|
49
|
+
);
|
|
50
|
+
})}
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
return (
|
|
55
|
+
<div className="popup_buttonSection">
|
|
56
|
+
{this.props.buttons.map((b, index) => {
|
|
57
|
+
return (
|
|
58
|
+
<Button
|
|
59
|
+
key={index}
|
|
60
|
+
buttonType={b.type}
|
|
61
|
+
style={{ marginLeft: 16, ...b.style }}
|
|
62
|
+
buttonStyle={b.buttonStyle}
|
|
63
|
+
className={b.className}
|
|
64
|
+
onClick={b.onClick}
|
|
65
|
+
isActive={b.isActive}
|
|
66
|
+
leftIcon={b.leftIcon}
|
|
67
|
+
leftIconType={b.leftIconType}
|
|
68
|
+
leftIconColour={b.leftIconColour}
|
|
69
|
+
>
|
|
70
|
+
{b.loading ? <FontAwesome name="spinner fa-pulse fa-fw" /> : b.text}
|
|
71
|
+
</Button>
|
|
72
|
+
);
|
|
73
|
+
})}
|
|
74
|
+
</div>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
render() {
|
|
79
|
+
return (
|
|
80
|
+
<div className={`popup ${this.props.className}`}>
|
|
81
|
+
<div
|
|
82
|
+
className={`popup_box ${this.props.boxClasses}`}
|
|
83
|
+
style={{
|
|
84
|
+
maxHeight: this.props.maxHeight ? this.props.maxHeight : 'auto',
|
|
85
|
+
maxWidth: this.props.maxWidth ? this.props.maxWidth : 'auto',
|
|
86
|
+
minHeight: this.props.minHeight ? this.props.minHeight : 'auto',
|
|
87
|
+
minWidth: this.props.minWidth ? this.props.minWidth : 'auto',
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
90
|
+
<div className={`popup_box_inner ${this.props.hasPadding ? 'popup_box-hasPadding' : ''} ${this.props.innerClasses}`}>
|
|
91
|
+
{this.renderClose()}
|
|
92
|
+
{this.props.topContent}
|
|
93
|
+
{this.renderTitle()}
|
|
94
|
+
{this.renderSubtitle()}
|
|
95
|
+
{this.props.children}
|
|
96
|
+
</div>
|
|
97
|
+
{this.renderButtons()}
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export { Popup };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import _ from 'lodash';
|
|
3
|
+
import { connect } from 'react-redux';
|
|
4
|
+
import Config from '../config';
|
|
5
|
+
import { getAppColourFromState } from '../helper';
|
|
6
|
+
import { Text } from './Text';
|
|
7
|
+
|
|
8
|
+
class ProfilePicComponent extends Component {
|
|
9
|
+
renderPic() {
|
|
10
|
+
return (
|
|
11
|
+
<div
|
|
12
|
+
className={this.props.className}
|
|
13
|
+
style={{
|
|
14
|
+
width: this.props.size || 30,
|
|
15
|
+
height: this.props.size || 30,
|
|
16
|
+
borderRadius: this.props.size / 2 || 15,
|
|
17
|
+
backgroundColor: this.props.colourBrandingApp,
|
|
18
|
+
backgroundSize: 'cover',
|
|
19
|
+
backgroundPosition: 'center',
|
|
20
|
+
backgroundImage: `url(${!_.isEmpty(this.props.image) ? this.props.image : Config.env.defaultProfileImage})`,
|
|
21
|
+
...this.props.style,
|
|
22
|
+
}}
|
|
23
|
+
alt="Profile Pic"
|
|
24
|
+
></div>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
render() {
|
|
29
|
+
if (this.props.hoverText) {
|
|
30
|
+
return (
|
|
31
|
+
<div className={`profilePicHover ${this.props.containerClass}`}>
|
|
32
|
+
{this.renderPic()}
|
|
33
|
+
<Text type="h5" className="profilePicHover_text">
|
|
34
|
+
{this.props.hoverText}
|
|
35
|
+
</Text>
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
return this.renderPic();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const mapStateToProps = (state) => {
|
|
44
|
+
return {
|
|
45
|
+
colourBrandingApp: getAppColourFromState(state),
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const ProfilePic = connect(mapStateToProps, {})(ProfilePicComponent);
|
|
50
|
+
export { ProfilePic };
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import _ from 'lodash';
|
|
3
|
+
|
|
4
|
+
class RadioButton extends Component {
|
|
5
|
+
generateClassNames(e) {
|
|
6
|
+
let string = 'radioButton';
|
|
7
|
+
if (this.props.isActive === e) {
|
|
8
|
+
string = string + ' radioButton--active';
|
|
9
|
+
}
|
|
10
|
+
if (this.props.isSquare) {
|
|
11
|
+
string = string + ' radioButton--square';
|
|
12
|
+
}
|
|
13
|
+
return string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
generateWrapperClassNames() {
|
|
17
|
+
let string = 'radioButtonWrapper';
|
|
18
|
+
if (this.props.disabled) {
|
|
19
|
+
string = string + ' radioButton--disabled';
|
|
20
|
+
}
|
|
21
|
+
if (this.props.noHoverHighlight) {
|
|
22
|
+
string = string + ' radioButton--noHoverHighlight';
|
|
23
|
+
}
|
|
24
|
+
if (this.props.wrapperClass) {
|
|
25
|
+
string = string + this.props.wrapperClass;
|
|
26
|
+
}
|
|
27
|
+
return string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
getButtonStyle(e) {
|
|
31
|
+
const result = {};
|
|
32
|
+
if (this.props.highlightColour && this.props.isActive === e) {
|
|
33
|
+
result.borderColor = this.props.highlightColour;
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
performSingleAction(e) {
|
|
39
|
+
if (this.props.disabled) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
this.props.onChange();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
performMultiAction(e) {
|
|
46
|
+
if (this.props.disabled) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
e.onChange();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
renderLabel() {
|
|
53
|
+
if (!_.isEmpty(this.props.label)) {
|
|
54
|
+
return (
|
|
55
|
+
<div className="fieldLabel" style={{ marginBottom: 5, ...this.props.labelStyle }}>
|
|
56
|
+
{this.props.label}
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
renderSubLabel() {
|
|
64
|
+
if (!_.isEmpty(this.props.subLabel)) {
|
|
65
|
+
return (
|
|
66
|
+
<div className="genericInput-help" style={{ marginBottom: 5, ...this.props.subLabelStyle }}>
|
|
67
|
+
{this.props.subLabel}
|
|
68
|
+
</div>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
renderOptions() {
|
|
75
|
+
if (_.isUndefined(this.props.options) || _.isEmpty(this.props.options)) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<div style={{ ...styles.row, ...this.props.rowStyle }}>
|
|
81
|
+
{this.props.options.map((e) => {
|
|
82
|
+
return (
|
|
83
|
+
<div
|
|
84
|
+
className={this.generateWrapperClassNames()}
|
|
85
|
+
onClick={() => this.performMultiAction(e)}
|
|
86
|
+
key={e.Label}
|
|
87
|
+
style={{ ...styles.row, marginRight: 14, ...this.props.buttonStyle }}
|
|
88
|
+
>
|
|
89
|
+
<div className={this.generateClassNames(e.Value)} style={this.getButtonStyle(e.Value)} />
|
|
90
|
+
{e.Label && <span className="actionText">{e.Label}</span>}
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
})}
|
|
94
|
+
</div>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
renderHelp() {
|
|
99
|
+
if (!_.isEmpty(this.props.help)) {
|
|
100
|
+
return (
|
|
101
|
+
<div className="genericInput-help" style={{ marginTop: 4 }}>
|
|
102
|
+
{this.props.help}
|
|
103
|
+
</div>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
render() {
|
|
110
|
+
if (this.props.single) {
|
|
111
|
+
return (
|
|
112
|
+
<div
|
|
113
|
+
className={this.generateWrapperClassNames()}
|
|
114
|
+
onClick={() => this.performSingleAction()}
|
|
115
|
+
key={this.props.val}
|
|
116
|
+
style={this.props.style}
|
|
117
|
+
>
|
|
118
|
+
<div className={this.generateClassNames(this.props.val)} style={this.getButtonStyle(this.props.val)} />
|
|
119
|
+
{this.renderHelp()}
|
|
120
|
+
</div>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
return (
|
|
124
|
+
<div className={this.props.className} style={this.props.style}>
|
|
125
|
+
{this.renderLabel()}
|
|
126
|
+
{this.renderSubLabel()}
|
|
127
|
+
{this.renderOptions()}
|
|
128
|
+
{this.renderHelp()}
|
|
129
|
+
</div>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const styles = {
|
|
135
|
+
row: {
|
|
136
|
+
display: 'flex',
|
|
137
|
+
flexDirection: 'row',
|
|
138
|
+
},
|
|
139
|
+
centeredRow: {
|
|
140
|
+
justifyContent: 'center',
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export { RadioButton };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { Text } from './Text';
|
|
3
|
+
|
|
4
|
+
const getReactions = () => {
|
|
5
|
+
return [
|
|
6
|
+
{
|
|
7
|
+
key: 'heart',
|
|
8
|
+
icon: 'https://pluss60-demo-media.s3-ap-southeast-2.amazonaws.com/assets/emojis/heart.png',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
key: 'smile',
|
|
12
|
+
icon: 'https://pluss60-demo-media.s3-ap-southeast-2.amazonaws.com/assets/emojis/smile.png',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
key: 'sad',
|
|
16
|
+
icon: 'https://pluss60-demo-media.s3-ap-southeast-2.amazonaws.com/assets/emojis/sad.png',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
key: 'party',
|
|
20
|
+
icon: 'https://pluss60-demo-media.s3-ap-southeast-2.amazonaws.com/assets/emojis/party.png',
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
class Reactions extends Component {
|
|
26
|
+
state = {
|
|
27
|
+
reactions: getReactions(),
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
getReaction(key) {
|
|
31
|
+
if (this.props.reactions) {
|
|
32
|
+
if (!this.props.reactions[key]) {
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
return this.props.reactions[key];
|
|
36
|
+
}
|
|
37
|
+
if (!this.props.entity) {
|
|
38
|
+
return 0;
|
|
39
|
+
}
|
|
40
|
+
if (!this.props.entity.Reactions) {
|
|
41
|
+
return 0;
|
|
42
|
+
}
|
|
43
|
+
if (!this.props.entity.Reactions[key]) {
|
|
44
|
+
return 0;
|
|
45
|
+
}
|
|
46
|
+
return Object.keys(this.props.entity.Reactions[key]).length;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
renderReactions() {
|
|
50
|
+
return this.state.reactions.map((r, i) => {
|
|
51
|
+
return (
|
|
52
|
+
<div className="polloverview_section" key={r.key}>
|
|
53
|
+
<img src={r.icon} className="polloverview_iconImage" alt={r.key} />
|
|
54
|
+
<div className="polloverview_right">
|
|
55
|
+
<p className="polloverview_count">{this.getReaction(r.key)}</p>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
render() {
|
|
63
|
+
if (this.props.compact) {
|
|
64
|
+
return <div className="compactreactions">{this.renderReactions()}</div>;
|
|
65
|
+
}
|
|
66
|
+
return (
|
|
67
|
+
<div>
|
|
68
|
+
<Text type="formTitleSmall" className="marginBottom-16">
|
|
69
|
+
Reactions
|
|
70
|
+
</Text>
|
|
71
|
+
<div className="polloverview">{this.renderReactions()}</div>
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { Reactions };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import icons from './svg-icons.json';
|
|
3
|
+
import _ from 'lodash';
|
|
4
|
+
|
|
5
|
+
class SVGIcon extends Component {
|
|
6
|
+
renderPaths() {
|
|
7
|
+
const { icon, colour } = this.props;
|
|
8
|
+
|
|
9
|
+
return icons[icon].paths.map((p, i) => {
|
|
10
|
+
let pathProps = {};
|
|
11
|
+
if (icons[icon].pathRules && icons[icon].pathRules[i]) {
|
|
12
|
+
pathProps = icons[icon].pathRules[i];
|
|
13
|
+
}
|
|
14
|
+
return <path key={p.substring(0, 20)} d={p} fill={colour} {...pathProps} />;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
render() {
|
|
19
|
+
const icon = icons[this.props.icon];
|
|
20
|
+
if (!icon) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
const viewBox = icons[this.props.icon].viewBox;
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox={viewBox} {..._.omit(this.props, ['colour'])}>
|
|
27
|
+
{this.renderPaths()}
|
|
28
|
+
</svg>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { SVGIcon };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { withRouter } from 'react-router';
|
|
3
|
+
import { connect } from 'react-redux';
|
|
4
|
+
import _ from 'lodash';
|
|
5
|
+
import FontAwesome from 'react-fontawesome';
|
|
6
|
+
import { P60Icon } from './P60Icon';
|
|
7
|
+
import { SVGIcon } from './SVGIcon';
|
|
8
|
+
import { COLOUR_DUSK_LIGHTER } from '../colours';
|
|
9
|
+
|
|
10
|
+
class SideNavItem extends Component {
|
|
11
|
+
constructor(props) {
|
|
12
|
+
super(props);
|
|
13
|
+
this.state = { url: window.location.pathname };
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
17
|
+
if (!_.isUndefined(nextProps.url) && !_.isEmpty(nextProps.url)) {
|
|
18
|
+
this.setState({ url: nextProps.url });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
goTo = () => {
|
|
23
|
+
if (this.props.onClick) {
|
|
24
|
+
return this.props.onClick();
|
|
25
|
+
}
|
|
26
|
+
if (!_.isUndefined(this.props.onUrlChange)) {
|
|
27
|
+
this.props.onUrlChange();
|
|
28
|
+
}
|
|
29
|
+
this.props.history.push(this.props.Link);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
getClassNames() {
|
|
33
|
+
let result = '';
|
|
34
|
+
if (this.props.className) {
|
|
35
|
+
result += ` ${this.props.className}`;
|
|
36
|
+
}
|
|
37
|
+
if (this.state.url === this.props.Link || this.props.selected) {
|
|
38
|
+
result += ' sideNav-item--active';
|
|
39
|
+
}
|
|
40
|
+
if (this.props.subStyle) {
|
|
41
|
+
result += ' sideNav-item-subStyle';
|
|
42
|
+
}
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
renderIcon() {
|
|
47
|
+
if (!this.props.Icon) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
let content = null;
|
|
51
|
+
if (this.props.isFontAwesome) {
|
|
52
|
+
content = <FontAwesome className="sideNav-item-icon" name={this.props.Icon} style={this.props.iconStyle} />;
|
|
53
|
+
} else if (this.props.isSVG) {
|
|
54
|
+
content = <SVGIcon className="sideNav-item-icon" icon={this.props.Icon} colour={COLOUR_DUSK_LIGHTER} style={this.props.iconStyle} />;
|
|
55
|
+
} else {
|
|
56
|
+
content = <P60Icon className="sideNav-item-icon" icon={this.props.Icon} style={this.props.iconStyle} />;
|
|
57
|
+
}
|
|
58
|
+
return <div style={{ ...styles.section, width: 18, marginRight: 16 }}>{content}</div>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
render() {
|
|
62
|
+
return (
|
|
63
|
+
<div className={`sideNav-item${this.getClassNames()}`} style={this.props.style} onClick={this.goTo}>
|
|
64
|
+
{!this.props.noSideDot && (
|
|
65
|
+
<div style={{ ...styles.section, marginRight: 15 }}>
|
|
66
|
+
<div className="sideNav-item-dot" style={styles.sideNavDot} />
|
|
67
|
+
</div>
|
|
68
|
+
)}
|
|
69
|
+
{this.renderIcon()}
|
|
70
|
+
<div className="sideNav-item-text" style={styles.section}>
|
|
71
|
+
{this.props.Text}
|
|
72
|
+
</div>
|
|
73
|
+
{!_.isNil(this.props.count) && this.props.count > 0 && (
|
|
74
|
+
<div className="sideNav-item-extra">
|
|
75
|
+
<div className="count">{this.props.count > 99 ? 99 : this.props.count}</div>
|
|
76
|
+
</div>
|
|
77
|
+
)}
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const styles = {
|
|
84
|
+
section: {
|
|
85
|
+
display: 'flex',
|
|
86
|
+
alignItems: 'center',
|
|
87
|
+
minHeight: 22,
|
|
88
|
+
},
|
|
89
|
+
sideNavDot: {
|
|
90
|
+
width: 5,
|
|
91
|
+
height: 5,
|
|
92
|
+
borderRadius: 5,
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
let exportObj = connect(null, {})(withRouter(SideNavItem));
|
|
97
|
+
|
|
98
|
+
export { exportObj as SideNavItem };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Link } from 'react-router-dom';
|
|
3
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
4
|
+
import { faChartLine } from '@fortawesome/free-solid-svg-icons';
|
|
5
|
+
import { Text } from './Text';
|
|
6
|
+
|
|
7
|
+
// StatBox Component
|
|
8
|
+
const StatBox = ({ title, icon, value, previousValue, prevText, viewGraphLink, isLoading }) => {
|
|
9
|
+
let change = (value / previousValue - 1) * 100;
|
|
10
|
+
if (isNaN(change)) {
|
|
11
|
+
change = 0;
|
|
12
|
+
}
|
|
13
|
+
if (!isFinite(change)) {
|
|
14
|
+
change = 100;
|
|
15
|
+
}
|
|
16
|
+
change = parseInt(change);
|
|
17
|
+
const opacity = isLoading ? 0 : 1;
|
|
18
|
+
return (
|
|
19
|
+
<div
|
|
20
|
+
className={`dashboardBox dashboardBox-stats dashboardBox-inline${change > 0 ? ' dashboardBox-stats-positive' : ''}${
|
|
21
|
+
change < 0 ? ' dashboardBox-stats-negative' : ''
|
|
22
|
+
}`}
|
|
23
|
+
>
|
|
24
|
+
<div className="dashboardBox-stats_title">
|
|
25
|
+
<Text type="h6">{title}</Text>
|
|
26
|
+
</div>
|
|
27
|
+
<div className="dashboardBox-stats_mid" style={{ opacity }}>
|
|
28
|
+
<FontAwesomeIcon className="dashboardBox-stats_icon" icon={icon} />
|
|
29
|
+
<Text type="h2" className="dashboardBox-stats_count">
|
|
30
|
+
{value}
|
|
31
|
+
</Text>
|
|
32
|
+
<p className="dashboardBox-stats_change">{change === 0 ? 'No change' : `${change}% ${change < 0 ? '↓' : '↑'}`}</p>
|
|
33
|
+
</div>
|
|
34
|
+
<Text type="help" style={{ opacity }}>
|
|
35
|
+
Compared to {prevText}
|
|
36
|
+
</Text>
|
|
37
|
+
{viewGraphLink && (
|
|
38
|
+
<Link to={`${viewGraphLink}&title=${title}`}>
|
|
39
|
+
<Text type="h5-noUpper" className="text-link marginTop-10">
|
|
40
|
+
<FontAwesomeIcon icon={faChartLine} style={{ marginRight: 4 }} />
|
|
41
|
+
View Graph
|
|
42
|
+
</Text>
|
|
43
|
+
</Link>
|
|
44
|
+
)}
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export { StatBox };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
|
|
3
|
+
class StatusButton extends Component {
|
|
4
|
+
render() {
|
|
5
|
+
if (this.props.isActive) {
|
|
6
|
+
return (
|
|
7
|
+
<div className="tagWrapper tagWrapper--active" onClick={this.props.deactivate}>
|
|
8
|
+
<p className="tagWrapper__content tagWrapper__text">{this.props.activeText}</p>
|
|
9
|
+
<p className="tagWrapper__hoverContent tagWrapper__text">{this.props.deactivateText}</p>
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
return (
|
|
14
|
+
<div className="tagWrapper tagWrapper--inactive" onClick={this.props.activate}>
|
|
15
|
+
<p className="tagWrapper__content tagWrapper__text">{this.props.inactiveText}</p>
|
|
16
|
+
<p className="tagWrapper__hoverContent tagWrapper__text">{this.props.activateText}</p>
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { StatusButton };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import FontAwesome from 'react-fontawesome';
|
|
3
|
+
import _ from 'lodash';
|
|
4
|
+
import { Button } from './Button';
|
|
5
|
+
|
|
6
|
+
class SuccessPopup extends Component {
|
|
7
|
+
getBackgroundClasses() {
|
|
8
|
+
return this.props.backgroundClose ? 'successPopupBackground pointer' : 'successPopupBackground';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
renderButtons() {
|
|
12
|
+
if (_.isEmpty(this.props.buttons)) return null;
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div className="successPopup_buttons">
|
|
16
|
+
{this.props.buttons.map((b, i) => {
|
|
17
|
+
return (
|
|
18
|
+
<Button key={i} buttonClassName="successPopup_button" buttonType={b.type} isActive={!b.inactive} onClick={b.onClick}>
|
|
19
|
+
{b.text}
|
|
20
|
+
</Button>
|
|
21
|
+
);
|
|
22
|
+
})}
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
renderClose() {
|
|
28
|
+
if (!this.props.closeAction) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
return (
|
|
32
|
+
<a style={{ position: 'absolute', top: 16, right: 16, cursor: 'pointer' }} onClick={this.props.closeAction}>
|
|
33
|
+
<FontAwesome name="remove" />
|
|
34
|
+
</a>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
render() {
|
|
39
|
+
return (
|
|
40
|
+
<div className={this.getBackgroundClasses()}>
|
|
41
|
+
<div className="successPopup">
|
|
42
|
+
{this.props.noIcon || (
|
|
43
|
+
<div className="successPopup_tick">
|
|
44
|
+
<FontAwesome className="successPopup_tick_icon" name={'check'} />
|
|
45
|
+
</div>
|
|
46
|
+
)}
|
|
47
|
+
{this.renderClose()}
|
|
48
|
+
{!_.isEmpty(this.props.text) && <p className="successPopup_text">{this.props.text}</p>}
|
|
49
|
+
{this.props.children}
|
|
50
|
+
{this.renderButtons()}
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { SuccessPopup };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
|
|
3
|
+
class Tabs extends Component {
|
|
4
|
+
constructor(props) {
|
|
5
|
+
super(props);
|
|
6
|
+
|
|
7
|
+
this.state = {
|
|
8
|
+
editKey: null,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
getTabClass(tab) {
|
|
13
|
+
let classes = 'tab';
|
|
14
|
+
if (this.props.selectedTab === tab.value) {
|
|
15
|
+
classes += ' tab-selected';
|
|
16
|
+
}
|
|
17
|
+
if (tab.strikethrough) {
|
|
18
|
+
classes += ' tab-strikethrough';
|
|
19
|
+
}
|
|
20
|
+
if (tab.isInvalid) {
|
|
21
|
+
classes += ' tab-invalid';
|
|
22
|
+
}
|
|
23
|
+
return classes;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
renderTab(tab) {
|
|
27
|
+
return (
|
|
28
|
+
<div
|
|
29
|
+
key={tab.value}
|
|
30
|
+
onClick={() => {
|
|
31
|
+
this.props.onSelectTab(tab.value);
|
|
32
|
+
}}
|
|
33
|
+
className={this.getTabClass(tab)}
|
|
34
|
+
id={tab.value}
|
|
35
|
+
style={this.props.tabStyle}
|
|
36
|
+
>
|
|
37
|
+
<p className="tab_text" id={`tab_${tab.value}`}>
|
|
38
|
+
{tab.text}
|
|
39
|
+
</p>
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
render() {
|
|
45
|
+
return (
|
|
46
|
+
<div className={`tabContainer ${this.props.className || ''}`} style={this.props.containerStyle}>
|
|
47
|
+
{this.props.tabs.map((t) => {
|
|
48
|
+
return this.renderTab(t);
|
|
49
|
+
})}
|
|
50
|
+
{this.props.children}
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { Tabs };
|