Skip to content

Commit

Permalink
feat(polls/web): removed sort options from polls (#12641)
Browse files Browse the repository at this point in the history
* feat(polls/web): removed sort options from polls
  • Loading branch information
Calinteodor committed Dec 5, 2022
1 parent 46cc2e3 commit 2ad2e6f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 51 deletions.
7 changes: 0 additions & 7 deletions css/_polls.scss
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,6 @@ ol.poll-result-list {
display: flex;
}

.poll-dragged {
opacity: 0.5;
* {
cursor: grabbing !important;
}
}

.poll-question {
font-size: 16px;
font-weight: 600;
Expand Down
46 changes: 2 additions & 44 deletions react/features/polls/components/web/PollCreate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import React, { useCallback, useEffect, useRef, useState } from 'react';
import { makeStyles } from 'tss-react/mui';

import Icon from '../../../base/icons/components/Icon';
import { IconBurger } from '../../../base/icons/svg';
// @ts-ignore
import { Tooltip } from '../../../base/tooltip';
import Button from '../../../base/ui/components/web/Button';
Expand All @@ -26,7 +24,6 @@ const PollCreate = ({
addAnswer,
answers,
isSubmitDisabled,
moveAnswer,
onSubmit,
question,
removeAnswer,
Expand Down Expand Up @@ -142,37 +139,6 @@ const PollCreate = ({
}
}, [ answers, addAnswer, removeAnswer, requestFocus ]);

const [ grabbing, setGrabbing ] = useState(null);

const interchangeHeights = (i: number, j: number) => {
const h = answerInputs.current[i].scrollHeight;

answerInputs.current[i].style.height = `${answerInputs.current[j].scrollHeight}px`;
answerInputs.current[j].style.height = `${h}px`;
};

const onGrab = useCallback((i, ev) => {
if (ev.button !== 0) {
return;
}
setGrabbing(i);
window.addEventListener('mouseup', () => {
setGrabbing(_grabbing => {
requestFocus(_grabbing);

return null;
});
}, { once: true });
}, []);

const onMouseOver = useCallback(i => {
if (grabbing !== null && grabbing !== i) {
interchangeHeights(i, grabbing);
moveAnswer(grabbing, i);
setGrabbing(i);
}
}, []);

const autogrow = (ev: React.ChangeEvent<HTMLTextAreaElement>) => {
const el = ev.target;

Expand Down Expand Up @@ -207,9 +173,8 @@ const PollCreate = ({
<ol className = 'poll-answer-field-list'>
{answers.map((answer: any, i: number) =>
(<li
className = { `poll-answer-field${grabbing === i ? ' poll-dragged' : ''}` }
key = { i }
onMouseOver = { () => onMouseOver(i) }>
className = 'poll-answer-field'
key = { i }>
<span className = 'poll-create-label'>
{ t('polls.create.pollOption', { index: i + 1 })}
</span>
Expand All @@ -225,13 +190,6 @@ const PollCreate = ({
required = { true }
rows = { 1 }
value = { answer } />
<button
className = 'poll-drag-handle'
onMouseDown = { ev => onGrab(i, ev) }
tabIndex = { -1 }
type = 'button'>
<Icon src = { IconBurger } />
</button>
</div>

{ answers.length > 2
Expand Down

0 comments on commit 2ad2e6f

Please sign in to comment.