@plusscommunities/pluss-core-web 1.7.3-beta.1 → 1.7.4-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components.js +37233 -474
- package/dist/components.js.map +1 -1
- package/dist/index.js +37233 -474
- package/dist/index.js.map +1 -1
- package/package.json +22 -31
- package/.babelrc +0 -3
- package/dist/index.cjs.js +0 -10388
- package/dist/index.esm.js +0 -10349
- package/dist/index.umd.js +0 -10361
- package/rollup.config.js +0 -57
- package/src/actions/AuthActions.js +0 -83
- package/src/actions/LocalActions.js +0 -8
- package/src/actions/NavActions.js +0 -8
- package/src/actions/ScheduledActionsActions.js +0 -8
- package/src/actions/TemplateActions.js +0 -15
- package/src/actions/UsersActions.js +0 -95
- package/src/actions/index.js +0 -6
- package/src/actions/types.js +0 -23
- package/src/analytics.js +0 -183
- package/src/apis/analyticsActions.js +0 -53
- package/src/apis/authActions.js +0 -58
- package/src/apis/fileActions.js +0 -152
- package/src/apis/index.js +0 -10
- package/src/apis/profileActions.js +0 -133
- package/src/apis/scheduledActionsActions.js +0 -12
- package/src/apis/stringActions.js +0 -25
- package/src/apis/templateActions.js +0 -41
- package/src/apis/typeActions.js +0 -186
- package/src/apis/userActions.js +0 -169
- package/src/apis/utilityActions.js +0 -35
- package/src/colours.js +0 -134
- package/src/components/AddButton.js +0 -27
- package/src/components/AnalyticsFilter.js +0 -115
- package/src/components/Attachment.js +0 -27
- package/src/components/AudienceIncluder.js +0 -175
- package/src/components/AudienceSelector.js +0 -700
- package/src/components/Button.js +0 -66
- package/src/components/CheckBox.js +0 -77
- package/src/components/ColourOptions.js +0 -197
- package/src/components/ColourPicker.js +0 -267
- package/src/components/Comment.js +0 -46
- package/src/components/CommentSection.js +0 -116
- package/src/components/DatePicker.js +0 -290
- package/src/components/DropdownInput.js +0 -223
- package/src/components/DurationInput.js +0 -51
- package/src/components/ExportCsvPopup.js +0 -222
- package/src/components/FileInput.js +0 -389
- package/src/components/GenericInput.js +0 -169
- package/src/components/Header.js +0 -82
- package/src/components/HubSidebar.js +0 -134
- package/src/components/ImageInput.js +0 -987
- package/src/components/InputGroup.js +0 -18
- package/src/components/MakerPopup.js +0 -310
- package/src/components/MoreMenu.js +0 -22
- package/src/components/OptionsSection.js +0 -84
- package/src/components/OverlayPage.js +0 -74
- package/src/components/OverlayPageBottomButtons.js +0 -48
- package/src/components/OverlayPageContents.js +0 -48
- package/src/components/OverlayPageSection.js +0 -38
- package/src/components/P60Icon.js +0 -40
- package/src/components/PageTitle.js +0 -13
- package/src/components/Popup.js +0 -104
- package/src/components/ProfilePic.js +0 -50
- package/src/components/RadioButton.js +0 -144
- package/src/components/Reactions.js +0 -77
- package/src/components/SVGIcon.js +0 -33
- package/src/components/SideNavItem.js +0 -98
- package/src/components/StatBox.js +0 -49
- package/src/components/StatusButton.js +0 -22
- package/src/components/SuccessPopup.js +0 -57
- package/src/components/Tabs.js +0 -56
- package/src/components/Tag.js +0 -62
- package/src/components/Text.js +0 -20
- package/src/components/TextFormatPopup.js +0 -54
- package/src/components/TimePicker.js +0 -225
- package/src/components/UserListing.js +0 -111
- package/src/components/index.js +0 -46
- package/src/components/svg-icons.json +0 -821
- package/src/config.js +0 -25
- package/src/helper/HelpDeskWidget.js +0 -16
- package/src/helper/api/getUrl.js +0 -15
- package/src/helper/api/getUrlParams.js +0 -9
- package/src/helper/api/safeReadParams.js +0 -6
- package/src/helper/auth/getUserFromState.js +0 -8
- package/src/helper/colours/getAppColourFromState.js +0 -10
- package/src/helper/files/canvasImageUploader.js +0 -159
- package/src/helper/files/generateImageName.js +0 -10
- package/src/helper/files/get1400.js +0 -32
- package/src/helper/files/getExtension.js +0 -9
- package/src/helper/files/getFileName.js +0 -13
- package/src/helper/files/getThumb300.js +0 -36
- package/src/helper/files/isVideo.js +0 -8
- package/src/helper/helper.js +0 -97
- package/src/helper/index.js +0 -44
- package/src/helper/site/getMerchantsFromState.js +0 -9
- package/src/helper/site/getSiteLevelFromState.js +0 -34
- package/src/helper/site/getSiteName.js +0 -16
- package/src/helper/site/getSiteNameFromRoles.js +0 -12
- package/src/helper/site/getSiteSettingFromState.js +0 -10
- package/src/helper/storage/readJSONFromStorage.js +0 -9
- package/src/helper/storage/readStorageWithCookie.js +0 -22
- package/src/helper/storage/setLocalStorage.js +0 -5
- package/src/helper/strings/getFirstName.js +0 -10
- package/src/helper/strings/htmlDecode.js +0 -4
- package/src/helper/strings/htmlEncode.js +0 -4
- package/src/helper/strings/isEmail.js +0 -11
- package/src/helper/strings/isUrl.js +0 -13
- package/src/helper/strings/onlyAlphanumeric.js +0 -8
- package/src/helper/strings/randomString.js +0 -10
- package/src/helper/strings/toParagraphed.js +0 -17
- package/src/index.js +0 -12
- package/src/reducers/ScheduledActionsReducer.js +0 -14
- package/src/reducers/TemplatesReducer.js +0 -29
- package/src/reducers/index.js +0 -7
- package/src/session.js +0 -289
- package/src/urls.js +0 -21
package/src/components/Button.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import FontAwesome from 'react-fontawesome';
|
|
3
|
-
import { SVGIcon } from './SVGIcon';
|
|
4
|
-
|
|
5
|
-
class Button extends Component {
|
|
6
|
-
getClasses() {
|
|
7
|
-
let string = '';
|
|
8
|
-
if (this.props.inline) string = string + 'buttonWrapper--inline ';
|
|
9
|
-
if (this.props.isActive) string = string + 'button--active ';
|
|
10
|
-
if (this.props.buttonType) string = string + `button--${this.props.buttonType}`;
|
|
11
|
-
if (this.props.compact) string = string + ' buttonWrapper--compact';
|
|
12
|
-
if (this.props.narrow) string = string + ' buttonWrapper--narrow';
|
|
13
|
-
if (this.props.noHoverHighlight) string = string + ' button--noHoverHighlight';
|
|
14
|
-
if (this.props.className) string = string + ' ' + this.props.className;
|
|
15
|
-
return string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
getButtonClasses() {
|
|
19
|
-
if (this.props.buttonClassName) {
|
|
20
|
-
return `button ${this.props.buttonClassName}`;
|
|
21
|
-
}
|
|
22
|
-
return 'button';
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
getButtonTextClasses() {
|
|
26
|
-
let result = 'buttonText';
|
|
27
|
-
if (this.props.leftIcon) {
|
|
28
|
-
result = result + ` buttonTextWithIcon`;
|
|
29
|
-
}
|
|
30
|
-
if (this.props.buttonTextClassName) {
|
|
31
|
-
result = result + ` ${this.props.buttonTextClassName}`;
|
|
32
|
-
}
|
|
33
|
-
return result;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
buttonClick() {
|
|
37
|
-
if (this.props.onClick) {
|
|
38
|
-
this.props.onClick();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
renderLeftIcon() {
|
|
43
|
-
if (!this.props.leftIcon) {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
if (this.props.leftIconType === 'svg') {
|
|
47
|
-
return <SVGIcon icon={this.props.leftIcon} className="buttonTextWithIcon_icon" colour={this.props.leftIconColour} />;
|
|
48
|
-
}
|
|
49
|
-
return <FontAwesome name={this.props.leftIcon} className="buttonTextWithIcon_icon" />;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
render() {
|
|
53
|
-
return (
|
|
54
|
-
<div className={`buttonWrapper ${this.getClasses()}`} style={{ ...this.props.buttonStyle }}>
|
|
55
|
-
<div onClick={() => this.buttonClick()} className={this.getButtonClasses()} style={{ ...this.props.style }}>
|
|
56
|
-
<div className={this.getButtonTextClasses()} style={{ ...this.props.textStyle }}>
|
|
57
|
-
{this.renderLeftIcon()}
|
|
58
|
-
{this.props.children}
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export { Button };
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import React, { PureComponent } from 'react';
|
|
2
|
-
import FontAwesome from 'react-fontawesome';
|
|
3
|
-
import _ from 'lodash';
|
|
4
|
-
|
|
5
|
-
class CheckBox extends PureComponent {
|
|
6
|
-
generateClassNames() {
|
|
7
|
-
let result = 'checkBox';
|
|
8
|
-
if (this.props.isActive) {
|
|
9
|
-
result = result + ' checkBox--active';
|
|
10
|
-
}
|
|
11
|
-
if (this.props.disabled) {
|
|
12
|
-
result = result + ' checkBox--disabled';
|
|
13
|
-
}
|
|
14
|
-
if (this.props.noHoverHighlight) {
|
|
15
|
-
result = result + ' checkBox--noHoverHighlight';
|
|
16
|
-
}
|
|
17
|
-
return result;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
getLabelClasses() {
|
|
21
|
-
let result = 'actionText pointer';
|
|
22
|
-
if (this.props.disabled) {
|
|
23
|
-
result = result + ' actionText--disabled';
|
|
24
|
-
}
|
|
25
|
-
return result;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
getBoxStyle() {
|
|
29
|
-
const result = {};
|
|
30
|
-
if (this.props.highlightColour && this.props.isActive) {
|
|
31
|
-
result.borderColor = this.props.highlightColour;
|
|
32
|
-
result.backgroundColor = this.props.highlightColour;
|
|
33
|
-
}
|
|
34
|
-
return result;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
onChange = (e) => {
|
|
38
|
-
if (this.props.disabled) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
return this.props.onChange(e);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
render() {
|
|
45
|
-
return (
|
|
46
|
-
<div className={this.props.className}>
|
|
47
|
-
<div className={this.props.showWarning ? 'checkBox--error' : null} style={{ ...styles.row, ...this.props.style }}>
|
|
48
|
-
<div className={this.generateClassNames()} onClick={this.onChange} style={this.getBoxStyle()}>
|
|
49
|
-
<div className="checkBoxTick">
|
|
50
|
-
<FontAwesome className="checkBoxTick-font" name={'check'} />
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
{!_.isEmpty(this.props.label) && (
|
|
54
|
-
<div
|
|
55
|
-
className={this.getLabelClasses()}
|
|
56
|
-
style={{ marginLeft: 8, fontSize: 14, lineHeight: '20px', ...this.props.labelStyle }}
|
|
57
|
-
onClick={this.onChange}
|
|
58
|
-
>
|
|
59
|
-
{this.props.label}
|
|
60
|
-
</div>
|
|
61
|
-
)}
|
|
62
|
-
</div>
|
|
63
|
-
{this.props.children}
|
|
64
|
-
</div>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const styles = {
|
|
70
|
-
row: {
|
|
71
|
-
display: 'flex',
|
|
72
|
-
flexDirection: 'row',
|
|
73
|
-
marginBottom: 8,
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export { CheckBox };
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import _ from 'lodash';
|
|
3
|
-
import FontAwesome from 'react-fontawesome';
|
|
4
|
-
import { ChromePicker } from 'react-color';
|
|
5
|
-
import tinycolor from 'tinycolor2';
|
|
6
|
-
import { Tabs } from './Tabs';
|
|
7
|
-
|
|
8
|
-
class ColourOptions extends Component {
|
|
9
|
-
constructor(props) {
|
|
10
|
-
super(props);
|
|
11
|
-
this.state = {
|
|
12
|
-
selectedColour: props.value || '',
|
|
13
|
-
colour: props.value,
|
|
14
|
-
selectedOption: props.defaultTab || 'vibrant',
|
|
15
|
-
colourCircleTop: 0,
|
|
16
|
-
colourCircleLeft: 0,
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
componentDidMount() {
|
|
21
|
-
this.setColourCircle();
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
componentDidUpdate(prevProps) {
|
|
25
|
-
if (this.props.value !== prevProps.value) {
|
|
26
|
-
const { value } = this.props;
|
|
27
|
-
this.setState({ selectedColour: value, colour: value }, this.setColourCircle);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
setColourCircle = () => {
|
|
32
|
-
const tc = tinycolor(this.state.colour);
|
|
33
|
-
this.setState({
|
|
34
|
-
colourCircleTop: 100 - (100 * tc.getBrightness()) / 255,
|
|
35
|
-
colourCircleLeft: (100 * tc.toHsv().h) / 360,
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
getQuickChoiceTabs() {
|
|
40
|
-
const { options } = this.props;
|
|
41
|
-
const optionsArray = typeof options === 'string' ? options.split(',').map((o) => o.trim()) : options;
|
|
42
|
-
const available = [
|
|
43
|
-
{
|
|
44
|
-
value: 'vibrant',
|
|
45
|
-
text: 'Vibrant',
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
value: 'soft',
|
|
49
|
-
text: 'Soft',
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
value: 'picker',
|
|
53
|
-
text: 'Picker',
|
|
54
|
-
},
|
|
55
|
-
];
|
|
56
|
-
return !optionsArray || optionsArray.length === 0 ? available : available.filter((o) => optionsArray.includes(o.value));
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
onColourChange = (color) => {
|
|
60
|
-
// console.log('onColourChange', color);
|
|
61
|
-
const colour = (typeof color === 'object' ? color.hex : color).toUpperCase();
|
|
62
|
-
this.setState({ selectedColour: colour, colour }, () => {
|
|
63
|
-
this.setColourCircle();
|
|
64
|
-
const { onColourSelected } = this.props;
|
|
65
|
-
if (onColourSelected) onColourSelected(this.state.colour);
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
onSelectOption = (selectedOption) => {
|
|
70
|
-
this.setState({ selectedOption });
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
renderColourQuickChoicesCircle(colour, selectedColour) {
|
|
74
|
-
const isSelected = selectedColour.toLowerCase() === colour.toLowerCase();
|
|
75
|
-
return (
|
|
76
|
-
<div
|
|
77
|
-
className={`colourQuickChoices_circle${isSelected ? ' colourQuickChoices_circle-selected' : ''}`}
|
|
78
|
-
style={{ backgroundColor: colour }}
|
|
79
|
-
onClick={() => this.onColourChange(colour)}
|
|
80
|
-
>
|
|
81
|
-
<FontAwesome name="check" className="colourQuickChoices_circle_tick" />
|
|
82
|
-
</div>
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
renderColourOptions() {
|
|
87
|
-
const { selectedColour, selectedOption } = this.state;
|
|
88
|
-
|
|
89
|
-
let content;
|
|
90
|
-
switch (selectedOption) {
|
|
91
|
-
case 'picker':
|
|
92
|
-
content = (
|
|
93
|
-
<div className="flex flex-center-row colourQuickChoices" style={{ marginBottom: 'unset' }}>
|
|
94
|
-
<ChromePicker color={selectedColour} onChangeComplete={this.onColourChange} disableAlpha className="chrome-picker-noShadow" />
|
|
95
|
-
</div>
|
|
96
|
-
);
|
|
97
|
-
break;
|
|
98
|
-
case 'vibrant':
|
|
99
|
-
content = (
|
|
100
|
-
<div className="flex flex-between colourQuickChoices" style={{ marginBottom: 'unset' }}>
|
|
101
|
-
<div className="colourQuickChoices_column">
|
|
102
|
-
{this.renderColourQuickChoicesCircle('#c44569', selectedColour)}
|
|
103
|
-
{this.renderColourQuickChoicesCircle('#f1a459', selectedColour)}
|
|
104
|
-
{this.renderColourQuickChoicesCircle('#38ada9', selectedColour)}
|
|
105
|
-
{this.renderColourQuickChoicesCircle('#7064a7', selectedColour)}
|
|
106
|
-
</div>
|
|
107
|
-
<div className="colourQuickChoices_column">
|
|
108
|
-
{this.renderColourQuickChoicesCircle('#ea4c88', selectedColour)}
|
|
109
|
-
{this.renderColourQuickChoicesCircle('#e8bb67', selectedColour)}
|
|
110
|
-
{this.renderColourQuickChoicesCircle('#60a3bc', selectedColour)}
|
|
111
|
-
{this.renderColourQuickChoicesCircle('#546de5', selectedColour)}
|
|
112
|
-
</div>
|
|
113
|
-
<div className="colourQuickChoices_column">
|
|
114
|
-
{this.renderColourQuickChoicesCircle('#e66767', selectedColour)}
|
|
115
|
-
{this.renderColourQuickChoicesCircle('#94d0c5', selectedColour)}
|
|
116
|
-
{this.renderColourQuickChoicesCircle('#5badda', selectedColour)}
|
|
117
|
-
{this.renderColourQuickChoicesCircle('#dfad8c', selectedColour)}
|
|
118
|
-
</div>
|
|
119
|
-
<div className="colourQuickChoices_column">
|
|
120
|
-
{this.renderColourQuickChoicesCircle('#ff6c5c', selectedColour)}
|
|
121
|
-
{this.renderColourQuickChoicesCircle('#7abf9e', selectedColour)}
|
|
122
|
-
{this.renderColourQuickChoicesCircle('#9fcfd9', selectedColour)}
|
|
123
|
-
{this.renderColourQuickChoicesCircle('#dd91a7', selectedColour)}
|
|
124
|
-
</div>
|
|
125
|
-
<div className="colourQuickChoices_column">
|
|
126
|
-
{this.renderColourQuickChoicesCircle('#f19066', selectedColour)}
|
|
127
|
-
{this.renderColourQuickChoicesCircle('#a1ab94', selectedColour)}
|
|
128
|
-
{this.renderColourQuickChoicesCircle('#a67db7', selectedColour)}
|
|
129
|
-
{this.renderColourQuickChoicesCircle('#596275', selectedColour)}
|
|
130
|
-
</div>
|
|
131
|
-
</div>
|
|
132
|
-
);
|
|
133
|
-
break;
|
|
134
|
-
case 'soft':
|
|
135
|
-
content = (
|
|
136
|
-
<div className="flex flex-between colourQuickChoices" style={{ marginBottom: 'unset' }}>
|
|
137
|
-
<div className="colourQuickChoices_column">
|
|
138
|
-
{this.renderColourQuickChoicesCircle('#eacdd0', selectedColour)}
|
|
139
|
-
{this.renderColourQuickChoicesCircle('#a4c9d7', selectedColour)}
|
|
140
|
-
{this.renderColourQuickChoicesCircle('#c6b9c0', selectedColour)}
|
|
141
|
-
{this.renderColourQuickChoicesCircle('#cdc4af', selectedColour)}
|
|
142
|
-
</div>
|
|
143
|
-
<div className="colourQuickChoices_column">
|
|
144
|
-
{this.renderColourQuickChoicesCircle('#d6b7b1', selectedColour)}
|
|
145
|
-
{this.renderColourQuickChoicesCircle('#eaf2f4', selectedColour)}
|
|
146
|
-
{this.renderColourQuickChoicesCircle('#cce0db', selectedColour)}
|
|
147
|
-
{this.renderColourQuickChoicesCircle('#b9bee4', selectedColour)}
|
|
148
|
-
</div>
|
|
149
|
-
<div className="colourQuickChoices_column">
|
|
150
|
-
{this.renderColourQuickChoicesCircle('#9bd3cb', selectedColour)}
|
|
151
|
-
{this.renderColourQuickChoicesCircle('#f1d7bb', selectedColour)}
|
|
152
|
-
{this.renderColourQuickChoicesCircle('#fcbc7b', selectedColour)}
|
|
153
|
-
{this.renderColourQuickChoicesCircle('#caeff5', selectedColour)}
|
|
154
|
-
</div>
|
|
155
|
-
<div className="colourQuickChoices_column">
|
|
156
|
-
{this.renderColourQuickChoicesCircle('#e0dceb', selectedColour)}
|
|
157
|
-
{this.renderColourQuickChoicesCircle('#b1becd', selectedColour)}
|
|
158
|
-
{this.renderColourQuickChoicesCircle('#e6cfc5', selectedColour)}
|
|
159
|
-
{this.renderColourQuickChoicesCircle('#cfd6df', selectedColour)}
|
|
160
|
-
</div>
|
|
161
|
-
<div className="colourQuickChoices_column">
|
|
162
|
-
{this.renderColourQuickChoicesCircle('#f39ca4', selectedColour)}
|
|
163
|
-
{this.renderColourQuickChoicesCircle('#c0adc5', selectedColour)}
|
|
164
|
-
{this.renderColourQuickChoicesCircle('#fcbca4', selectedColour)}
|
|
165
|
-
{this.renderColourQuickChoicesCircle('#c5ceb9', selectedColour)}
|
|
166
|
-
</div>
|
|
167
|
-
</div>
|
|
168
|
-
);
|
|
169
|
-
break;
|
|
170
|
-
default:
|
|
171
|
-
content = null;
|
|
172
|
-
break;
|
|
173
|
-
}
|
|
174
|
-
const tabs = this.getQuickChoiceTabs();
|
|
175
|
-
|
|
176
|
-
return (
|
|
177
|
-
<div>
|
|
178
|
-
{tabs && tabs.length > 1 ? (
|
|
179
|
-
<Tabs
|
|
180
|
-
onSelectTab={this.onSelectOption}
|
|
181
|
-
selectedTab={selectedOption}
|
|
182
|
-
tabs={tabs}
|
|
183
|
-
containerStyle={{ display: 'flex' }}
|
|
184
|
-
tabStyle={{ flex: 1 }}
|
|
185
|
-
/>
|
|
186
|
-
) : null}
|
|
187
|
-
<div className="flex flex-center flex-center-row">{content}</div>
|
|
188
|
-
</div>
|
|
189
|
-
);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
render() {
|
|
193
|
-
return this.renderColourOptions();
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
export { ColourOptions };
|
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import _ from 'lodash';
|
|
3
|
-
import FontAwesome from 'react-fontawesome';
|
|
4
|
-
import { ChromePicker } from 'react-color';
|
|
5
|
-
import tinycolor from 'tinycolor2';
|
|
6
|
-
import { Popup } from './Popup';
|
|
7
|
-
import { Tabs } from './Tabs';
|
|
8
|
-
|
|
9
|
-
class ColourPicker extends Component {
|
|
10
|
-
constructor(props) {
|
|
11
|
-
super(props);
|
|
12
|
-
this.state = {
|
|
13
|
-
selectedColour: props.value,
|
|
14
|
-
colour: props.value,
|
|
15
|
-
selectedOption: props.defaultTab || 'vibrant',
|
|
16
|
-
colourPickerOpen: false,
|
|
17
|
-
colourCircleTop: 0,
|
|
18
|
-
colourCircleLeft: 0,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
componentDidMount() {
|
|
23
|
-
this.setColourCircle();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
componentDidUpdate(prevProps) {
|
|
27
|
-
if (this.props.value !== prevProps.value) {
|
|
28
|
-
const { value } = this.props;
|
|
29
|
-
this.setState({ selectedColour: value, colour: value }, this.setColourCircle);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
setColourCircle = () => {
|
|
34
|
-
const tc = tinycolor(this.state.colour);
|
|
35
|
-
this.setState({
|
|
36
|
-
colourCircleTop: 100 - (100 * tc.getBrightness()) / 255,
|
|
37
|
-
colourCircleLeft: (100 * tc.toHsv().h) / 360,
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
getQuickChoiceTabs() {
|
|
42
|
-
const { options } = this.props;
|
|
43
|
-
const optionsArray = typeof options === 'string' ? options.split(',').map((o) => o.trim()) : options;
|
|
44
|
-
const available = [
|
|
45
|
-
{
|
|
46
|
-
value: 'vibrant',
|
|
47
|
-
text: 'Vibrant',
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
value: 'soft',
|
|
51
|
-
text: 'Soft',
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
value: 'picker',
|
|
55
|
-
text: 'Picker',
|
|
56
|
-
},
|
|
57
|
-
];
|
|
58
|
-
return !optionsArray || optionsArray.length === 0 ? available : available.filter((o) => optionsArray.includes(o.value));
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
onTogglePopup = () => {
|
|
62
|
-
if (this.props.disabled) return;
|
|
63
|
-
this.setState({ colourPickerOpen: !this.state.colourPickerOpen });
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
onColourChange = (color) => {
|
|
67
|
-
// console.log('onColourChange', color);
|
|
68
|
-
let colour = color;
|
|
69
|
-
if (typeof color === 'object') {
|
|
70
|
-
colour = color.hex;
|
|
71
|
-
}
|
|
72
|
-
this.setState({ selectedColour: colour.toUpperCase() });
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
onSelectOption = (selectedOption) => {
|
|
76
|
-
this.setState({ selectedOption });
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
onDone = () => {
|
|
80
|
-
const { colourPickerOpen, selectedColour } = this.state;
|
|
81
|
-
this.setState({ colourPickerOpen: !colourPickerOpen, colour: selectedColour }, () => {
|
|
82
|
-
this.setColourCircle();
|
|
83
|
-
|
|
84
|
-
const { onColourSelected } = this.props;
|
|
85
|
-
if (onColourSelected) onColourSelected(this.state.colour);
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
onCancel = () => {
|
|
90
|
-
const { colourPickerOpen, colour } = this.state;
|
|
91
|
-
this.setState({ colourPickerOpen: !colourPickerOpen, selectedColour: colour });
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
renderColourQuickChoicesCircle(colour, selectedColour) {
|
|
95
|
-
const isSelected = selectedColour.toLowerCase() === colour.toLowerCase();
|
|
96
|
-
return (
|
|
97
|
-
<div
|
|
98
|
-
className={`colourQuickChoices_circle${isSelected ? ' colourQuickChoices_circle-selected' : ''}`}
|
|
99
|
-
style={{ backgroundColor: colour }}
|
|
100
|
-
onClick={() => this.onColourChange(colour)}
|
|
101
|
-
>
|
|
102
|
-
<FontAwesome name="check" className="colourQuickChoices_circle_tick" />
|
|
103
|
-
</div>
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
renderColourOptions() {
|
|
108
|
-
const { selectedColour, selectedOption } = this.state;
|
|
109
|
-
|
|
110
|
-
let content;
|
|
111
|
-
switch (selectedOption) {
|
|
112
|
-
case 'picker':
|
|
113
|
-
content = (
|
|
114
|
-
<div className="flex flex-center-row colourQuickChoices" style={{ marginBottom: 'unset' }}>
|
|
115
|
-
<ChromePicker color={selectedColour} onChangeComplete={this.onColourChange} disableAlpha className="chrome-picker-noShadow" />
|
|
116
|
-
</div>
|
|
117
|
-
);
|
|
118
|
-
break;
|
|
119
|
-
case 'vibrant':
|
|
120
|
-
content = (
|
|
121
|
-
<div className="flex flex-between colourQuickChoices" style={{ marginBottom: 'unset' }}>
|
|
122
|
-
<div className="colourQuickChoices_column">
|
|
123
|
-
{this.renderColourQuickChoicesCircle('#c44569', selectedColour)}
|
|
124
|
-
{this.renderColourQuickChoicesCircle('#f1a459', selectedColour)}
|
|
125
|
-
{this.renderColourQuickChoicesCircle('#38ada9', selectedColour)}
|
|
126
|
-
{this.renderColourQuickChoicesCircle('#7064a7', selectedColour)}
|
|
127
|
-
</div>
|
|
128
|
-
<div className="colourQuickChoices_column">
|
|
129
|
-
{this.renderColourQuickChoicesCircle('#ea4c88', selectedColour)}
|
|
130
|
-
{this.renderColourQuickChoicesCircle('#e8bb67', selectedColour)}
|
|
131
|
-
{this.renderColourQuickChoicesCircle('#60a3bc', selectedColour)}
|
|
132
|
-
{this.renderColourQuickChoicesCircle('#546de5', selectedColour)}
|
|
133
|
-
</div>
|
|
134
|
-
<div className="colourQuickChoices_column">
|
|
135
|
-
{this.renderColourQuickChoicesCircle('#e66767', selectedColour)}
|
|
136
|
-
{this.renderColourQuickChoicesCircle('#94d0c5', selectedColour)}
|
|
137
|
-
{this.renderColourQuickChoicesCircle('#5badda', selectedColour)}
|
|
138
|
-
{this.renderColourQuickChoicesCircle('#dfad8c', selectedColour)}
|
|
139
|
-
</div>
|
|
140
|
-
<div className="colourQuickChoices_column">
|
|
141
|
-
{this.renderColourQuickChoicesCircle('#ff6c5c', selectedColour)}
|
|
142
|
-
{this.renderColourQuickChoicesCircle('#7abf9e', selectedColour)}
|
|
143
|
-
{this.renderColourQuickChoicesCircle('#9fcfd9', selectedColour)}
|
|
144
|
-
{this.renderColourQuickChoicesCircle('#dd91a7', selectedColour)}
|
|
145
|
-
</div>
|
|
146
|
-
<div className="colourQuickChoices_column">
|
|
147
|
-
{this.renderColourQuickChoicesCircle('#f19066', selectedColour)}
|
|
148
|
-
{this.renderColourQuickChoicesCircle('#a1ab94', selectedColour)}
|
|
149
|
-
{this.renderColourQuickChoicesCircle('#a67db7', selectedColour)}
|
|
150
|
-
{this.renderColourQuickChoicesCircle('#596275', selectedColour)}
|
|
151
|
-
</div>
|
|
152
|
-
</div>
|
|
153
|
-
);
|
|
154
|
-
break;
|
|
155
|
-
case 'soft':
|
|
156
|
-
content = (
|
|
157
|
-
<div className="flex flex-between colourQuickChoices" style={{ marginBottom: 'unset' }}>
|
|
158
|
-
<div className="colourQuickChoices_column">
|
|
159
|
-
{this.renderColourQuickChoicesCircle('#eacdd0', selectedColour)}
|
|
160
|
-
{this.renderColourQuickChoicesCircle('#a4c9d7', selectedColour)}
|
|
161
|
-
{this.renderColourQuickChoicesCircle('#c6b9c0', selectedColour)}
|
|
162
|
-
{this.renderColourQuickChoicesCircle('#cdc4af', selectedColour)}
|
|
163
|
-
</div>
|
|
164
|
-
<div className="colourQuickChoices_column">
|
|
165
|
-
{this.renderColourQuickChoicesCircle('#d6b7b1', selectedColour)}
|
|
166
|
-
{this.renderColourQuickChoicesCircle('#eaf2f4', selectedColour)}
|
|
167
|
-
{this.renderColourQuickChoicesCircle('#cce0db', selectedColour)}
|
|
168
|
-
{this.renderColourQuickChoicesCircle('#b9bee4', selectedColour)}
|
|
169
|
-
</div>
|
|
170
|
-
<div className="colourQuickChoices_column">
|
|
171
|
-
{this.renderColourQuickChoicesCircle('#9bd3cb', selectedColour)}
|
|
172
|
-
{this.renderColourQuickChoicesCircle('#f1d7bb', selectedColour)}
|
|
173
|
-
{this.renderColourQuickChoicesCircle('#fcbc7b', selectedColour)}
|
|
174
|
-
{this.renderColourQuickChoicesCircle('#caeff5', selectedColour)}
|
|
175
|
-
</div>
|
|
176
|
-
<div className="colourQuickChoices_column">
|
|
177
|
-
{this.renderColourQuickChoicesCircle('#e0dceb', selectedColour)}
|
|
178
|
-
{this.renderColourQuickChoicesCircle('#b1becd', selectedColour)}
|
|
179
|
-
{this.renderColourQuickChoicesCircle('#e6cfc5', selectedColour)}
|
|
180
|
-
{this.renderColourQuickChoicesCircle('#cfd6df', selectedColour)}
|
|
181
|
-
</div>
|
|
182
|
-
<div className="colourQuickChoices_column">
|
|
183
|
-
{this.renderColourQuickChoicesCircle('#f39ca4', selectedColour)}
|
|
184
|
-
{this.renderColourQuickChoicesCircle('#c0adc5', selectedColour)}
|
|
185
|
-
{this.renderColourQuickChoicesCircle('#fcbca4', selectedColour)}
|
|
186
|
-
{this.renderColourQuickChoicesCircle('#c5ceb9', selectedColour)}
|
|
187
|
-
</div>
|
|
188
|
-
</div>
|
|
189
|
-
);
|
|
190
|
-
break;
|
|
191
|
-
default:
|
|
192
|
-
content = null;
|
|
193
|
-
break;
|
|
194
|
-
}
|
|
195
|
-
const tabs = this.getQuickChoiceTabs();
|
|
196
|
-
|
|
197
|
-
return (
|
|
198
|
-
<div>
|
|
199
|
-
{tabs && tabs.length > 1 ? <Tabs onSelectTab={this.onSelectOption} selectedTab={selectedOption} tabs={tabs} /> : null}
|
|
200
|
-
<div className="flex flex-center flex-center-row">{content}</div>
|
|
201
|
-
</div>
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
renderColourPopup() {
|
|
206
|
-
const { colourPickerOpen } = this.state;
|
|
207
|
-
if (!colourPickerOpen) return null;
|
|
208
|
-
const { title } = this.props;
|
|
209
|
-
|
|
210
|
-
return (
|
|
211
|
-
<Popup
|
|
212
|
-
title={title || `Colour Picker`}
|
|
213
|
-
maxWidth={500}
|
|
214
|
-
hasPadding
|
|
215
|
-
buttons={[
|
|
216
|
-
{
|
|
217
|
-
type: 'primary',
|
|
218
|
-
onClick: this.onDone,
|
|
219
|
-
style: { width: 100 },
|
|
220
|
-
isActive: true,
|
|
221
|
-
text: 'Done',
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
type: 'outlinedAction',
|
|
225
|
-
onClick: this.onCancel,
|
|
226
|
-
style: { width: 100 },
|
|
227
|
-
isActive: true,
|
|
228
|
-
text: 'Cancel',
|
|
229
|
-
},
|
|
230
|
-
]}
|
|
231
|
-
>
|
|
232
|
-
{this.renderColourOptions()}
|
|
233
|
-
</Popup>
|
|
234
|
-
);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
render() {
|
|
238
|
-
const { colourCircleTop, colourCircleLeft, colour } = this.state;
|
|
239
|
-
const { children, showHex } = this.props;
|
|
240
|
-
|
|
241
|
-
return (
|
|
242
|
-
<div>
|
|
243
|
-
<div className="flex flex-center">
|
|
244
|
-
{children ? (
|
|
245
|
-
<div onClick={this.onTogglePopup}>{children}</div>
|
|
246
|
-
) : (
|
|
247
|
-
<div className="colourPicker_button" style={{ width: 80, marginBottom: 'unset' }} onClick={this.onTogglePopup}>
|
|
248
|
-
<div className="colourPicker_rainbow">
|
|
249
|
-
<div
|
|
250
|
-
className="colourPicker_rainbow_circle"
|
|
251
|
-
style={{
|
|
252
|
-
top: `${colourCircleTop}%`,
|
|
253
|
-
left: `${colourCircleLeft}%`,
|
|
254
|
-
}}
|
|
255
|
-
></div>
|
|
256
|
-
</div>
|
|
257
|
-
</div>
|
|
258
|
-
)}
|
|
259
|
-
{showHex ? <div className="marginLeft-10">{colour && colour.toUpperCase()}</div> : null}
|
|
260
|
-
</div>
|
|
261
|
-
{this.renderColourPopup()}
|
|
262
|
-
</div>
|
|
263
|
-
);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
export { ColourPicker };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import moment from 'moment';
|
|
3
|
-
import { get1400, toParagraphed } from '../helper';
|
|
4
|
-
import { ProfilePic } from './ProfilePic';
|
|
5
|
-
import _ from 'lodash';
|
|
6
|
-
|
|
7
|
-
class Comment extends Component {
|
|
8
|
-
renderImage(image) {
|
|
9
|
-
if (_.isEmpty(image)) {
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
return (
|
|
13
|
-
<div className="imageGrid">
|
|
14
|
-
<a href={image} target="_blank" rel="noopener noreferrer">
|
|
15
|
-
<div className="imageGrid_image" style={{ backgroundImage: `url('${get1400(image)}')` }}></div>
|
|
16
|
-
</a>
|
|
17
|
-
</div>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
renderComment() {
|
|
22
|
-
const { comment } = this.props;
|
|
23
|
-
return (
|
|
24
|
-
<div key={comment.Id} className="comment">
|
|
25
|
-
<p className="comment_text">{toParagraphed(comment.Comment)}</p>
|
|
26
|
-
{this.renderImage(comment.Image)}
|
|
27
|
-
<div className="comment_bottom">
|
|
28
|
-
<ProfilePic className="comment_profilePic" size={25} image={comment.User.profilePic} />
|
|
29
|
-
<p className="comment_name">{comment.User.displayName}</p>
|
|
30
|
-
<p className="comment_time">{moment.utc(comment.Timestamp).local().format('D MMM YYYY • h:mma')}</p>
|
|
31
|
-
</div>
|
|
32
|
-
</div>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
render() {
|
|
37
|
-
return (
|
|
38
|
-
<div>
|
|
39
|
-
{this.renderComment()}
|
|
40
|
-
{this.props.bottomContent}
|
|
41
|
-
</div>
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export { Comment };
|