@agilemotion/oui-react-js 1.7.6 → 1.7.7
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/RestService.js +1 -1
- package/dist/RestUtils.js +1 -1
- package/dist/Utils.js +17 -0
- package/dist/components/DocumentTemplateDesignerComponent.js +1 -0
- package/dist/components/form/TextField.js +4 -1
- package/dist/components/media/chat/ChatPoll.js +331 -0
- package/dist/components/media/chat/ChatRoom.js +55 -2
- package/dist/components/media/chat/ChatRooms.scss +1 -0
- package/dist/components/media/chat/NewPoll.css +82 -0
- package/dist/components/media/chat/PollContainer.js +220 -0
- package/dist/components/media/chat/PollResult.js +30 -0
- package/package.json +1 -1
package/dist/RestService.js
CHANGED
|
@@ -68,7 +68,7 @@ class RestService {
|
|
|
68
68
|
}
|
|
69
69
|
if (httpParameterType === 'PATH_VARIABLE') {
|
|
70
70
|
if (!_Utils.default.isNull(parameterValue)) {
|
|
71
|
-
pathParameters += '/' + (typeof parameterValue.value === 'object' ? JSON.stringify(parameterValue.value) : parameterValue.instanceType === 'TypedValue' ? parameterValue.value : parameterValue);
|
|
71
|
+
pathParameters += '/' + (typeof parameterValue.value === 'object' ? encodeURIComponent(JSON.stringify(parameterValue.value)) : parameterValue.instanceType === 'TypedValue' ? encodeURIComponent(parameterValue.value) : encodeURIComponent(parameterValue));
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
if (httpParameterType === 'HEADER') {
|
package/dist/RestUtils.js
CHANGED
|
@@ -69,7 +69,7 @@ class RestUtils {
|
|
|
69
69
|
}
|
|
70
70
|
if (httpParameterType === 'PATH_VARIABLE') {
|
|
71
71
|
if (!_Utils.default.isNull(parameterValue)) {
|
|
72
|
-
pathParameters += '/' + (typeof parameterValue.value === 'object' ? JSON.stringify(parameterValue.value) : parameterValue.instanceType === 'TypedValue' ? parameterValue.value : parameterValue);
|
|
72
|
+
pathParameters += '/' + (typeof parameterValue.value === 'object' ? encodeURIComponent(JSON.stringify(parameterValue.value)) : parameterValue.instanceType === 'TypedValue' ? encodeURIComponent(parameterValue.value) : encodeURIComponent(parameterValue));
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
if (httpParameterType === 'HEADER') {
|
package/dist/Utils.js
CHANGED
|
@@ -10,6 +10,7 @@ var _ApplicationManager = _interopRequireDefault(require("./ApplicationManager")
|
|
|
10
10
|
var _Observable = _interopRequireDefault(require("./event/Observable"));
|
|
11
11
|
var _EventType = _interopRequireDefault(require("./event/EventType"));
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
const colors = ['#F44336', '#e91e63', '#9c27b0', '#673ab7', '#ff9800', '#ff5722', '#795548', '#607d8b', '#3f51b5', '#2196F3', '#00bcd4', '#009688', '#2196F3', '#32c787', '#00BCD4', '#ff5652', '#ffc107', '#ff85af', '#FF9800', '#39bbb0', '#4CAF50', '#ffeb3b', '#ffc107'];
|
|
13
14
|
class Utils {
|
|
14
15
|
constructor() {}
|
|
15
16
|
static SYSTEM_ERROR_MESSAGE = "A system error has accured. Please contact your system administrator";
|
|
@@ -354,5 +355,21 @@ class Utils {
|
|
|
354
355
|
}
|
|
355
356
|
return bytes.buffer;
|
|
356
357
|
};
|
|
358
|
+
static getAvatarColor(name) {
|
|
359
|
+
name = name.substr(0, 6);
|
|
360
|
+
let hash = 0;
|
|
361
|
+
for (let i = 0; i < name.length; i++) {
|
|
362
|
+
hash = 31 * hash + name.charCodeAt(i);
|
|
363
|
+
}
|
|
364
|
+
let index = Math.abs(hash % colors.length);
|
|
365
|
+
return colors[index];
|
|
366
|
+
}
|
|
367
|
+
static formatDateTime(dateTimeString) {
|
|
368
|
+
const date = new Date(dateTimeString);
|
|
369
|
+
const monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
370
|
+
const monthIndex = date.getMonth();
|
|
371
|
+
const year = date.getFullYear();
|
|
372
|
+
return date.getDate() + ' ' + monthNames[monthIndex] + ' ' + year + ' - ' + date.getHours() + ':' + date.getMinutes();
|
|
373
|
+
}
|
|
357
374
|
}
|
|
358
375
|
exports.default = Utils;
|
|
@@ -396,6 +396,7 @@ const DocumentTemplateDesignerComponent = props => {
|
|
|
396
396
|
toolbarItems: items,
|
|
397
397
|
toolbarClick: onToolbarClick,
|
|
398
398
|
contentChange: onContentChange,
|
|
399
|
+
enableTrackChanges: false,
|
|
399
400
|
serviceUrl: "https://services.syncfusion.com/react/production/api/documenteditor/",
|
|
400
401
|
enableToolbar: true
|
|
401
402
|
})));
|
|
@@ -69,7 +69,10 @@ const TextFieldWrapper = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.d
|
|
|
69
69
|
}));
|
|
70
70
|
const TextField = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
71
71
|
return /*#__PURE__*/_react.default.createElement(_BaseField.BaseField, _extends({}, props, {
|
|
72
|
-
handle: props.handle
|
|
72
|
+
handle: props.handle,
|
|
73
|
+
valueParser: (value, inbound) => {
|
|
74
|
+
return value ? value.toString().trim() : value;
|
|
75
|
+
}
|
|
73
76
|
}), base => /*#__PURE__*/_react.default.createElement(TextFieldWrapper, _extends({
|
|
74
77
|
ref: ref,
|
|
75
78
|
base: base
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactstrap = require("reactstrap");
|
|
9
|
+
var _TextField = _interopRequireDefault(require("@material-ui/core/TextField"));
|
|
10
|
+
var _Utils = _interopRequireDefault(require("../../../Utils"));
|
|
11
|
+
var _core = require("@material-ui/core");
|
|
12
|
+
var _Delete = _interopRequireDefault(require("@material-ui/icons/Delete"));
|
|
13
|
+
var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
|
|
14
|
+
require("./NewPoll.css");
|
|
15
|
+
var _icons = require("@material-ui/icons");
|
|
16
|
+
var _MenuItem = _interopRequireDefault(require("@material-ui/core/MenuItem"));
|
|
17
|
+
var _FormControl = _interopRequireDefault(require("@material-ui/core/FormControl"));
|
|
18
|
+
var _Select = _interopRequireDefault(require("@material-ui/core/Select"));
|
|
19
|
+
var _InputLabel = _interopRequireDefault(require("@material-ui/core/InputLabel"));
|
|
20
|
+
var _RestUtils = require("../../../RestUtils");
|
|
21
|
+
var _ApplicationManager = _interopRequireDefault(require("../../../ApplicationManager"));
|
|
22
|
+
var _ChatRoom = require("./ChatRoom");
|
|
23
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
25
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
26
|
+
// import TextField from '../../form/TextField';
|
|
27
|
+
|
|
28
|
+
const pollLengthDaysOptions = [{
|
|
29
|
+
id: 0,
|
|
30
|
+
label: "0"
|
|
31
|
+
}, {
|
|
32
|
+
id: 1,
|
|
33
|
+
label: "1"
|
|
34
|
+
}, {
|
|
35
|
+
id: 2,
|
|
36
|
+
label: "2"
|
|
37
|
+
}, {
|
|
38
|
+
id: 3,
|
|
39
|
+
label: "3"
|
|
40
|
+
}, {
|
|
41
|
+
id: 4,
|
|
42
|
+
label: "4"
|
|
43
|
+
}, {
|
|
44
|
+
id: 5,
|
|
45
|
+
label: "5"
|
|
46
|
+
}, {
|
|
47
|
+
id: 6,
|
|
48
|
+
label: "6"
|
|
49
|
+
}, {
|
|
50
|
+
id: 7,
|
|
51
|
+
label: "7"
|
|
52
|
+
}, {
|
|
53
|
+
id: 8,
|
|
54
|
+
label: "8"
|
|
55
|
+
}, {
|
|
56
|
+
id: 9,
|
|
57
|
+
label: "9"
|
|
58
|
+
}];
|
|
59
|
+
const pollLengthHoursOptions = [{
|
|
60
|
+
id: 1,
|
|
61
|
+
label: "1"
|
|
62
|
+
}, {
|
|
63
|
+
id: 2,
|
|
64
|
+
label: "2"
|
|
65
|
+
}, {
|
|
66
|
+
id: 3,
|
|
67
|
+
label: "3"
|
|
68
|
+
}, {
|
|
69
|
+
id: 4,
|
|
70
|
+
label: "4"
|
|
71
|
+
}, {
|
|
72
|
+
id: 5,
|
|
73
|
+
label: "5"
|
|
74
|
+
}, {
|
|
75
|
+
id: 3,
|
|
76
|
+
label: "6"
|
|
77
|
+
}, {
|
|
78
|
+
id: 7,
|
|
79
|
+
label: "7"
|
|
80
|
+
}, {
|
|
81
|
+
id: 8,
|
|
82
|
+
label: "8"
|
|
83
|
+
}, {
|
|
84
|
+
id: 9,
|
|
85
|
+
label: "9"
|
|
86
|
+
}, {
|
|
87
|
+
id: 10,
|
|
88
|
+
label: "10"
|
|
89
|
+
}, {
|
|
90
|
+
id: 11,
|
|
91
|
+
label: "11"
|
|
92
|
+
}, {
|
|
93
|
+
id: 12,
|
|
94
|
+
label: "12"
|
|
95
|
+
}];
|
|
96
|
+
const ChatPoll = props => {
|
|
97
|
+
const [errors, setErrors] = (0, _react.useState)({});
|
|
98
|
+
const [pollQuestion, setPollQuestion] = (0, _react.useState)('');
|
|
99
|
+
const [pollLengthDays, setPollLengthDays] = (0, _react.useState)('0');
|
|
100
|
+
const [pollLengthHours, setPollLengthHours] = (0, _react.useState)('1');
|
|
101
|
+
const [options, setOptions] = (0, _react.useState)([{
|
|
102
|
+
id: 'option-1',
|
|
103
|
+
label: 'Option 1',
|
|
104
|
+
value: ''
|
|
105
|
+
}, {
|
|
106
|
+
id: 'option-2',
|
|
107
|
+
label: 'Option 2',
|
|
108
|
+
value: ''
|
|
109
|
+
}]);
|
|
110
|
+
const getParticipantNames = () => {
|
|
111
|
+
let listOfParticipants = '';
|
|
112
|
+
for (const argument of props.participants) {
|
|
113
|
+
listOfParticipants += argument.name + ', ';
|
|
114
|
+
}
|
|
115
|
+
return listOfParticipants;
|
|
116
|
+
};
|
|
117
|
+
const formValueChangeHandler = e => {
|
|
118
|
+
handleFormValueChange(e.target.value, e.target.id, e.target.required);
|
|
119
|
+
};
|
|
120
|
+
const handleFormValueChange = (fieldValue, id, required) => {
|
|
121
|
+
if (id === 'pollQuestion') {
|
|
122
|
+
setPollQuestion(fieldValue);
|
|
123
|
+
}
|
|
124
|
+
if (required && !validateField(id, fieldValue)) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
setErrors({
|
|
128
|
+
...errors,
|
|
129
|
+
[id]: false
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
const validateField = (fieldId, fieldValue) => {
|
|
133
|
+
if (_Utils.default.isNull(fieldValue) || typeof fieldValue === 'string' && _Utils.default.isStringEmpty(fieldValue)) {
|
|
134
|
+
// value[fieldId] = null;
|
|
135
|
+
setErrors({
|
|
136
|
+
...errors,
|
|
137
|
+
[fieldId]: true
|
|
138
|
+
});
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
return true;
|
|
142
|
+
};
|
|
143
|
+
const addOption = () => {
|
|
144
|
+
const ops = options.slice();
|
|
145
|
+
setOptions(ops.concat([{
|
|
146
|
+
id: `option-${options.length + 1}`,
|
|
147
|
+
label: `Option ${options.length + 1}`,
|
|
148
|
+
value: ''
|
|
149
|
+
}]));
|
|
150
|
+
};
|
|
151
|
+
const removeOption = index => {
|
|
152
|
+
const ops = options.slice();
|
|
153
|
+
setOptions([...ops.slice(0, index), ...ops.slice(index + 1)]);
|
|
154
|
+
};
|
|
155
|
+
const hasErrors = errorState => {
|
|
156
|
+
let properties = Object.getOwnPropertyNames(errorState);
|
|
157
|
+
for (let i = 0; i < properties.length; i++) {
|
|
158
|
+
if (errorState[properties[i]]) {
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return false;
|
|
163
|
+
};
|
|
164
|
+
const handleFormChange = (index, event) => {
|
|
165
|
+
let data = [...options];
|
|
166
|
+
data[index]['value'] = event.target.value;
|
|
167
|
+
setOptions(data);
|
|
168
|
+
};
|
|
169
|
+
const sendPoll = () => {
|
|
170
|
+
let errorState = {
|
|
171
|
+
pollQuestion: pollQuestion.length === 0,
|
|
172
|
+
pollOptions: options[0].value.length === 0 || options[1].value.length === 0
|
|
173
|
+
};
|
|
174
|
+
setErrors(errorState);
|
|
175
|
+
if (!hasErrors(errorState)) {
|
|
176
|
+
const data = {
|
|
177
|
+
question: pollQuestion,
|
|
178
|
+
pollLength: {
|
|
179
|
+
days: pollLengthDays,
|
|
180
|
+
hours: pollLengthHours
|
|
181
|
+
},
|
|
182
|
+
options: options.filter(option => option.value.length > 0).map(option => {
|
|
183
|
+
return {
|
|
184
|
+
text: option.value
|
|
185
|
+
};
|
|
186
|
+
})
|
|
187
|
+
};
|
|
188
|
+
(0, _RestUtils.postData)(`${_ChatRoom.location + '/' + _ApplicationManager.default.getContextRoot()}/calendar/api/v1/poll/create`, response => {
|
|
189
|
+
props.createPollHandler(response);
|
|
190
|
+
}, e => {}, true, data);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
194
|
+
className: 'chat-container'
|
|
195
|
+
}, /*#__PURE__*/_react.default.createElement("h5", {
|
|
196
|
+
style: {
|
|
197
|
+
fontSize: '24px',
|
|
198
|
+
marginBottom: '8px'
|
|
199
|
+
}
|
|
200
|
+
}, "Create Poll"), /*#__PURE__*/_react.default.createElement("p", null, "Poll audience: ", /*#__PURE__*/_react.default.createElement("span", {
|
|
201
|
+
style: {
|
|
202
|
+
fontWeight: '10'
|
|
203
|
+
}
|
|
204
|
+
}, getParticipantNames(), " ")), /*#__PURE__*/_react.default.createElement("div", {
|
|
205
|
+
style: {
|
|
206
|
+
width: '100%'
|
|
207
|
+
}
|
|
208
|
+
}, /*#__PURE__*/_react.default.createElement(_reactstrap.Form, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
209
|
+
className: props.chatTab ? "poll-input" : 'full-poll-input'
|
|
210
|
+
}, /*#__PURE__*/_react.default.createElement(_TextField.default, {
|
|
211
|
+
className: 'question-txt',
|
|
212
|
+
style: {
|
|
213
|
+
width: '100%'
|
|
214
|
+
},
|
|
215
|
+
id: "pollQuestion",
|
|
216
|
+
label: "Question",
|
|
217
|
+
value: pollQuestion,
|
|
218
|
+
onChange: e => formValueChangeHandler(e),
|
|
219
|
+
error: Boolean(errors.pollQuestion),
|
|
220
|
+
helperText: errors.pollQuestion ? 'A poll question is required. Please enter a value' : '',
|
|
221
|
+
required: true,
|
|
222
|
+
fullWidth: true
|
|
223
|
+
})), options.map((option, index) => {
|
|
224
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
225
|
+
key: index,
|
|
226
|
+
className: 'row no-margin'
|
|
227
|
+
}, /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
228
|
+
className: props.chatTab ? options[index].id === 'option-1' || options[index].id === 'option-2' ? "poll-input" : "optional-poll-input" : 'full-poll-input'
|
|
229
|
+
}, /*#__PURE__*/_react.default.createElement(_TextField.default, {
|
|
230
|
+
className: options[index].id === 'option-1' || options[index].id === 'option-2' ? 'question-txt' : 'optional-choice',
|
|
231
|
+
style: {
|
|
232
|
+
width: '100%'
|
|
233
|
+
},
|
|
234
|
+
id: option.id,
|
|
235
|
+
label: option.label,
|
|
236
|
+
value: option.value,
|
|
237
|
+
onChange: e => handleFormChange(index, e),
|
|
238
|
+
error: Boolean(errors.pollQuestion),
|
|
239
|
+
helperText: errors.pollOptions ? 'At least two options required.' : '',
|
|
240
|
+
required: true,
|
|
241
|
+
fullWidth: true
|
|
242
|
+
})), options[index].id === 'option-1' || options[index].id === 'option-2' ? null : /*#__PURE__*/_react.default.createElement("div", {
|
|
243
|
+
className: props.chatTab ? 'dynamic-delete-button' : null,
|
|
244
|
+
style: {
|
|
245
|
+
paddingLeft: '8px',
|
|
246
|
+
width: '32px'
|
|
247
|
+
}
|
|
248
|
+
}, /*#__PURE__*/_react.default.createElement(_core.IconButton, {
|
|
249
|
+
onClick: () => removeOption(index)
|
|
250
|
+
}, /*#__PURE__*/_react.default.createElement(_Delete.default, null)))));
|
|
251
|
+
}), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
252
|
+
onClick: () => addOption(),
|
|
253
|
+
style: {
|
|
254
|
+
marginTop: '8px'
|
|
255
|
+
},
|
|
256
|
+
variant: "outlined",
|
|
257
|
+
color: 'primary',
|
|
258
|
+
disabled: options.length === 6,
|
|
259
|
+
startIcon: /*#__PURE__*/_react.default.createElement(_icons.Add, null)
|
|
260
|
+
}, "Add Option"), /*#__PURE__*/_react.default.createElement("div", {
|
|
261
|
+
className: 'row no-margin'
|
|
262
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
263
|
+
style: {
|
|
264
|
+
marginTop: '8px'
|
|
265
|
+
}
|
|
266
|
+
}, /*#__PURE__*/_react.default.createElement(_FormControl.default, {
|
|
267
|
+
style: {
|
|
268
|
+
width: '150px',
|
|
269
|
+
marginRight: '8px'
|
|
270
|
+
}
|
|
271
|
+
}, /*#__PURE__*/_react.default.createElement(_InputLabel.default, {
|
|
272
|
+
id: "poll-length-day"
|
|
273
|
+
}, "Poll Days"), /*#__PURE__*/_react.default.createElement(_Select.default, {
|
|
274
|
+
labelId: "poll-length-day",
|
|
275
|
+
id: "poll-length-day",
|
|
276
|
+
value: pollLengthDays,
|
|
277
|
+
onChange: e => {
|
|
278
|
+
setPollLengthDays(e.target.value);
|
|
279
|
+
}
|
|
280
|
+
}, pollLengthDaysOptions?.map(option => /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
|
|
281
|
+
key: option.id,
|
|
282
|
+
value: option.id
|
|
283
|
+
}, option.label))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
284
|
+
style: {
|
|
285
|
+
marginTop: '8px'
|
|
286
|
+
}
|
|
287
|
+
}, /*#__PURE__*/_react.default.createElement(_FormControl.default, {
|
|
288
|
+
style: {
|
|
289
|
+
width: '150px',
|
|
290
|
+
marginRight: '8px'
|
|
291
|
+
}
|
|
292
|
+
}, /*#__PURE__*/_react.default.createElement(_InputLabel.default, {
|
|
293
|
+
id: "poll-length-day"
|
|
294
|
+
}, "Poll Hours"), /*#__PURE__*/_react.default.createElement(_Select.default, {
|
|
295
|
+
labelId: "poll-length-hours",
|
|
296
|
+
id: "poll-length-hours",
|
|
297
|
+
value: pollLengthHours,
|
|
298
|
+
onChange: e => {
|
|
299
|
+
setPollLengthHours(e.target.value);
|
|
300
|
+
}
|
|
301
|
+
}, pollLengthHoursOptions?.map(option => /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
|
|
302
|
+
key: option.id,
|
|
303
|
+
value: option.id
|
|
304
|
+
}, option.label)))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
305
|
+
className: "d-flex mb-1"
|
|
306
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
307
|
+
style: {
|
|
308
|
+
width: '100%',
|
|
309
|
+
display: 'flex',
|
|
310
|
+
justifyContent: 'right',
|
|
311
|
+
margin: '16px 0'
|
|
312
|
+
}
|
|
313
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
314
|
+
style: {
|
|
315
|
+
marginRight: '4px'
|
|
316
|
+
}
|
|
317
|
+
}, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
318
|
+
onClick: e => sendPoll(),
|
|
319
|
+
variant: 'contained',
|
|
320
|
+
size: "large",
|
|
321
|
+
color: 'primary'
|
|
322
|
+
}, "SEND")), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
323
|
+
style: {
|
|
324
|
+
marginRight: '4px'
|
|
325
|
+
},
|
|
326
|
+
variant: 'text',
|
|
327
|
+
size: "large",
|
|
328
|
+
onClick: e => props.cancelPollHandler()
|
|
329
|
+
}, "CANCEL"))))));
|
|
330
|
+
};
|
|
331
|
+
var _default = exports.default = ChatPoll;
|
|
@@ -30,6 +30,8 @@ var _excel = _interopRequireDefault(require("../../../assets/img/excel.png"));
|
|
|
30
30
|
var _VCEventManager = _interopRequireDefault(require("../VCEventManager"));
|
|
31
31
|
var _SocketManager = _interopRequireDefault(require("../../SocketManager"));
|
|
32
32
|
var _Icon = _interopRequireDefault(require("../../Icon"));
|
|
33
|
+
var _ChatPoll = _interopRequireDefault(require("./ChatPoll"));
|
|
34
|
+
var _PollContainer = _interopRequireDefault(require("./PollContainer"));
|
|
33
35
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
34
36
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
35
37
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -70,13 +72,31 @@ const ChatRoom = props => {
|
|
|
70
72
|
};
|
|
71
73
|
};
|
|
72
74
|
const fetchChat = () => {
|
|
73
|
-
alert("MEETING ID : ", selectedChat.meetingId);
|
|
74
75
|
(0, _RestUtils.sendRequest)(`${location + '/' + _ApplicationManager.default.getContextRoot()}/calendar/api/v1/chat/fetchMeetingChat/${selectedChat.meetingId}`, response => {
|
|
75
76
|
if (response && response.id) {
|
|
76
77
|
setSelectedChat(response);
|
|
77
78
|
}
|
|
78
79
|
}, e => {}, true, false);
|
|
79
80
|
};
|
|
81
|
+
const closePollHandler = (e, poll) => {
|
|
82
|
+
(0, _RestUtils.postData)(`${location + '/' + _ApplicationManager.default.getContextRoot()}/calendar/api/v1/poll/close`, response => {
|
|
83
|
+
sendMessage(e, `Poll: ${poll.question} has been closed.`);
|
|
84
|
+
fetchChat();
|
|
85
|
+
}, e => {}, true, {
|
|
86
|
+
id: poll.id
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
const submitPollVoteHandler = poll => {
|
|
90
|
+
let chatParticipant = selectedChat.participants.find(p => p.username === currentUser.username);
|
|
91
|
+
const data = {
|
|
92
|
+
pollId: poll.id,
|
|
93
|
+
optionId: poll.selectedOption,
|
|
94
|
+
chatParticipant: chatParticipant
|
|
95
|
+
};
|
|
96
|
+
(0, _RestUtils.postData)(`${location + '/' + _ApplicationManager.default.getContextRoot()}/calendar/api/v1/poll/vote`, response => {
|
|
97
|
+
fetchChat();
|
|
98
|
+
}, e => {}, true, data);
|
|
99
|
+
};
|
|
80
100
|
const onSystemEvent = payload => {
|
|
81
101
|
console.log(messages);
|
|
82
102
|
if (payload.systemEventType === "NEW_POLL_VOTE") {
|
|
@@ -609,6 +629,18 @@ const ChatRoom = props => {
|
|
|
609
629
|
width: '100%'
|
|
610
630
|
}
|
|
611
631
|
}));
|
|
632
|
+
} else {
|
|
633
|
+
return /*#__PURE__*/_react.default.createElement(_PollContainer.default, {
|
|
634
|
+
poll: message.poll,
|
|
635
|
+
chatTab: props.chatTab,
|
|
636
|
+
pollCreator: message.participant,
|
|
637
|
+
createdDate: message.createdDate,
|
|
638
|
+
submitPollVoteHandler: poll => submitPollVoteHandler(poll),
|
|
639
|
+
pollParticipantIDs: selectedChat.participants.map(p => p.userId),
|
|
640
|
+
currentUser: currentUser,
|
|
641
|
+
closePollHandler: (e, poll) => closePollHandler(e, poll),
|
|
642
|
+
numberOfPollParticipants: selectedChat.participants.length
|
|
643
|
+
});
|
|
612
644
|
}
|
|
613
645
|
}
|
|
614
646
|
};
|
|
@@ -627,7 +659,28 @@ const ChatRoom = props => {
|
|
|
627
659
|
}
|
|
628
660
|
}, selectedChat.type === 'CALENDAR_MEETING' || selectedChat.participants.length > 2 ? /*#__PURE__*/_react.default.createElement(_reactFeather.Calendar, null) : _Utils.default.getInitials(selectedChat.participants.find(p => p.username !== currentUser.username).name))), /*#__PURE__*/_react.default.createElement("h5", null, getChatRoomTitle())), /*#__PURE__*/_react.default.createElement("div", {
|
|
629
661
|
className: "chatroom__headerright"
|
|
630
|
-
}, !props.chatTab && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null
|
|
662
|
+
}, !props.chatTab && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
663
|
+
title: "Poll"
|
|
664
|
+
}, /*#__PURE__*/_react.default.createElement(_core.IconButton, {
|
|
665
|
+
onClick: e => {
|
|
666
|
+
setMode('POLL');
|
|
667
|
+
}
|
|
668
|
+
}, /*#__PURE__*/_react.default.createElement(_icons.Poll, {
|
|
669
|
+
style: {
|
|
670
|
+
color: props.chatTab ? 'white' : null,
|
|
671
|
+
marginTop: props.chatTab ? '8px' : null
|
|
672
|
+
}
|
|
673
|
+
})))))), mode === 'POLL' ? /*#__PURE__*/_react.default.createElement(_ChatPoll.default, {
|
|
674
|
+
chatTab: props.chatTab,
|
|
675
|
+
participants: selectedChat.participants,
|
|
676
|
+
createPollHandler: pollData => {
|
|
677
|
+
sendMessage(null, null, pollData);
|
|
678
|
+
setMode('CHAT');
|
|
679
|
+
},
|
|
680
|
+
cancelPollHandler: () => {
|
|
681
|
+
setMode('CHAT');
|
|
682
|
+
}
|
|
683
|
+
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null), mode === 'CHAT' ? /*#__PURE__*/_react.default.createElement("div", {
|
|
631
684
|
id: "messages",
|
|
632
685
|
ref: messagesEndRef,
|
|
633
686
|
className: "chatroom__body"
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
.chat-container {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 100%;
|
|
4
|
+
max-height: 100%;
|
|
5
|
+
overflow-x: hidden;
|
|
6
|
+
overflow-y: auto;
|
|
7
|
+
padding: 8px;
|
|
8
|
+
background-color: #FFFFFF;
|
|
9
|
+
margin-top: 2px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.poll-input {
|
|
13
|
+
width: 100%;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.full-poll-input {
|
|
17
|
+
width: 60%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.optional-poll-input {
|
|
21
|
+
width: calc(100% - 58px);
|
|
22
|
+
}
|
|
23
|
+
.full-poll-input div,
|
|
24
|
+
.optional-poll-input div,
|
|
25
|
+
.poll-input div {
|
|
26
|
+
width: 100%;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.new-poll-container {
|
|
30
|
+
max-width: 520px;
|
|
31
|
+
margin: 0 auto;
|
|
32
|
+
margin-top: 40px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.create-poll-form-button {
|
|
36
|
+
width: 100%;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.create-poll-form-button[disabled], .create-poll-form-button[disabled]:hover, .create-poll-form-button[disabled]:focus {
|
|
40
|
+
opacity: 0.6;
|
|
41
|
+
color: #fff;
|
|
42
|
+
background-color: #1890ff;
|
|
43
|
+
border-color: #1890ff;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
.dynamic-delete-button {
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
position: relative;
|
|
50
|
+
top: 4px;
|
|
51
|
+
font-size: 24px;
|
|
52
|
+
color: #999;
|
|
53
|
+
transition: all .3s;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.optional-choice {
|
|
57
|
+
width: calc(80% - 252px);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.question-txt {
|
|
61
|
+
width: calc(80% - 188px);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.dynamic-delete-button:hover {
|
|
65
|
+
color: #777;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.dynamic-delete-button[disabled] {
|
|
69
|
+
cursor: not-allowed;
|
|
70
|
+
opacity: 0.5;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.poll-form-row {
|
|
74
|
+
margin-bottom: 20px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.poll-form-row input, .poll-form-row textarea {
|
|
78
|
+
margin-bottom: 4px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@media screen and (max-width: 991px) {
|
|
82
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
require("./ChatRooms.scss");
|
|
9
|
+
var _core = require("@material-ui/core");
|
|
10
|
+
var _Utils = _interopRequireDefault(require("../../../Utils"));
|
|
11
|
+
var _FormControl = _interopRequireDefault(require("@material-ui/core/FormControl"));
|
|
12
|
+
var _RadioGroup = _interopRequireDefault(require("@material-ui/core/RadioGroup"));
|
|
13
|
+
var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
|
|
14
|
+
var _VCEventManager = _interopRequireDefault(require("../VCEventManager"));
|
|
15
|
+
var _SocketManager = _interopRequireDefault(require("../../SocketManager"));
|
|
16
|
+
var _VCEventType = require("../VCEventType");
|
|
17
|
+
var _PollResult = _interopRequireDefault(require("./PollResult"));
|
|
18
|
+
var _FormControlLabel = _interopRequireDefault(require("@material-ui/core/FormControlLabel"));
|
|
19
|
+
var _Radio = _interopRequireDefault(require("@material-ui/core/Radio"));
|
|
20
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
22
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
23
|
+
const PollContainer = props => {
|
|
24
|
+
const [pollOptions, setPollOptions] = (0, _react.useState)([]);
|
|
25
|
+
const [poll, setPoll] = (0, _react.useState)({});
|
|
26
|
+
const [pollClosed, setPollClosed] = (0, _react.useState)(false);
|
|
27
|
+
const [currentVote, setCurrentVote] = (0, _react.useState)(null);
|
|
28
|
+
const [totalVotes, setTotalVotes] = (0, _react.useState)(0);
|
|
29
|
+
const [socketEventHandler] = (0, _react.useState)({});
|
|
30
|
+
const socketEventHandlerApi = () => {
|
|
31
|
+
return {
|
|
32
|
+
get id() {
|
|
33
|
+
return `poll-container-${props.poll.id}`;
|
|
34
|
+
},
|
|
35
|
+
on: (eventType, be) => {
|
|
36
|
+
switch (eventType) {
|
|
37
|
+
case _VCEventType.VCEventType.SYSTEM_EVENT:
|
|
38
|
+
onSystemEvent(be.payload);
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
const onSystemEvent = payload => {
|
|
45
|
+
if (payload.systemEventType === "NEW_POLL_VOTE" && payload.data.pollId === poll.id) {
|
|
46
|
+
setTotalVotes(totalVotes + 1);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const pollRemainingTime = expirationDateTime => {
|
|
50
|
+
const expirationTime = new Date(expirationDateTime).getTime();
|
|
51
|
+
const currentTime = new Date().getTime();
|
|
52
|
+
const difference_ms = expirationTime - currentTime;
|
|
53
|
+
const seconds = Math.floor(difference_ms / 1000 % 60);
|
|
54
|
+
const minutes = Math.floor(difference_ms / 1000 / 60 % 60);
|
|
55
|
+
const hours = Math.floor(difference_ms / (1000 * 60 * 60) % 24);
|
|
56
|
+
const days = Math.floor(difference_ms / (1000 * 60 * 60 * 24));
|
|
57
|
+
let timeRemaining;
|
|
58
|
+
if (days > 0) {
|
|
59
|
+
timeRemaining = days + " days left";
|
|
60
|
+
} else if (hours > 0) {
|
|
61
|
+
timeRemaining = hours + " hours left";
|
|
62
|
+
} else if (minutes > 0) {
|
|
63
|
+
timeRemaining = minutes + " minutes left";
|
|
64
|
+
} else if (seconds > 0) {
|
|
65
|
+
timeRemaining = seconds + " seconds left";
|
|
66
|
+
} else {
|
|
67
|
+
timeRemaining = "less than a second left";
|
|
68
|
+
}
|
|
69
|
+
return timeRemaining;
|
|
70
|
+
};
|
|
71
|
+
const calculatePercentage = (renderedPoll, option) => {
|
|
72
|
+
if (renderedPoll.totalVotes === 0) {
|
|
73
|
+
return 0;
|
|
74
|
+
}
|
|
75
|
+
return option.voteCount * 100 / renderedPoll.totalVotes;
|
|
76
|
+
};
|
|
77
|
+
const winningOptions = options => {
|
|
78
|
+
return options.reduce((prevOption, currentOption) => currentOption.voteCount > prevOption.voteCount ? currentOption : prevOption, {
|
|
79
|
+
voteCount: -Infinity
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
(0, _react.useEffect)(() => {
|
|
83
|
+
_VCEventManager.default.addSubscriptions(socketEventHandler, _VCEventType.VCEventType.CHAT_MESSAGE, _VCEventType.VCEventType.SYSTEM_EVENT);
|
|
84
|
+
return () => {
|
|
85
|
+
_VCEventManager.default.removeSubscriptions(socketEventHandler);
|
|
86
|
+
};
|
|
87
|
+
}, []);
|
|
88
|
+
(0, _react.useEffect)(() => {
|
|
89
|
+
socketEventHandler.api = socketEventHandlerApi();
|
|
90
|
+
});
|
|
91
|
+
(0, _react.useEffect)(() => {
|
|
92
|
+
console.log('___ POLL: ', props.poll);
|
|
93
|
+
if (props.poll) {
|
|
94
|
+
const renderedPoll = props.poll;
|
|
95
|
+
setPoll(renderedPoll);
|
|
96
|
+
setTotalVotes(renderedPoll.totalVotes ? renderedPoll.totalVotes : 0);
|
|
97
|
+
const pollOptionRows = [];
|
|
98
|
+
const closed = renderedPoll.isExpired || !renderedPoll.open;
|
|
99
|
+
setPollClosed(closed);
|
|
100
|
+
if (closed) {
|
|
101
|
+
const winningOpt = winningOptions(renderedPoll.options);
|
|
102
|
+
renderedPoll.options.forEach(option => {
|
|
103
|
+
pollOptionRows.push( /*#__PURE__*/_react.default.createElement(_PollResult.default, {
|
|
104
|
+
key: option.id,
|
|
105
|
+
option: option,
|
|
106
|
+
isWinner: winningOpt && option.id === winningOpt.id,
|
|
107
|
+
isSelected: renderedPoll.selectedOption === option.id,
|
|
108
|
+
percentVote: calculatePercentage(renderedPoll, option)
|
|
109
|
+
}));
|
|
110
|
+
});
|
|
111
|
+
} else {
|
|
112
|
+
renderedPoll.options.forEach(option => {
|
|
113
|
+
pollOptionRows.push( /*#__PURE__*/_react.default.createElement(_FormControlLabel.default, {
|
|
114
|
+
key: option.id,
|
|
115
|
+
className: "poll-choice-radio",
|
|
116
|
+
value: option.id,
|
|
117
|
+
control: /*#__PURE__*/_react.default.createElement(_Radio.default, null),
|
|
118
|
+
label: option.text
|
|
119
|
+
}));
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
setPollOptions(pollOptionRows);
|
|
123
|
+
}
|
|
124
|
+
}, [props.poll]);
|
|
125
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
126
|
+
className: "poll-content"
|
|
127
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
128
|
+
className: "poll-header"
|
|
129
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
130
|
+
className: "poll-creator-info"
|
|
131
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_core.Avatar, {
|
|
132
|
+
className: "poll-creator-avatar",
|
|
133
|
+
style: {
|
|
134
|
+
backgroundColor: _Utils.default.getAvatarColor(props.pollCreator.name)
|
|
135
|
+
}
|
|
136
|
+
}, _Utils.default.getInitials(props.pollCreator.name)), /*#__PURE__*/_react.default.createElement("span", {
|
|
137
|
+
className: "poll-creator-name"
|
|
138
|
+
}, props.pollCreator.name), /*#__PURE__*/_react.default.createElement("span", {
|
|
139
|
+
className: "poll-creation-date"
|
|
140
|
+
}, _Utils.default.formatDateTime(props.createdDate)))), /*#__PURE__*/_react.default.createElement("div", {
|
|
141
|
+
className: "poll-question"
|
|
142
|
+
}, poll.question), /*#__PURE__*/_react.default.createElement("div", {
|
|
143
|
+
className: "poll-creation-date"
|
|
144
|
+
}, "Results are visible after the poll has closed / expired.")), /*#__PURE__*/_react.default.createElement("div", {
|
|
145
|
+
className: "poll-choices"
|
|
146
|
+
}, /*#__PURE__*/_react.default.createElement(_FormControl.default, {
|
|
147
|
+
style: {
|
|
148
|
+
width: '100%'
|
|
149
|
+
}
|
|
150
|
+
}, /*#__PURE__*/_react.default.createElement(_RadioGroup.default, {
|
|
151
|
+
className: "poll-choice-radio-group",
|
|
152
|
+
value: currentVote ? currentVote : poll.selectedOption ? poll.selectedOption : '',
|
|
153
|
+
onChange: e => {
|
|
154
|
+
setCurrentVote(e.target.value);
|
|
155
|
+
}
|
|
156
|
+
}, pollOptions))), !pollClosed ? /*#__PURE__*/_react.default.createElement("div", {
|
|
157
|
+
className: "poll-footer"
|
|
158
|
+
}, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
159
|
+
className: "vote-button",
|
|
160
|
+
variant: 'outlined',
|
|
161
|
+
onClick: () => {
|
|
162
|
+
const hasVoted = poll.selectedOption;
|
|
163
|
+
poll.selectedOption = currentVote ? currentVote : '';
|
|
164
|
+
props.submitPollVoteHandler(poll);
|
|
165
|
+
if (!hasVoted) {
|
|
166
|
+
_SocketManager.default.emitEvent(_VCEventType.VCEventType.SYSTEM_EVENT, {
|
|
167
|
+
systemEventType: "NEW_POLL_VOTE",
|
|
168
|
+
recipients: props.pollParticipantIDs,
|
|
169
|
+
data: {
|
|
170
|
+
pollId: poll.id
|
|
171
|
+
}
|
|
172
|
+
}).catch(error => {});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}, "Submit Vote"), props.currentUser.userId === props.pollCreator.userId && /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
176
|
+
className: "vote-button",
|
|
177
|
+
variant: 'outlined',
|
|
178
|
+
onClick: e => {
|
|
179
|
+
props.closePollHandler(e, poll);
|
|
180
|
+
},
|
|
181
|
+
style: {
|
|
182
|
+
marginLeft: '8px'
|
|
183
|
+
}
|
|
184
|
+
}, "Close Poll"), /*#__PURE__*/_react.default.createElement("span", {
|
|
185
|
+
style: {
|
|
186
|
+
marginLeft: '8px',
|
|
187
|
+
color: '#000000'
|
|
188
|
+
},
|
|
189
|
+
className: "time-left"
|
|
190
|
+
}, `${totalVotes} votes out of ${props.numberOfPollParticipants}`), /*#__PURE__*/_react.default.createElement("span", {
|
|
191
|
+
className: "separator"
|
|
192
|
+
}, "\u2022"), /*#__PURE__*/_react.default.createElement("span", {
|
|
193
|
+
className: "time-left",
|
|
194
|
+
style: {
|
|
195
|
+
marginLeft: '4px',
|
|
196
|
+
color: '#000000'
|
|
197
|
+
}
|
|
198
|
+
}, pollRemainingTime(poll.expirationDateTime)), poll.selectedOption && /*#__PURE__*/_react.default.createElement("div", {
|
|
199
|
+
className: "poll-creation-date"
|
|
200
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
201
|
+
style: {
|
|
202
|
+
color: '#945c33'
|
|
203
|
+
}
|
|
204
|
+
}, "You have voted ", props.poll.options.find(o => o.id === poll.selectedOption)?.text))) : /*#__PURE__*/_react.default.createElement("div", {
|
|
205
|
+
className: "poll-footer"
|
|
206
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
207
|
+
style: {
|
|
208
|
+
marginLeft: '4px'
|
|
209
|
+
},
|
|
210
|
+
className: "time-left"
|
|
211
|
+
}, `${totalVotes} voted out of ${props.numberOfPollParticipants}`), /*#__PURE__*/_react.default.createElement("span", {
|
|
212
|
+
className: "separator"
|
|
213
|
+
}, "\u2022"), /*#__PURE__*/_react.default.createElement("span", {
|
|
214
|
+
className: "time-left",
|
|
215
|
+
style: {
|
|
216
|
+
marginLeft: '4px'
|
|
217
|
+
}
|
|
218
|
+
}, "Closed / Expired")));
|
|
219
|
+
};
|
|
220
|
+
var _default = exports.default = PollContainer;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
require("./ChatRooms.scss");
|
|
9
|
+
var _icons = require("@material-ui/icons");
|
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
+
const PollResult = props => {
|
|
13
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
14
|
+
className: "cv-poll-choice"
|
|
15
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
16
|
+
className: "cv-poll-choice-details"
|
|
17
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
18
|
+
className: "cv-choice-percentage"
|
|
19
|
+
}, !props.percentVote ? '0' : Math.round(props.percentVote * 100) / 100, "%"), /*#__PURE__*/_react.default.createElement("span", {
|
|
20
|
+
className: "cv-choice-text"
|
|
21
|
+
}, props.option.text), props.isSelected ? /*#__PURE__*/_react.default.createElement(_icons.CheckCircle, {
|
|
22
|
+
className: "selected-choice-icon"
|
|
23
|
+
}) : null), /*#__PURE__*/_react.default.createElement("span", {
|
|
24
|
+
className: props.isWinner ? 'cv-choice-percent-chart winner' : 'cv-choice-percent-chart',
|
|
25
|
+
style: {
|
|
26
|
+
width: !props.percentVote ? '0%' : props.percentVote + '%'
|
|
27
|
+
}
|
|
28
|
+
}));
|
|
29
|
+
};
|
|
30
|
+
var _default = exports.default = PollResult;
|