@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,62 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import FontAwesome from 'react-fontawesome';
|
|
3
|
+
|
|
4
|
+
class Tag extends Component {
|
|
5
|
+
renderLeft() {
|
|
6
|
+
if (!this.props.leftIcon) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
return (
|
|
10
|
+
<FontAwesome
|
|
11
|
+
name={this.props.leftIcon}
|
|
12
|
+
className={`tag_icon tag_icon-left ${this.props.leftClick ? 'tag_icon-clickable' : ''}`}
|
|
13
|
+
style={this.props.leftIconStyle}
|
|
14
|
+
onClick={this.props.leftClick}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
renderRight() {
|
|
20
|
+
if (!this.props.rightIcon) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return (
|
|
24
|
+
<FontAwesome
|
|
25
|
+
name={this.props.rightIcon}
|
|
26
|
+
className={`tag_icon tag_icon-right ${this.props.rightClick ? 'tag_icon-clickable' : ''}`}
|
|
27
|
+
style={this.props.rightIconStyle}
|
|
28
|
+
onClick={this.props.rightClick}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
renderText() {
|
|
34
|
+
if (!this.props.text) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return <span className="tag_text">{this.props.text}</span>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
render() {
|
|
41
|
+
return (
|
|
42
|
+
<div
|
|
43
|
+
onClick={this.props.onClick}
|
|
44
|
+
className={`tag ${this.props.onClick ? 'tag-clickable' : ''} ${this.props.className || ''} ${
|
|
45
|
+
this.props.leftIcon || this.props.rightIcon ? 'tag-hasIcon' : ''
|
|
46
|
+
}`}
|
|
47
|
+
style={this.props.style}
|
|
48
|
+
>
|
|
49
|
+
<div className="tag_inner">
|
|
50
|
+
{this.renderLeft()}
|
|
51
|
+
<div className={`tag_center ${this.props.centerClass}`}>
|
|
52
|
+
{this.renderText()}
|
|
53
|
+
{this.props.children}
|
|
54
|
+
</div>
|
|
55
|
+
{this.renderRight()}
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { Tag };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
|
|
3
|
+
class Text extends Component {
|
|
4
|
+
getClassName() {
|
|
5
|
+
if (this.props.className) {
|
|
6
|
+
return ` ${this.props.className}`;
|
|
7
|
+
}
|
|
8
|
+
return '';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
render() {
|
|
12
|
+
return (
|
|
13
|
+
<p {...this.props} className={`text-${this.props.type}${this.getClassName()}`} style={this.props.style}>
|
|
14
|
+
{this.props.children}
|
|
15
|
+
</p>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { Text };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { Button } from './Button';
|
|
3
|
+
import { COLOUR_BRANDING_MAIN } from '../colours';
|
|
4
|
+
|
|
5
|
+
class TextFormatPopup extends Component {
|
|
6
|
+
render() {
|
|
7
|
+
if (!this.props.isOpen) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
return (
|
|
11
|
+
<div className="successPopupBackground pointer">
|
|
12
|
+
<div className="successPopup">
|
|
13
|
+
<p className={`successPopup_text successPopup_text-small`}>
|
|
14
|
+
<br />
|
|
15
|
+
<span style={{ fontWeight: 600 }}>Text formatting:</span>
|
|
16
|
+
<br />
|
|
17
|
+
<br />
|
|
18
|
+
Surround text with <span style={{ fontWeight: 400 }}>**</span> to create bold text:
|
|
19
|
+
<br />
|
|
20
|
+
<span style={{ fontWeight: 400 }}>**</span>Some Text<span style={{ fontWeight: 400 }}>**</span> ={' '}
|
|
21
|
+
<span style={{ fontWeight: 600 }}>Some Text</span>
|
|
22
|
+
<br />
|
|
23
|
+
<br />
|
|
24
|
+
Surround text with <span style={{ fontWeight: 400 }}>*t*</span> to create a title:
|
|
25
|
+
<br />
|
|
26
|
+
<span style={{ fontWeight: 400 }}>*t*</span>Some Text<span style={{ fontWeight: 400 }}>*t*</span> ={' '}
|
|
27
|
+
<span style={{ fontWeight: 600, color: COLOUR_BRANDING_MAIN, fontSize: 20 }}>Some Text</span>
|
|
28
|
+
<br />
|
|
29
|
+
<br />
|
|
30
|
+
Surround text with <span style={{ fontWeight: 400 }}>*s*</span> to create a smaller title:
|
|
31
|
+
<br />
|
|
32
|
+
<span style={{ fontWeight: 400 }}>*s*</span>Some Text<span style={{ fontWeight: 400 }}>*s*</span> ={' '}
|
|
33
|
+
<span style={{ fontWeight: 600, fontSize: 16 }}>Some Text</span>
|
|
34
|
+
<br />
|
|
35
|
+
<br />
|
|
36
|
+
Create links with <span style={{ fontWeight: 400 }}>[website|text]</span>:
|
|
37
|
+
<br />
|
|
38
|
+
<span style={{ fontWeight: 400 }}>[https://example.com|Click here]</span> ={' '}
|
|
39
|
+
<a href="https://example.com" target="_blank" rel="noopener noreferrer" style={{ fontWeight: 600, fontSize: 16 }}>
|
|
40
|
+
Click here
|
|
41
|
+
</a>
|
|
42
|
+
</p>
|
|
43
|
+
<div className="successPopup_buttons">
|
|
44
|
+
<Button buttonClassName="successPopup_button" buttonType="primary" isActive onClick={this.props.onClose}>
|
|
45
|
+
Close
|
|
46
|
+
</Button>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { TextFormatPopup };
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import React, { Component } from "react";
|
|
2
|
+
import moment from "moment";
|
|
3
|
+
import _ from "lodash";
|
|
4
|
+
import { randomString } from "../helper";
|
|
5
|
+
import { SVGIcon } from "./SVGIcon";
|
|
6
|
+
import { COLOUR_DUSK_LIGHT } from "../colours";
|
|
7
|
+
|
|
8
|
+
class TimePicker extends Component {
|
|
9
|
+
state = {
|
|
10
|
+
id: randomString(),
|
|
11
|
+
selectedTime: this.props.optional ? this.props.selectedTime : moment(),
|
|
12
|
+
grid: [],
|
|
13
|
+
hourInput: "",
|
|
14
|
+
minuteInput: "",
|
|
15
|
+
mInput: "",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
UNSAFE_componentWillMount() {
|
|
19
|
+
this.onNewProps(this.props, !this.props.optional);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
23
|
+
this.onNewProps(nextProps);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
onNewProps(nextProps, forceUpdate) {
|
|
27
|
+
if (forceUpdate || nextProps.selectedTime !== this.props.selectedTime) {
|
|
28
|
+
let mDate = moment(nextProps.selectedTime, "h:mma");
|
|
29
|
+
if (!mDate.isValid()) {
|
|
30
|
+
this.setState({
|
|
31
|
+
selectedTime: null,
|
|
32
|
+
hourInput: "",
|
|
33
|
+
minuteInput: "",
|
|
34
|
+
mInput: "",
|
|
35
|
+
});
|
|
36
|
+
} else {
|
|
37
|
+
const minutesFocused =
|
|
38
|
+
document.getElementById(`time_minute_${this.state.id}`) ===
|
|
39
|
+
document.activeElement;
|
|
40
|
+
this.setState({
|
|
41
|
+
selectedTime: mDate,
|
|
42
|
+
hourInput: mDate.format("h"),
|
|
43
|
+
minuteInput: mDate.format(minutesFocused ? "m" : "mm"),
|
|
44
|
+
mInput: mDate.format("a"),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
getDefaultTime() {
|
|
51
|
+
const result = moment();
|
|
52
|
+
result.hour(12);
|
|
53
|
+
result.minute(0);
|
|
54
|
+
result.second(0);
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
onChangeHour(event) {
|
|
59
|
+
let hour = 0;
|
|
60
|
+
if (!_.isEmpty(event.target.value)) {
|
|
61
|
+
hour = parseInt(event.target.value, 10);
|
|
62
|
+
} else {
|
|
63
|
+
this.setState({ ...this.state, hourInput: "" });
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (isNaN(hour)) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
hour = Math.max(Math.min(12, hour), 0);
|
|
70
|
+
const dateToUse = this.state.selectedTime || this.getDefaultTime();
|
|
71
|
+
const selectNext = hour > 1; // if hour is > 1, assume user is done typing and select minutes input
|
|
72
|
+
if (dateToUse.format("a") === "pm") {
|
|
73
|
+
hour += 12;
|
|
74
|
+
}
|
|
75
|
+
dateToUse.hour(hour);
|
|
76
|
+
this.setState({
|
|
77
|
+
selectedTime: moment(dateToUse),
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
this.selectTime(dateToUse);
|
|
81
|
+
|
|
82
|
+
if (selectNext) {
|
|
83
|
+
this.select(`time_minute_${this.state.id}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
onChangeMinute(event) {
|
|
88
|
+
let minute = 0;
|
|
89
|
+
if (!_.isEmpty(event.target.value)) {
|
|
90
|
+
minute = parseInt(event.target.value, 10);
|
|
91
|
+
} else {
|
|
92
|
+
this.setState({ ...this.state, minuteInput: "" });
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (isNaN(minute)) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
minute = Math.max(Math.min(59, minute), 0);
|
|
99
|
+
const dateToUse = this.state.selectedTime || this.getDefaultTime();
|
|
100
|
+
dateToUse.minute(minute);
|
|
101
|
+
this.setState({
|
|
102
|
+
selectedTime: moment(dateToUse),
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
this.selectTime(dateToUse);
|
|
106
|
+
|
|
107
|
+
if (minute >= 10 || event.target.value === "00") {
|
|
108
|
+
this.select(`time_am_${this.state.id}`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
onBlurMinute() {
|
|
113
|
+
if (this.state.selectedTime) {
|
|
114
|
+
this.setState({
|
|
115
|
+
minuteInput: this.state.selectedTime.format("mm"),
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
onChangeM(event) {
|
|
121
|
+
const dateToUse = this.state.selectedTime || this.getDefaultTime();
|
|
122
|
+
if (event.target.value.toLowerCase().indexOf("a") > -1) {
|
|
123
|
+
// am
|
|
124
|
+
if (dateToUse.format("a") === "pm") {
|
|
125
|
+
dateToUse.hour(dateToUse.hour() - 12);
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
// pm
|
|
129
|
+
if (dateToUse.format("a") === "am") {
|
|
130
|
+
dateToUse.hour(dateToUse.hour() + 12);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
this.setState({
|
|
134
|
+
selectedTime: moment(dateToUse),
|
|
135
|
+
});
|
|
136
|
+
this.selectTime(dateToUse);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
selectTime(date) {
|
|
140
|
+
this.props.selectTime(
|
|
141
|
+
moment(date).format(this.props.callbackFormat || "h:mma"),
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
onClear = () => {
|
|
146
|
+
this.props.selectTime(undefined);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
select(id) {
|
|
150
|
+
document.getElementById(id).select();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
renderClear() {
|
|
154
|
+
if (!this.props.hasClear) return null;
|
|
155
|
+
return (
|
|
156
|
+
<SVGIcon
|
|
157
|
+
colour={COLOUR_DUSK_LIGHT}
|
|
158
|
+
icon="close"
|
|
159
|
+
className="timepicker_clear"
|
|
160
|
+
onClick={this.onClear}
|
|
161
|
+
/>
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
render() {
|
|
166
|
+
const { disabled } = this.props;
|
|
167
|
+
if (disabled) {
|
|
168
|
+
return (
|
|
169
|
+
<div className="timepicker disabled" style={this.props.style}>
|
|
170
|
+
<span
|
|
171
|
+
className="timepicker__span"
|
|
172
|
+
style={this.props.inputStyle}
|
|
173
|
+
>{`${this.state.hourInput} : ${this.state.minuteInput} ${this.state.mInput}`}</span>
|
|
174
|
+
</div>
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
return (
|
|
178
|
+
<div
|
|
179
|
+
className={`timepicker ${this.props.className}`}
|
|
180
|
+
style={this.props.style}
|
|
181
|
+
>
|
|
182
|
+
<input
|
|
183
|
+
className="timepicker__input"
|
|
184
|
+
maxLength="2"
|
|
185
|
+
placeholder="hh"
|
|
186
|
+
type="text"
|
|
187
|
+
id={`time_hour_${this.state.id}`}
|
|
188
|
+
value={this.state.hourInput}
|
|
189
|
+
onChange={this.onChangeHour.bind(this)}
|
|
190
|
+
onClick={this.select.bind(this, `time_hour_${this.state.id}`)}
|
|
191
|
+
style={this.props.inputStyle}
|
|
192
|
+
/>
|
|
193
|
+
<span className="timepicker__separator" style={this.props.inputStyle}>
|
|
194
|
+
:
|
|
195
|
+
</span>
|
|
196
|
+
<input
|
|
197
|
+
className="timepicker__input"
|
|
198
|
+
maxLength="2"
|
|
199
|
+
placeholder="mm"
|
|
200
|
+
type="text"
|
|
201
|
+
id={`time_minute_${this.state.id}`}
|
|
202
|
+
value={this.state.minuteInput}
|
|
203
|
+
onChange={this.onChangeMinute.bind(this)}
|
|
204
|
+
onBlur={this.onBlurMinute.bind(this)}
|
|
205
|
+
onClick={this.select.bind(this, `time_minute_${this.state.id}`)}
|
|
206
|
+
style={this.props.inputStyle}
|
|
207
|
+
/>
|
|
208
|
+
<input
|
|
209
|
+
className="timepicker__input"
|
|
210
|
+
maxLength="2"
|
|
211
|
+
placeholder="pm"
|
|
212
|
+
type="text"
|
|
213
|
+
id={`time_am_${this.state.id}`}
|
|
214
|
+
value={this.state.mInput}
|
|
215
|
+
onChange={this.onChangeM.bind(this)}
|
|
216
|
+
onClick={this.select.bind(this, `time_am_${this.state.id}`)}
|
|
217
|
+
style={this.props.inputStyle}
|
|
218
|
+
/>
|
|
219
|
+
{this.renderClear()}
|
|
220
|
+
</div>
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export { TimePicker };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { Text } from './Text';
|
|
3
|
+
import { ProfilePic } from './ProfilePic';
|
|
4
|
+
import { COLOUR_BRANDING_MAIN } from '../colours';
|
|
5
|
+
|
|
6
|
+
class UserListing extends Component {
|
|
7
|
+
getSize() {
|
|
8
|
+
return this.props.size || 30;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
getImage() {
|
|
12
|
+
if (this.props.user && this.props.user.profilePic) {
|
|
13
|
+
return this.props.user.profilePic;
|
|
14
|
+
}
|
|
15
|
+
if (this.props.image) {
|
|
16
|
+
return this.props.image;
|
|
17
|
+
}
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
getKey() {
|
|
22
|
+
if (this.props.user && this.props.user.id) {
|
|
23
|
+
return this.props.user.id;
|
|
24
|
+
}
|
|
25
|
+
return this.props.id;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
getText() {
|
|
29
|
+
if (this.props.user && this.props.user.displayName) {
|
|
30
|
+
return this.props.user.displayName;
|
|
31
|
+
}
|
|
32
|
+
return this.props.title;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
getBorderRadius() {
|
|
36
|
+
if (this.props.squareImage) {
|
|
37
|
+
return 4;
|
|
38
|
+
}
|
|
39
|
+
return this.getSize() / 2;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
isLoading() {
|
|
43
|
+
if (this.props.user && this.props.user.loading) {
|
|
44
|
+
return this.props.user && this.props.user.loading;
|
|
45
|
+
}
|
|
46
|
+
return this.props.isLoading;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
renderRight() {
|
|
50
|
+
if (!this.props.rightContent) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
return this.props.rightContent;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
renderSub() {
|
|
57
|
+
if (!this.props.subContent) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
return this.props.subContent;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
renderImage() {
|
|
64
|
+
if (this.props.squareImage) {
|
|
65
|
+
return (
|
|
66
|
+
<div
|
|
67
|
+
style={{
|
|
68
|
+
height: this.getSize(),
|
|
69
|
+
width: this.getSize(),
|
|
70
|
+
borderRadius: this.getBorderRadius(),
|
|
71
|
+
marginRight: 8,
|
|
72
|
+
backgroundSize: 'cover',
|
|
73
|
+
backgroundPosition: 'center',
|
|
74
|
+
backgroundImage: `url(${this.getImage()})`,
|
|
75
|
+
backgroundColor: COLOUR_BRANDING_MAIN,
|
|
76
|
+
}}
|
|
77
|
+
alt={`${this.getText()} Image`}
|
|
78
|
+
/>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
return <ProfilePic size={this.getSize()} className="userListing_profilePic" image={this.getImage()} />;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
render() {
|
|
85
|
+
return (
|
|
86
|
+
<div
|
|
87
|
+
key={this.getKey()}
|
|
88
|
+
className="userListing"
|
|
89
|
+
style={{
|
|
90
|
+
minHeight: this.getSize() + 5,
|
|
91
|
+
cursor: this.props.onClick ? 'pointer' : 'inherit',
|
|
92
|
+
opacity: this.isLoading() ? 0.5 : 1,
|
|
93
|
+
}}
|
|
94
|
+
onClick={this.props.onClick}
|
|
95
|
+
>
|
|
96
|
+
<div className="userListing_inner">
|
|
97
|
+
{this.renderImage()}
|
|
98
|
+
<div className="userListing_middle" style={{ height: this.getSize() }}>
|
|
99
|
+
<Text type="name" style={this.props.whiteText ? { color: '#fff' } : null} className={this.props.textClass}>
|
|
100
|
+
{this.getText()}
|
|
101
|
+
</Text>
|
|
102
|
+
{this.renderSub()}
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
{this.renderRight()}
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export { UserListing };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export * from './AddButton';
|
|
2
|
+
export * from './Attachment';
|
|
3
|
+
export * from './Button';
|
|
4
|
+
export * from './CheckBox';
|
|
5
|
+
export * from './Comment';
|
|
6
|
+
export * from './CommentSection';
|
|
7
|
+
export * from './DatePicker';
|
|
8
|
+
export * from './DurationInput';
|
|
9
|
+
export * from './FileInput';
|
|
10
|
+
export * from './GenericInput';
|
|
11
|
+
export * from './Header';
|
|
12
|
+
export * from './HubSidebar';
|
|
13
|
+
export * from './ImageInput';
|
|
14
|
+
export * from './MoreMenu';
|
|
15
|
+
export * from './OverlayPage';
|
|
16
|
+
export * from './OverlayPageContents';
|
|
17
|
+
export * from './OverlayPageSection';
|
|
18
|
+
export * from './OverlayPageBottomButtons';
|
|
19
|
+
export * from './PageTitle';
|
|
20
|
+
export * from './Popup';
|
|
21
|
+
export * from './P60Icon';
|
|
22
|
+
export * from './ProfilePic';
|
|
23
|
+
export * from './RadioButton';
|
|
24
|
+
export * from './SVGIcon';
|
|
25
|
+
export * from './Tag';
|
|
26
|
+
export * from './Text';
|
|
27
|
+
export * from './SideNavItem';
|
|
28
|
+
export * from './StatusButton';
|
|
29
|
+
export * from './SuccessPopup';
|
|
30
|
+
export * from './Reactions';
|
|
31
|
+
export * from './P60Icon';
|
|
32
|
+
export * from './DatePicker';
|
|
33
|
+
export * from './AnalyticsFilter';
|
|
34
|
+
export * from './UserListing';
|
|
35
|
+
export * from './TimePicker';
|
|
36
|
+
export * from './AudienceSelector';
|
|
37
|
+
export * from './TextFormatPopup';
|
|
38
|
+
export * from './OptionsSection';
|
|
39
|
+
export * from './DropdownInput';
|
|
40
|
+
export * from './MakerPopup';
|
|
41
|
+
export * from './ExportCsvPopup';
|
|
42
|
+
export * from './InputGroup';
|
|
43
|
+
export * from './ColourOptions';
|
|
44
|
+
export * from './ColourPicker';
|
|
45
|
+
export * from './StatBox';
|
|
46
|
+
export * from './Tabs';
|