2019-07-09 06:57:10 +08:00
|
|
|
import React, { Component } from 'react';
|
2018-10-16 03:58:07 +08:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
2019-03-09 04:46:25 +08:00
|
|
|
import { withModalMounter } from '/imports/ui/components/modal/service';
|
2018-10-16 03:58:07 +08:00
|
|
|
import _ from 'lodash';
|
2018-10-18 22:31:17 +08:00
|
|
|
import { Session } from 'meteor/session';
|
2020-09-21 20:07:36 +08:00
|
|
|
import cx from 'classnames';
|
2018-09-15 01:50:18 +08:00
|
|
|
import Button from '/imports/ui/components/button/component';
|
2021-04-29 23:10:18 +08:00
|
|
|
import Toggle from '/imports/ui/components/switch/component';
|
2018-10-29 23:27:50 +08:00
|
|
|
import LiveResult from './live-result/component';
|
2018-09-15 01:50:18 +08:00
|
|
|
import { styles } from './styles.scss';
|
2021-05-18 04:25:07 +08:00
|
|
|
import { PANELS, ACTIONS } from '../layout/enums';
|
2021-02-08 20:06:15 +08:00
|
|
|
import DragAndDrop from './dragAndDrop/component';
|
2021-09-13 08:03:03 +08:00
|
|
|
import { alertScreenReader } from '/imports/utils/dom-utils';
|
2018-09-15 01:50:18 +08:00
|
|
|
|
2018-09-24 06:57:03 +08:00
|
|
|
const intlMessages = defineMessages({
|
|
|
|
pollPaneTitle: {
|
|
|
|
id: 'app.poll.pollPaneTitle',
|
|
|
|
description: 'heading label for the poll menu',
|
|
|
|
},
|
2018-10-30 23:57:10 +08:00
|
|
|
closeLabel: {
|
|
|
|
id: 'app.poll.closeLabel',
|
|
|
|
description: 'label for poll pane close button',
|
|
|
|
},
|
2018-09-24 06:57:03 +08:00
|
|
|
hidePollDesc: {
|
|
|
|
id: 'app.poll.hidePollDesc',
|
|
|
|
description: 'aria label description for hide poll button',
|
|
|
|
},
|
|
|
|
quickPollInstruction: {
|
|
|
|
id: 'app.poll.quickPollInstruction',
|
|
|
|
description: 'instructions for using pre configured polls',
|
|
|
|
},
|
2018-09-25 06:43:54 +08:00
|
|
|
activePollInstruction: {
|
|
|
|
id: 'app.poll.activePollInstruction',
|
|
|
|
description: 'instructions displayed when a poll is active',
|
|
|
|
},
|
2021-02-08 20:06:15 +08:00
|
|
|
dragDropPollInstruction: {
|
|
|
|
id: 'app.poll.dragDropPollInstruction',
|
|
|
|
description: 'instructions for upload poll options via drag and drop',
|
|
|
|
},
|
2019-02-02 11:56:15 +08:00
|
|
|
ariaInputCount: {
|
|
|
|
id: 'app.poll.ariaInputCount',
|
|
|
|
description: 'aria label for custom poll input field',
|
|
|
|
},
|
2018-09-24 06:57:03 +08:00
|
|
|
customPlaceholder: {
|
|
|
|
id: 'app.poll.customPlaceholder',
|
|
|
|
description: 'custom poll input field placeholder text',
|
|
|
|
},
|
2019-03-09 04:46:25 +08:00
|
|
|
noPresentationSelected: {
|
|
|
|
id: 'app.poll.noPresentationSelected',
|
|
|
|
description: 'no presentation label',
|
|
|
|
},
|
|
|
|
clickHereToSelect: {
|
|
|
|
id: 'app.poll.clickHereToSelect',
|
|
|
|
description: 'open uploader modal button label',
|
|
|
|
},
|
2020-09-22 06:52:38 +08:00
|
|
|
questionErr: {
|
|
|
|
id: 'app.poll.questionErr',
|
|
|
|
description: 'question text area error label',
|
|
|
|
},
|
|
|
|
optionErr: {
|
|
|
|
id: 'app.poll.optionErr',
|
|
|
|
description: 'poll input error label',
|
|
|
|
},
|
2018-10-03 11:24:34 +08:00
|
|
|
tf: {
|
|
|
|
id: 'app.poll.tf',
|
2018-09-24 06:57:03 +08:00
|
|
|
description: 'label for true / false poll',
|
|
|
|
},
|
2018-10-03 11:24:34 +08:00
|
|
|
a4: {
|
|
|
|
id: 'app.poll.a4',
|
2018-09-24 06:57:03 +08:00
|
|
|
description: 'label for A / B / C / D poll',
|
|
|
|
},
|
2020-09-21 20:07:36 +08:00
|
|
|
delete: {
|
|
|
|
id: 'app.poll.optionDelete.label',
|
|
|
|
description: '',
|
|
|
|
},
|
|
|
|
questionLabel: {
|
|
|
|
id: 'app.poll.question.label',
|
|
|
|
description: '',
|
|
|
|
},
|
2021-10-01 02:55:46 +08:00
|
|
|
optionalQuestionLabel: {
|
|
|
|
id: 'app.poll.optionalQuestion.label',
|
|
|
|
description: '',
|
|
|
|
},
|
2020-09-21 20:07:36 +08:00
|
|
|
userResponse: {
|
|
|
|
id: 'app.poll.userResponse.label',
|
|
|
|
description: '',
|
|
|
|
},
|
|
|
|
responseChoices: {
|
|
|
|
id: 'app.poll.responseChoices.label',
|
|
|
|
description: '',
|
|
|
|
},
|
|
|
|
typedResponseDesc: {
|
|
|
|
id: 'app.poll.typedResponse.desc',
|
|
|
|
description: '',
|
|
|
|
},
|
|
|
|
responseTypesLabel: {
|
|
|
|
id: 'app.poll.responseTypes.label',
|
|
|
|
description: '',
|
|
|
|
},
|
|
|
|
addOptionLabel: {
|
|
|
|
id: 'app.poll.addItem.label',
|
|
|
|
description: '',
|
|
|
|
},
|
|
|
|
startPollLabel: {
|
|
|
|
id: 'app.poll.start.label',
|
|
|
|
description: '',
|
|
|
|
},
|
2021-04-29 23:10:18 +08:00
|
|
|
secretPollLabel: {
|
|
|
|
id: 'app.poll.secretPoll.label',
|
|
|
|
description: '',
|
|
|
|
},
|
2021-05-26 19:34:48 +08:00
|
|
|
isSecretPollLabel: {
|
2021-06-17 21:25:03 +08:00
|
|
|
id: 'app.poll.secretPoll.isSecretLabel',
|
2021-05-26 19:34:48 +08:00
|
|
|
description: '',
|
|
|
|
},
|
2020-09-21 20:07:36 +08:00
|
|
|
true: {
|
|
|
|
id: 'app.poll.answer.true',
|
|
|
|
description: '',
|
|
|
|
},
|
|
|
|
false: {
|
|
|
|
id: 'app.poll.answer.false',
|
|
|
|
description: '',
|
|
|
|
},
|
|
|
|
a: {
|
|
|
|
id: 'app.poll.answer.a',
|
|
|
|
description: '',
|
|
|
|
},
|
|
|
|
b: {
|
|
|
|
id: 'app.poll.answer.b',
|
|
|
|
description: '',
|
|
|
|
},
|
|
|
|
c: {
|
|
|
|
id: 'app.poll.answer.c',
|
|
|
|
description: '',
|
|
|
|
},
|
|
|
|
d: {
|
|
|
|
id: 'app.poll.answer.d',
|
|
|
|
description: '',
|
2018-09-24 06:57:03 +08:00
|
|
|
},
|
2021-02-19 00:06:21 +08:00
|
|
|
yna: {
|
|
|
|
id: 'app.poll.yna',
|
|
|
|
description: '',
|
|
|
|
},
|
|
|
|
yes: {
|
|
|
|
id: 'app.poll.y',
|
|
|
|
description: '',
|
|
|
|
},
|
|
|
|
no: {
|
|
|
|
id: 'app.poll.n',
|
|
|
|
description: '',
|
|
|
|
},
|
|
|
|
abstention: {
|
|
|
|
id: 'app.poll.abstention',
|
|
|
|
description: '',
|
|
|
|
},
|
2021-08-11 12:10:41 +08:00
|
|
|
startPollDesc: {
|
|
|
|
id: 'app.poll.startPollDesc',
|
|
|
|
description: '',
|
|
|
|
},
|
|
|
|
showRespDesc: {
|
|
|
|
id: 'app.poll.showRespDesc',
|
|
|
|
description: '',
|
|
|
|
},
|
|
|
|
addRespDesc: {
|
|
|
|
id: 'app.poll.addRespDesc',
|
|
|
|
description: '',
|
|
|
|
},
|
|
|
|
deleteRespDesc: {
|
|
|
|
id: 'app.poll.deleteRespDesc',
|
|
|
|
description: '',
|
|
|
|
},
|
2021-08-19 04:02:46 +08:00
|
|
|
on: {
|
|
|
|
id: 'app.switch.onLabel',
|
|
|
|
description: 'label for toggle switch on state',
|
|
|
|
},
|
|
|
|
off: {
|
|
|
|
id: 'app.switch.offLabel',
|
|
|
|
description: 'label for toggle switch off state',
|
|
|
|
},
|
2021-09-13 08:03:03 +08:00
|
|
|
removePollOpt: {
|
|
|
|
id: 'app.poll.removePollOpt',
|
|
|
|
description: 'screen reader alert for removed poll option',
|
|
|
|
},
|
2021-09-13 08:11:45 +08:00
|
|
|
emptyPollOpt: {
|
|
|
|
id: 'app.poll.emptyPollOpt',
|
|
|
|
description: 'screen reader for blank poll option',
|
|
|
|
},
|
2018-09-24 06:57:03 +08:00
|
|
|
});
|
|
|
|
|
2021-04-30 00:54:39 +08:00
|
|
|
const POLL_SETTINGS = Meteor.settings.public.poll;
|
|
|
|
|
2021-06-18 22:02:09 +08:00
|
|
|
const MAX_CUSTOM_FIELDS = POLL_SETTINGS.maxCustom;
|
2021-04-30 00:54:39 +08:00
|
|
|
const MAX_INPUT_CHARS = POLL_SETTINGS.maxTypedAnswerLength;
|
2021-04-24 03:10:43 +08:00
|
|
|
const QUESTION_MAX_INPUT_CHARS = 400;
|
2021-04-30 00:54:39 +08:00
|
|
|
const FILE_DRAG_AND_DROP_ENABLED = POLL_SETTINGS.allowDragAndDropFile;
|
2018-10-03 07:59:45 +08:00
|
|
|
|
2020-09-22 00:00:05 +08:00
|
|
|
const validateInput = (i) => {
|
|
|
|
let _input = i;
|
|
|
|
if (/^\s/.test(_input)) _input = '';
|
|
|
|
return _input;
|
|
|
|
};
|
|
|
|
|
2019-07-09 06:57:10 +08:00
|
|
|
class Poll extends Component {
|
2018-09-15 01:50:18 +08:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this.state = {
|
2018-09-25 06:43:54 +08:00
|
|
|
isPolling: false,
|
2020-09-21 20:07:36 +08:00
|
|
|
question: '',
|
|
|
|
optList: [],
|
2020-09-22 06:52:38 +08:00
|
|
|
error: null,
|
2021-04-29 23:10:18 +08:00
|
|
|
secretPoll: false,
|
2018-09-15 01:50:18 +08:00
|
|
|
};
|
|
|
|
|
2018-10-30 21:17:40 +08:00
|
|
|
this.handleBackClick = this.handleBackClick.bind(this);
|
2020-09-21 20:07:36 +08:00
|
|
|
this.handleAddOption = this.handleAddOption.bind(this);
|
|
|
|
this.handleRemoveOption = this.handleRemoveOption.bind(this);
|
|
|
|
this.handleTextareaChange = this.handleTextareaChange.bind(this);
|
|
|
|
this.handleInputChange = this.handleInputChange.bind(this);
|
2021-08-19 04:02:46 +08:00
|
|
|
this.displayToggleStatus = this.displayToggleStatus.bind(this);
|
2018-09-24 06:57:03 +08:00
|
|
|
}
|
|
|
|
|
2019-05-07 04:18:23 +08:00
|
|
|
componentDidMount() {
|
2019-07-09 06:57:10 +08:00
|
|
|
const { props } = this.hideBtn;
|
|
|
|
const { className } = props;
|
|
|
|
|
|
|
|
const hideBtn = document.getElementsByClassName(`${className}`);
|
|
|
|
if (hideBtn[0]) hideBtn[0].focus();
|
2019-05-07 04:18:23 +08:00
|
|
|
}
|
|
|
|
|
2018-11-23 12:08:48 +08:00
|
|
|
componentDidUpdate() {
|
2021-08-05 19:03:24 +08:00
|
|
|
const { amIPresenter, layoutContextDispatch } = this.props;
|
2021-07-08 04:15:07 +08:00
|
|
|
|
2019-03-28 23:58:10 +08:00
|
|
|
if (Session.equals('resetPollPanel', true)) {
|
2019-03-15 03:34:53 +08:00
|
|
|
this.handleBackClick();
|
|
|
|
}
|
2021-07-08 04:15:07 +08:00
|
|
|
|
|
|
|
if (!amIPresenter) {
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-07-08 04:15:07 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_IS_OPEN,
|
|
|
|
value: false,
|
|
|
|
});
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-07-08 04:15:07 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_PANEL,
|
|
|
|
value: PANELS.NONE,
|
|
|
|
});
|
|
|
|
}
|
2018-11-23 12:08:48 +08:00
|
|
|
}
|
|
|
|
|
2018-12-18 23:15:51 +08:00
|
|
|
handleBackClick() {
|
|
|
|
const { stopPoll } = this.props;
|
|
|
|
this.setState({
|
|
|
|
isPolling: false,
|
2020-09-22 06:52:38 +08:00
|
|
|
error: null,
|
2020-09-21 20:07:36 +08:00
|
|
|
}, () => {
|
|
|
|
stopPoll();
|
|
|
|
Session.set('resetPollPanel', false);
|
|
|
|
document.activeElement.blur();
|
|
|
|
});
|
2018-09-24 06:57:03 +08:00
|
|
|
}
|
|
|
|
|
2021-02-08 20:06:15 +08:00
|
|
|
handleInputTextChange(index, text) {
|
2021-03-05 03:43:43 +08:00
|
|
|
const { optList } = this.state;
|
2021-02-08 20:06:15 +08:00
|
|
|
// This regex will replace any instance of 2 or more consecutive white spaces
|
|
|
|
// with a single white space character.
|
|
|
|
const option = text.replace(/\s{2,}/g, ' ').trim();
|
|
|
|
|
2021-03-05 03:43:43 +08:00
|
|
|
if (index < optList.length) optList[index].val = option === '' ? '' : option;
|
2021-02-08 20:06:15 +08:00
|
|
|
|
2021-03-05 03:43:43 +08:00
|
|
|
this.setState({ optList });
|
2021-02-08 20:06:15 +08:00
|
|
|
}
|
|
|
|
|
2020-09-21 20:07:36 +08:00
|
|
|
handleInputChange(e, index) {
|
2020-09-22 06:52:38 +08:00
|
|
|
const { optList, type, error } = this.state;
|
2021-05-27 01:52:55 +08:00
|
|
|
const { pollTypes } = this.props;
|
2020-09-21 20:07:36 +08:00
|
|
|
const list = [...optList];
|
2020-09-22 06:52:38 +08:00
|
|
|
const validatedVal = validateInput(e.target.value).replace(/\s{2,}/g, ' ');
|
2021-05-27 01:52:55 +08:00
|
|
|
const clearError = validatedVal.length > 0 && type !== pollTypes.Response;
|
2020-09-22 06:52:38 +08:00
|
|
|
list[index] = { val: validatedVal };
|
|
|
|
this.setState({ optList: list, error: clearError ? null : error });
|
2018-09-24 06:57:03 +08:00
|
|
|
}
|
|
|
|
|
2020-09-21 20:07:36 +08:00
|
|
|
handleTextareaChange(e) {
|
2020-09-22 06:52:38 +08:00
|
|
|
const { type, error } = this.state;
|
2021-05-27 01:52:55 +08:00
|
|
|
const { pollTypes } = this.props;
|
2020-09-22 06:52:38 +08:00
|
|
|
const validatedQuestion = validateInput(e.target.value);
|
2021-05-27 01:52:55 +08:00
|
|
|
const clearError = validatedQuestion.length > 0 && type === pollTypes.Response;
|
2020-09-22 06:52:38 +08:00
|
|
|
this.setState({ question: validateInput(e.target.value), error: clearError ? null : error });
|
2020-09-21 20:07:36 +08:00
|
|
|
}
|
2018-09-24 06:57:03 +08:00
|
|
|
|
2021-04-27 07:04:34 +08:00
|
|
|
handlePollValuesText(text) {
|
|
|
|
if (text && text.length > 0) {
|
|
|
|
this.pushToCustomPollValues(text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
handleRemoveOption(index) {
|
2021-09-13 08:03:03 +08:00
|
|
|
const { intl } = this.props;
|
2021-04-27 07:04:34 +08:00
|
|
|
const { optList } = this.state;
|
|
|
|
const list = [...optList];
|
2021-09-13 08:03:03 +08:00
|
|
|
const removed = list[index];
|
2021-04-27 07:04:34 +08:00
|
|
|
list.splice(index, 1);
|
2021-09-13 08:03:03 +08:00
|
|
|
this.setState({ optList: list }, () => {
|
2021-09-13 08:11:45 +08:00
|
|
|
alertScreenReader(`${intl.formatMessage(intlMessages.removePollOpt,
|
|
|
|
{ 0: removed.val || intl.formatMessage(intlMessages.emptyPollOpt) })}`);
|
2021-09-13 08:03:03 +08:00
|
|
|
});
|
2021-04-27 07:04:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
handleAddOption() {
|
|
|
|
const { optList } = this.state;
|
|
|
|
this.setState({ optList: [...optList, { val: '' }] });
|
|
|
|
}
|
|
|
|
|
2021-04-29 23:10:18 +08:00
|
|
|
handleToggle() {
|
2021-07-03 03:58:33 +08:00
|
|
|
const { secretPoll } = this.state;
|
|
|
|
const toggledValue = !secretPoll;
|
|
|
|
Session.set('secretPoll', toggledValue);
|
|
|
|
this.setState({ secretPoll: toggledValue });
|
2021-04-29 23:10:18 +08:00
|
|
|
}
|
|
|
|
|
2021-03-30 22:33:57 +08:00
|
|
|
setOptListLength(len) {
|
|
|
|
const { optList } = this.state;
|
2021-04-27 07:04:34 +08:00
|
|
|
let diff = len > MAX_CUSTOM_FIELDS
|
|
|
|
? MAX_CUSTOM_FIELDS - optList.length
|
|
|
|
: len - optList.length;
|
|
|
|
if (diff > 0) {
|
|
|
|
while (diff > 0) {
|
2021-04-12 08:40:46 +08:00
|
|
|
this.handleAddOption();
|
2021-04-27 07:04:34 +08:00
|
|
|
diff -= 1;
|
2021-04-12 08:40:46 +08:00
|
|
|
}
|
2021-03-30 22:33:57 +08:00
|
|
|
} else {
|
2021-04-27 07:04:34 +08:00
|
|
|
while (diff < 0) {
|
2021-04-12 08:40:46 +08:00
|
|
|
this.handleRemoveOption();
|
2021-04-27 07:04:34 +08:00
|
|
|
diff += 1;
|
2021-04-12 08:40:46 +08:00
|
|
|
}
|
2021-03-30 22:33:57 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-19 04:02:46 +08:00
|
|
|
displayToggleStatus(status) {
|
|
|
|
const { intl } = this.props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<span className={styles.toggleLabel}>
|
|
|
|
{status ? intl.formatMessage(intlMessages.on)
|
|
|
|
: intl.formatMessage(intlMessages.off)}
|
|
|
|
</span>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-02-08 20:06:15 +08:00
|
|
|
pushToCustomPollValues(text) {
|
|
|
|
const lines = text.split('\n');
|
2021-03-30 22:33:57 +08:00
|
|
|
this.setOptListLength(lines.length);
|
2021-02-08 20:06:15 +08:00
|
|
|
for (let i = 0; i < MAX_CUSTOM_FIELDS; i += 1) {
|
|
|
|
let line = '';
|
|
|
|
if (i < lines.length) {
|
|
|
|
line = lines[i];
|
|
|
|
line = line.length > MAX_INPUT_CHARS ? line.substring(0, MAX_INPUT_CHARS) : line;
|
|
|
|
}
|
|
|
|
this.handleInputTextChange(i, line);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-21 20:07:36 +08:00
|
|
|
renderInputs() {
|
2021-05-27 01:52:55 +08:00
|
|
|
const { intl, pollTypes } = this.props;
|
2020-09-22 06:52:38 +08:00
|
|
|
const { optList, type, error } = this.state;
|
|
|
|
let hasVal = false;
|
2020-09-21 20:07:36 +08:00
|
|
|
return optList.map((o, i) => {
|
2020-09-22 06:52:38 +08:00
|
|
|
if (o.val.length > 0) hasVal = true;
|
2020-09-21 20:07:36 +08:00
|
|
|
const pollOptionKey = `poll-option-${i}`;
|
2018-12-18 23:15:51 +08:00
|
|
|
return (
|
2021-04-09 02:42:06 +08:00
|
|
|
<span key={pollOptionKey}>
|
2020-09-22 06:52:38 +08:00
|
|
|
<div
|
|
|
|
style={{
|
|
|
|
display: 'flex',
|
|
|
|
justifyContent: 'spaceBetween',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<input
|
|
|
|
type="text"
|
|
|
|
value={o.val}
|
|
|
|
placeholder={intl.formatMessage(intlMessages.customPlaceholder)}
|
2021-03-08 07:53:58 +08:00
|
|
|
data-test="pollOptionItem"
|
2020-09-22 06:52:38 +08:00
|
|
|
className={styles.pollOption}
|
2021-04-27 07:04:34 +08:00
|
|
|
onChange={(e) => this.handleInputChange(e, i)}
|
2020-09-22 06:52:38 +08:00
|
|
|
maxLength={MAX_INPUT_CHARS}
|
|
|
|
/>
|
2021-04-27 07:04:34 +08:00
|
|
|
{i > 1
|
|
|
|
? (
|
2021-08-11 12:10:41 +08:00
|
|
|
<>
|
|
|
|
<Button
|
|
|
|
className={styles.deleteBtn}
|
|
|
|
label={intl.formatMessage(intlMessages.delete)}
|
|
|
|
aria-describedby={`option-${i}`}
|
|
|
|
icon="delete"
|
|
|
|
data-test="deletePollOption"
|
|
|
|
hideLabel
|
|
|
|
circle
|
|
|
|
color="default"
|
|
|
|
onClick={() => {
|
|
|
|
this.handleRemoveOption(i);
|
|
|
|
}}
|
|
|
|
/>
|
2021-09-13 08:11:45 +08:00
|
|
|
<span className="sr-only" id={`option-${i}`}>
|
|
|
|
{intl.formatMessage(intlMessages.deleteRespDesc,
|
|
|
|
{ 0: (o.val || intl.formatMessage(intlMessages.emptyPollOpt)) })}
|
|
|
|
</span>
|
2021-08-11 12:10:41 +08:00
|
|
|
</>
|
2021-04-27 07:04:34 +08:00
|
|
|
)
|
2021-10-05 03:48:04 +08:00
|
|
|
: <div style={{ width: '40px', flex: 'none' }} />}
|
2020-09-22 06:52:38 +08:00
|
|
|
</div>
|
2021-05-27 01:52:55 +08:00
|
|
|
{!hasVal && type !== pollTypes.Response && error ? (
|
2020-09-22 06:52:38 +08:00
|
|
|
<div className={styles.inputError}>{error}</div>
|
|
|
|
) : (
|
|
|
|
<div className={styles.errorSpacer}> </div>
|
|
|
|
)}
|
|
|
|
</span>
|
2018-12-18 23:15:51 +08:00
|
|
|
);
|
|
|
|
});
|
2018-10-24 22:17:13 +08:00
|
|
|
}
|
|
|
|
|
2018-09-25 06:43:54 +08:00
|
|
|
renderActivePollOptions() {
|
|
|
|
const {
|
2019-05-23 02:00:44 +08:00
|
|
|
intl,
|
2019-06-28 00:46:14 +08:00
|
|
|
isMeteorConnected,
|
2019-05-23 02:00:44 +08:00
|
|
|
stopPoll,
|
|
|
|
currentPoll,
|
|
|
|
pollAnswerIds,
|
2021-04-19 21:58:33 +08:00
|
|
|
usernames,
|
2021-06-12 00:55:53 +08:00
|
|
|
isDefaultPoll,
|
2018-09-25 06:43:54 +08:00
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
2018-10-11 02:25:35 +08:00
|
|
|
<div className={styles.instructions}>
|
|
|
|
{intl.formatMessage(intlMessages.activePollInstruction)}
|
|
|
|
</div>
|
2018-10-29 23:27:50 +08:00
|
|
|
<LiveResult
|
|
|
|
{...{
|
2019-06-28 00:46:14 +08:00
|
|
|
isMeteorConnected,
|
2018-10-29 23:27:50 +08:00
|
|
|
stopPoll,
|
|
|
|
currentPoll,
|
2019-05-23 02:00:44 +08:00
|
|
|
pollAnswerIds,
|
2021-04-19 21:58:33 +08:00
|
|
|
usernames,
|
2021-06-12 00:55:53 +08:00
|
|
|
isDefaultPoll,
|
2018-10-29 23:27:50 +08:00
|
|
|
}}
|
2018-10-30 21:17:40 +08:00
|
|
|
handleBackClick={this.handleBackClick}
|
2018-10-29 23:27:50 +08:00
|
|
|
/>
|
2018-09-25 06:43:54 +08:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
renderPollOptions() {
|
2020-09-22 06:52:38 +08:00
|
|
|
const {
|
2021-04-29 23:10:18 +08:00
|
|
|
type, secretPoll, optList, question, error,
|
2020-09-22 06:52:38 +08:00
|
|
|
} = this.state;
|
2021-07-03 03:58:33 +08:00
|
|
|
const {
|
|
|
|
startPoll,
|
|
|
|
startCustomPoll,
|
|
|
|
intl,
|
|
|
|
pollTypes,
|
|
|
|
isDefaultPoll,
|
|
|
|
checkPollType,
|
2021-10-02 04:12:55 +08:00
|
|
|
smallSidebar,
|
2021-07-03 03:58:33 +08:00
|
|
|
} = this.props;
|
2021-05-27 01:52:55 +08:00
|
|
|
const defaultPoll = isDefaultPoll(type);
|
2021-10-01 02:55:46 +08:00
|
|
|
const questionPlaceholder = (type === pollTypes.Response)
|
|
|
|
? intlMessages.questionLabel
|
|
|
|
: intlMessages.optionalQuestionLabel;
|
2021-10-01 20:43:28 +08:00
|
|
|
const hasQuestionError = (type === pollTypes.Response && question.length === 0 && error);
|
2018-09-15 01:50:18 +08:00
|
|
|
return (
|
2018-09-24 06:20:20 +08:00
|
|
|
<div>
|
2020-09-21 20:07:36 +08:00
|
|
|
<div>
|
|
|
|
<textarea
|
2021-03-08 07:53:58 +08:00
|
|
|
data-test="pollQuestionArea"
|
2021-10-01 20:43:28 +08:00
|
|
|
className={
|
|
|
|
cx(styles.pollQuestion, {
|
|
|
|
[styles.hasError]: hasQuestionError,
|
|
|
|
})
|
|
|
|
}
|
2020-09-21 20:07:36 +08:00
|
|
|
value={question}
|
2021-04-27 07:04:34 +08:00
|
|
|
onChange={(e) => this.handleTextareaChange(e)}
|
2020-09-21 20:07:36 +08:00
|
|
|
rows="4"
|
|
|
|
cols="35"
|
2021-04-24 03:10:43 +08:00
|
|
|
maxLength={QUESTION_MAX_INPUT_CHARS}
|
2021-10-01 02:55:46 +08:00
|
|
|
aria-label={intl.formatMessage(questionPlaceholder)}
|
|
|
|
placeholder={intl.formatMessage(questionPlaceholder)}
|
2020-09-21 20:07:36 +08:00
|
|
|
/>
|
2021-10-01 20:43:28 +08:00
|
|
|
{hasQuestionError ? (
|
2020-09-22 06:52:38 +08:00
|
|
|
<div className={styles.inputError}>{error}</div>
|
|
|
|
) : (
|
|
|
|
<div className={styles.errorSpacer}> </div>
|
|
|
|
)}
|
2018-09-24 06:57:03 +08:00
|
|
|
</div>
|
2021-03-08 07:53:58 +08:00
|
|
|
<div data-test="responseTypes">
|
2021-10-22 20:26:04 +08:00
|
|
|
<h4 className={styles.sectionHeading}>{intl.formatMessage(intlMessages.responseTypesLabel)}</h4>
|
2020-09-21 20:07:36 +08:00
|
|
|
<div className={styles.responseType}>
|
|
|
|
<Button
|
|
|
|
label={intl.formatMessage(intlMessages.tf)}
|
2021-08-11 12:10:41 +08:00
|
|
|
aria-describedby="poll-config-button"
|
2020-09-21 20:07:36 +08:00
|
|
|
color="default"
|
|
|
|
onClick={() => {
|
|
|
|
this.setState({
|
2021-05-27 01:52:55 +08:00
|
|
|
type: pollTypes.TrueFalse,
|
2020-09-21 20:07:36 +08:00
|
|
|
optList: [
|
|
|
|
{ val: intl.formatMessage(intlMessages.true) },
|
|
|
|
{ val: intl.formatMessage(intlMessages.false) },
|
|
|
|
],
|
|
|
|
});
|
|
|
|
}}
|
2021-08-09 22:24:02 +08:00
|
|
|
className={
|
2021-08-19 03:33:32 +08:00
|
|
|
cx(styles.pBtn, {
|
2021-10-02 02:51:00 +08:00
|
|
|
[styles.selectedTypeBtn]: type === pollTypes.TrueFalse,
|
2021-10-02 04:12:55 +08:00
|
|
|
[styles.smallBtn]: !smallSidebar,
|
2021-08-09 22:24:02 +08:00
|
|
|
})
|
|
|
|
}
|
2020-09-21 20:07:36 +08:00
|
|
|
/>
|
|
|
|
<Button
|
|
|
|
label={intl.formatMessage(intlMessages.a4)}
|
2021-08-11 12:10:41 +08:00
|
|
|
aria-describedby="poll-config-button"
|
2020-09-21 20:07:36 +08:00
|
|
|
color="default"
|
|
|
|
onClick={() => {
|
|
|
|
this.setState({
|
2021-05-27 01:52:55 +08:00
|
|
|
type: pollTypes.Letter,
|
2020-09-21 20:07:36 +08:00
|
|
|
optList: [
|
|
|
|
{ val: intl.formatMessage(intlMessages.a) },
|
|
|
|
{ val: intl.formatMessage(intlMessages.b) },
|
|
|
|
{ val: intl.formatMessage(intlMessages.c) },
|
|
|
|
{ val: intl.formatMessage(intlMessages.d) },
|
|
|
|
],
|
|
|
|
});
|
|
|
|
}}
|
2021-08-09 22:24:02 +08:00
|
|
|
className={
|
2021-08-19 03:33:32 +08:00
|
|
|
cx(styles.pBtn, {
|
2021-10-02 02:51:00 +08:00
|
|
|
[styles.selectedTypeBtn]: type === pollTypes.Letter,
|
2021-10-02 04:12:55 +08:00
|
|
|
[styles.smallBtn]: !smallSidebar,
|
2021-08-09 22:24:02 +08:00
|
|
|
})
|
|
|
|
}
|
2020-09-21 20:07:36 +08:00
|
|
|
/>
|
2021-08-19 03:33:32 +08:00
|
|
|
<Button
|
|
|
|
label={intl.formatMessage(intlMessages.yna)}
|
|
|
|
aria-describedby="poll-config-button"
|
|
|
|
color="default"
|
|
|
|
onClick={() => {
|
|
|
|
this.setState({
|
|
|
|
type: pollTypes.YesNoAbstention,
|
|
|
|
optList: [
|
|
|
|
{ val: intl.formatMessage(intlMessages.yes) },
|
|
|
|
{ val: intl.formatMessage(intlMessages.no) },
|
|
|
|
{ val: intl.formatMessage(intlMessages.abstention) },
|
|
|
|
],
|
|
|
|
});
|
|
|
|
}}
|
|
|
|
className={
|
2021-08-09 22:24:02 +08:00
|
|
|
cx(styles.pBtn, styles.yna, {
|
2021-10-02 02:51:00 +08:00
|
|
|
[styles.selectedTypeBtn]: type === pollTypes.YesNoAbstention,
|
2021-08-09 22:24:02 +08:00
|
|
|
})
|
|
|
|
}
|
2021-08-19 03:33:32 +08:00
|
|
|
/>
|
|
|
|
<Button
|
|
|
|
label={intl.formatMessage(intlMessages.userResponse)}
|
|
|
|
aria-describedby="poll-config-button"
|
|
|
|
color="default"
|
|
|
|
onClick={() => { this.setState({ type: pollTypes.Response }); }}
|
|
|
|
className={
|
2021-08-09 22:24:02 +08:00
|
|
|
cx(styles.pBtn, styles.fullWidth, {
|
2021-10-02 02:51:00 +08:00
|
|
|
[styles.selectedTypeBtn]: type === pollTypes.Response,
|
2021-08-09 22:24:02 +08:00
|
|
|
})
|
|
|
|
}
|
2021-08-19 03:33:32 +08:00
|
|
|
/>
|
|
|
|
</div>
|
2018-09-24 06:57:03 +08:00
|
|
|
</div>
|
2021-08-09 22:24:02 +08:00
|
|
|
{type
|
2021-04-27 07:04:34 +08:00
|
|
|
&& (
|
|
|
|
<div data-test="responseChoices">
|
2021-10-22 20:26:04 +08:00
|
|
|
<h4 className={styles.sectionHeading}>{intl.formatMessage(intlMessages.responseChoices)}</h4>
|
2021-04-27 07:04:34 +08:00
|
|
|
{
|
2021-05-27 01:52:55 +08:00
|
|
|
type === pollTypes.Response
|
2021-04-27 07:04:34 +08:00
|
|
|
&& (
|
|
|
|
<div>
|
|
|
|
<span>{intl.formatMessage(intlMessages.typedResponseDesc)}</span>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
{
|
2021-05-27 01:52:55 +08:00
|
|
|
(defaultPoll || type === pollTypes.Response)
|
2021-04-27 07:04:34 +08:00
|
|
|
&& (
|
|
|
|
<div style={{
|
|
|
|
display: 'flex',
|
2021-08-19 04:02:46 +08:00
|
|
|
flexFlow: 'wrap',
|
2021-10-05 03:48:04 +08:00
|
|
|
flexDirection: 'column',
|
2021-04-27 07:04:34 +08:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
{defaultPoll && this.renderInputs()}
|
|
|
|
{defaultPoll
|
|
|
|
&& (
|
2020-09-21 20:07:36 +08:00
|
|
|
<Button
|
|
|
|
className={styles.addItemBtn}
|
2021-03-08 07:53:58 +08:00
|
|
|
data-test="addItem"
|
2020-09-21 20:07:36 +08:00
|
|
|
label={intl.formatMessage(intlMessages.addOptionLabel)}
|
2021-08-11 12:10:41 +08:00
|
|
|
aria-describedby="add-item-button"
|
2020-09-21 20:07:36 +08:00
|
|
|
color="default"
|
|
|
|
icon="add"
|
2021-06-18 22:02:09 +08:00
|
|
|
disabled={optList.length >= MAX_CUSTOM_FIELDS}
|
2020-09-21 20:07:36 +08:00
|
|
|
onClick={() => this.handleAddOption()}
|
|
|
|
/>
|
2021-04-27 07:04:34 +08:00
|
|
|
)}
|
2021-04-29 23:10:18 +08:00
|
|
|
<div className={styles.row}>
|
|
|
|
<div className={styles.col} aria-hidden="true">
|
2021-10-22 20:41:39 +08:00
|
|
|
<h4 className={styles.sectionHeading}>
|
2021-08-09 22:24:02 +08:00
|
|
|
{intl.formatMessage(intlMessages.secretPollLabel)}
|
2021-10-22 20:41:39 +08:00
|
|
|
</h4>
|
2021-04-29 23:10:18 +08:00
|
|
|
</div>
|
|
|
|
<div className={styles.col}>
|
2021-08-09 22:24:02 +08:00
|
|
|
{/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
|
2021-04-29 23:10:18 +08:00
|
|
|
<label className={styles.toggle}>
|
2021-08-19 04:02:46 +08:00
|
|
|
{this.displayToggleStatus(secretPoll)}
|
2021-04-29 23:10:18 +08:00
|
|
|
<Toggle
|
|
|
|
icons={false}
|
|
|
|
defaultChecked={secretPoll}
|
|
|
|
onChange={() => this.handleToggle()}
|
|
|
|
ariaLabel={intl.formatMessage(intlMessages.secretPollLabel)}
|
2021-08-19 04:02:46 +08:00
|
|
|
showToggleLabel={false}
|
2021-04-29 23:10:18 +08:00
|
|
|
/>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-10-02 01:50:48 +08:00
|
|
|
{secretPoll
|
|
|
|
&& (
|
|
|
|
<div>
|
|
|
|
{ intl.formatMessage(intlMessages.isSecretPollLabel) }
|
|
|
|
</div>
|
|
|
|
)}
|
2021-04-27 07:04:34 +08:00
|
|
|
<Button
|
|
|
|
className={styles.startPollBtn}
|
|
|
|
data-test="startPoll"
|
|
|
|
label={intl.formatMessage(intlMessages.startPollLabel)}
|
|
|
|
color="primary"
|
|
|
|
onClick={() => {
|
|
|
|
let hasVal = false;
|
|
|
|
optList.forEach((o) => {
|
|
|
|
if (o.val.length > 0) hasVal = true;
|
|
|
|
});
|
|
|
|
|
|
|
|
let err = null;
|
2021-08-09 22:24:02 +08:00
|
|
|
if (type === pollTypes.Response && question.length === 0) {
|
|
|
|
err = intl.formatMessage(intlMessages.questionErr);
|
|
|
|
}
|
|
|
|
if (!hasVal && type !== pollTypes.Response) {
|
|
|
|
err = intl.formatMessage(intlMessages.optionErr);
|
|
|
|
}
|
2021-04-27 07:04:34 +08:00
|
|
|
if (err) return this.setState({ error: err });
|
|
|
|
|
|
|
|
return this.setState({ isPolling: true }, () => {
|
2021-05-27 01:52:55 +08:00
|
|
|
const verifiedPollType = checkPollType(
|
|
|
|
type,
|
|
|
|
optList,
|
|
|
|
intl.formatMessage(intlMessages.yes),
|
|
|
|
intl.formatMessage(intlMessages.no),
|
|
|
|
intl.formatMessage(intlMessages.abstention),
|
|
|
|
intl.formatMessage(intlMessages.true),
|
2021-08-09 22:24:02 +08:00
|
|
|
intl.formatMessage(intlMessages.false),
|
2021-05-27 01:52:55 +08:00
|
|
|
);
|
2021-04-27 07:04:34 +08:00
|
|
|
const verifiedOptions = optList.map((o) => {
|
|
|
|
if (o.val.length > 0) return o.val;
|
|
|
|
return null;
|
2020-09-22 06:52:38 +08:00
|
|
|
});
|
2021-05-27 01:52:55 +08:00
|
|
|
if (verifiedPollType === pollTypes.Custom) {
|
2021-04-27 07:04:34 +08:00
|
|
|
startCustomPoll(
|
|
|
|
verifiedPollType,
|
2021-04-29 23:10:18 +08:00
|
|
|
secretPoll,
|
2021-04-27 07:04:34 +08:00
|
|
|
question,
|
|
|
|
_.compact(verifiedOptions),
|
|
|
|
);
|
|
|
|
} else {
|
2021-04-29 23:10:18 +08:00
|
|
|
startPoll(verifiedPollType, secretPoll, question);
|
2021-04-27 07:04:34 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
{
|
2021-08-09 22:24:02 +08:00
|
|
|
FILE_DRAG_AND_DROP_ENABLED
|
|
|
|
&& type !== pollTypes.Response
|
|
|
|
&& this.renderDragDrop()
|
2021-04-27 07:04:34 +08:00
|
|
|
}
|
|
|
|
</div>
|
|
|
|
)
|
2020-09-21 20:07:36 +08:00
|
|
|
}
|
2021-04-27 07:04:34 +08:00
|
|
|
</div>
|
|
|
|
)}
|
2018-09-15 01:50:18 +08:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2018-09-25 06:43:54 +08:00
|
|
|
|
2019-03-15 03:34:53 +08:00
|
|
|
renderNoSlidePanel() {
|
2021-05-11 01:34:23 +08:00
|
|
|
const { intl } = this.props;
|
2019-03-09 04:46:25 +08:00
|
|
|
return (
|
|
|
|
<div className={styles.noSlidePanelContainer}>
|
2021-10-22 20:26:04 +08:00
|
|
|
<h4 className={styles.sectionHeading}>{intl.formatMessage(intlMessages.noPresentationSelected)}</h4>
|
2019-03-09 04:46:25 +08:00
|
|
|
<Button
|
|
|
|
label={intl.formatMessage(intlMessages.clickHereToSelect)}
|
|
|
|
color="primary"
|
2021-05-11 01:34:23 +08:00
|
|
|
onClick={() => Session.set('showUploadPresentationView', true)}
|
2019-03-09 04:46:25 +08:00
|
|
|
className={styles.pollBtn}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-03-15 03:34:53 +08:00
|
|
|
renderPollPanel() {
|
2019-03-09 04:46:25 +08:00
|
|
|
const { isPolling } = this.state;
|
2018-09-25 06:43:54 +08:00
|
|
|
const {
|
2019-03-09 04:46:25 +08:00
|
|
|
currentPoll,
|
|
|
|
currentSlide,
|
2018-09-25 06:43:54 +08:00
|
|
|
} = this.props;
|
|
|
|
|
2021-05-11 01:34:23 +08:00
|
|
|
if (!currentSlide) return this.renderNoSlidePanel();
|
2019-03-09 04:46:25 +08:00
|
|
|
|
2021-08-27 21:47:58 +08:00
|
|
|
if (isPolling || currentPoll) {
|
2019-03-09 04:46:25 +08:00
|
|
|
return this.renderActivePollOptions();
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.renderPollOptions();
|
|
|
|
}
|
|
|
|
|
2021-02-08 20:06:15 +08:00
|
|
|
renderDragDrop() {
|
|
|
|
const { intl } = this.props;
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<div className={styles.instructions}>
|
|
|
|
{intl.formatMessage(intlMessages.dragDropPollInstruction)}
|
|
|
|
</div>
|
|
|
|
<DragAndDrop
|
|
|
|
{...{ intl, MAX_INPUT_CHARS }}
|
2021-04-27 07:04:34 +08:00
|
|
|
handlePollValuesText={(e) => this.handlePollValuesText(e)}
|
2021-02-08 20:06:15 +08:00
|
|
|
>
|
|
|
|
<div className={styles.dragAndDropPollContainer} />
|
|
|
|
</DragAndDrop>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-03-09 04:46:25 +08:00
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
intl,
|
|
|
|
stopPoll,
|
|
|
|
currentPoll,
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch,
|
2019-03-09 04:46:25 +08:00
|
|
|
} = this.props;
|
2018-12-18 23:15:51 +08:00
|
|
|
|
2018-09-25 06:43:54 +08:00
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<header className={styles.header}>
|
2018-10-18 22:31:17 +08:00
|
|
|
<Button
|
2019-05-07 04:18:23 +08:00
|
|
|
ref={(node) => { this.hideBtn = node; }}
|
2020-03-20 22:42:04 +08:00
|
|
|
data-test="hidePollDesc"
|
2018-10-18 22:31:17 +08:00
|
|
|
tabIndex={0}
|
2018-10-26 00:07:24 +08:00
|
|
|
label={intl.formatMessage(intlMessages.pollPaneTitle)}
|
|
|
|
icon="left_arrow"
|
2018-09-25 06:43:54 +08:00
|
|
|
aria-label={intl.formatMessage(intlMessages.hidePollDesc)}
|
2018-10-18 22:31:17 +08:00
|
|
|
className={styles.hideBtn}
|
2021-04-27 07:04:34 +08:00
|
|
|
onClick={() => {
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-05-18 04:25:07 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_IS_OPEN,
|
|
|
|
value: false,
|
|
|
|
});
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-05-18 04:25:07 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_PANEL,
|
|
|
|
value: PANELS.NONE,
|
|
|
|
});
|
2021-04-27 07:04:34 +08:00
|
|
|
}}
|
2018-10-26 00:07:24 +08:00
|
|
|
/>
|
2018-10-24 22:17:13 +08:00
|
|
|
<Button
|
2018-10-30 23:57:10 +08:00
|
|
|
label={intl.formatMessage(intlMessages.closeLabel)}
|
2019-06-26 11:03:08 +08:00
|
|
|
aria-label={`${intl.formatMessage(intlMessages.closeLabel)} ${intl.formatMessage(intlMessages.pollPaneTitle)}`}
|
2018-10-24 22:17:13 +08:00
|
|
|
onClick={() => {
|
2020-09-21 20:07:36 +08:00
|
|
|
if (currentPoll) stopPoll();
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-05-18 04:25:07 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_IS_OPEN,
|
|
|
|
value: false,
|
|
|
|
});
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-05-18 04:25:07 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_PANEL,
|
|
|
|
value: PANELS.NONE,
|
|
|
|
});
|
2018-12-18 23:15:51 +08:00
|
|
|
Session.set('forcePollOpen', false);
|
2020-01-30 02:36:17 +08:00
|
|
|
Session.set('pollInitiated', false);
|
2018-12-18 23:15:51 +08:00
|
|
|
}}
|
2018-10-24 22:17:13 +08:00
|
|
|
className={styles.closeBtn}
|
2018-10-30 00:14:05 +08:00
|
|
|
icon="close"
|
|
|
|
size="sm"
|
2018-10-30 23:57:10 +08:00
|
|
|
hideLabel
|
2018-10-24 22:17:13 +08:00
|
|
|
/>
|
2018-09-25 06:43:54 +08:00
|
|
|
</header>
|
2020-09-21 20:07:36 +08:00
|
|
|
{this.renderPollPanel()}
|
2021-08-11 12:10:41 +08:00
|
|
|
<span className="sr-only" id="poll-config-button">{intl.formatMessage(intlMessages.showRespDesc)}</span>
|
|
|
|
<span className="sr-only" id="add-item-button">{intl.formatMessage(intlMessages.addRespDesc)}</span>
|
|
|
|
<span className="sr-only" id="start-poll-button">{intl.formatMessage(intlMessages.startPollDesc)}</span>
|
2018-09-25 06:43:54 +08:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2018-09-15 01:50:18 +08:00
|
|
|
}
|
|
|
|
|
2019-03-09 04:46:25 +08:00
|
|
|
export default withModalMounter(injectIntl(Poll));
|
2018-10-16 03:58:07 +08:00
|
|
|
|
|
|
|
Poll.propTypes = {
|
|
|
|
intl: PropTypes.shape({
|
|
|
|
formatMessage: PropTypes.func.isRequired,
|
|
|
|
}).isRequired,
|
2019-08-30 00:26:07 +08:00
|
|
|
amIPresenter: PropTypes.bool.isRequired,
|
2021-05-27 01:52:55 +08:00
|
|
|
pollTypes: PropTypes.instanceOf(Object).isRequired,
|
2018-10-16 03:58:07 +08:00
|
|
|
startPoll: PropTypes.func.isRequired,
|
|
|
|
startCustomPoll: PropTypes.func.isRequired,
|
|
|
|
stopPoll: PropTypes.func.isRequired,
|
|
|
|
};
|