fix polling component

This commit is contained in:
Michael Zinsmeister 2021-05-01 22:50:24 +02:00
parent 5ca831ff86
commit efbc990c44

View File

@ -107,7 +107,6 @@ class Polling extends Component {
}
}
renderButtonAnswers(pollAnswerStyles) {
const {
isMeteorConnected,
@ -118,30 +117,16 @@ class Polling extends Component {
pollAnswerIds,
} = this.props;
const { question } = poll;
const {
typedAns,
} = this.state;
const { typedAns } = this.state;
if (!poll) return null;
const { stackOptions, answers, question } = poll;
return (
<div className={styles.overlay}>
<div
data-test="pollingContainer"
className={cx({
[styles.pollingContainer]: true,
[styles.autoWidth]: stackOptions,
})}
role="alert"
>
{
question.length > 0 && (
<span className={styles.qHeader}>
<div className={styles.qTitle}>
{intl.formatMessage(intlMessages.pollQestionTitle)}
</div>
<div data-test="pollQuestion" className={styles.qText}>{question}</div>
</span>
)
}
<div>
{
poll.pollType !== 'RP' && (
<span>
@ -173,7 +158,7 @@ class Polling extends Component {
size="md"
label={label}
key={pollAnswer.key}
onClick={() => handleVote(poll.pollId, pollAnswer)}
onClick={() => handleVote(poll.pollId, [pollAnswer.id])}
aria-labelledby={`pollAnswerLabel${pollAnswer.key}`}
aria-describedby={`pollAnswerDesc${pollAnswer.key}`}
data-test="pollAnswerOption"
@ -231,10 +216,8 @@ class Polling extends Component {
)
}
</div>
</div>
);
}
}
renderCheckboxAnswers(pollAnswerStyles) {
const {
@ -252,8 +235,7 @@ class Polling extends Component {
<div className={styles.pollingTitle}>
{intl.formatMessage(intlMessages.pollingTitleLabel)}
</div>
)
}
)}
{/* <div className={cx(pollAnswerStyles)}> */}
<table className={styles.multipleResponseAnswersTable}>
{poll.answers.map((pollAnswer) => {
@ -335,11 +317,15 @@ class Polling extends Component {
})}
role="alert"
>
{question.length > 0 && (
{
question.length > 0 && (
<span className={styles.qHeader}>
<div className={styles.qTitle}>{intl.formatMessage(intlMessages.pollQestionTitle)}</div>
<div className={styles.qTitle}>
{intl.formatMessage(intlMessages.pollQestionTitle)}
</div>
<div data-test="pollQuestion" className={styles.qText}>{question}</div>
</span>)
</span>
)
}
{poll.isMultipleResponse ? this.renderCheckboxAnswers(pollAnswerStyles) : this.renderButtonAnswers(pollAnswerStyles)}
</div>