Move Polling to above slides/webcams and change swapLayout constraints. Closes #5359

This commit is contained in:
Oswaldo Acauan 2018-04-17 14:55:07 -03:00
parent 98eea06d72
commit c688eb23ca
7 changed files with 24 additions and 9 deletions

View File

@ -1,8 +1,10 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import cx from 'classnames'; import cx from 'classnames';
import VideoProviderContainer from '/imports/ui/components/video-provider/container';
import PollingContainer from '/imports/ui/components/polling/container';
import { styles } from './styles'; import { styles } from './styles';
import VideoProviderContainer from '../video-provider/container';
const propTypes = { const propTypes = {
children: PropTypes.element.isRequired, children: PropTypes.element.isRequired,
@ -44,6 +46,7 @@ export default class Media extends Component {
<div className={!swapLayout ? overlayClassName : contentClassName}> <div className={!swapLayout ? overlayClassName : contentClassName}>
{ !disableVideo ? <VideoProviderContainer /> : null } { !disableVideo ? <VideoProviderContainer /> : null }
</div> </div>
<PollingContainer />
</div> </div>
); );
} }

View File

@ -66,7 +66,7 @@ export default withTracker(() => {
} }
data.isScreensharing = MediaService.isVideoBroadcasting(); data.isScreensharing = MediaService.isVideoBroadcasting();
data.swapLayout = getSwapLayout() && usersVideo.length > 0 && viewParticipantsWebcams; data.swapLayout = getSwapLayout();
data.disableVideo = !viewParticipantsWebcams; data.disableVideo = !viewParticipantsWebcams;
if (data.swapLayout) { if (data.swapLayout) {

View File

@ -2,6 +2,9 @@ import Presentations from '/imports/api/presentations';
import { isVideoBroadcasting } from '/imports/ui/components/screenshare/service'; import { isVideoBroadcasting } from '/imports/ui/components/screenshare/service';
import Auth from '/imports/ui/services/auth'; import Auth from '/imports/ui/services/auth';
import Users from '/imports/api/users'; import Users from '/imports/api/users';
import Settings from '/imports/ui/services/settings';
import VideoService from '/imports/ui/components/video-provider/service';
import PollingService from '/imports/ui/components/polling/service';
const getPresentationInfo = () => { const getPresentationInfo = () => {
const currentPresentation = Presentations.findOne({ const currentPresentation = Presentations.findOne({
@ -37,9 +40,20 @@ const toggleSwapLayout = () => {
swapLayout.tracker.changed(); swapLayout.tracker.changed();
}; };
export const shouldEnableSwapLayout = () => {
const { viewParticipantsWebcams } = Settings.dataSaving;
const usersVideo = VideoService.getAllUsersVideo();
const poll = PollingService.mapPolls();
return usersVideo.length > 0 // prevent swap without any webcams
&& viewParticipantsWebcams // prevent swap when dataSaving for webcams is enabled
&& !poll.pollExists; // prevent swap when there is a poll running
};
export const getSwapLayout = () => { export const getSwapLayout = () => {
swapLayout.tracker.depend(); swapLayout.tracker.depend();
return swapLayout.value;
return swapLayout.value && shouldEnableSwapLayout();
}; };
export default { export default {
@ -50,4 +64,5 @@ export default {
isUserPresenter, isUserPresenter,
isVideoBroadcasting, isVideoBroadcasting,
toggleSwapLayout, toggleSwapLayout,
shouldEnableSwapLayout,
}; };

View File

@ -25,11 +25,11 @@
display: flex; display: flex;
order: 1; order: 1;
width: 100%; width: 100%;
padding: 0 5px 5px; border: 5px solid transparent;
position: relative; position: relative;
@include mq($medium-up) { @include mq($medium-up) {
padding: 0 10px 10px; border: 10px solid transparent;
} }
} }

View File

@ -36,7 +36,7 @@ const Polling = ({ intl, poll, handleVote }) => (
<Button <Button
className={styles.pollingButton} className={styles.pollingButton}
color="default" color="default"
size="lg" size="md"
label={pollAnswer.key} label={pollAnswer.key}
onClick={() => handleVote(poll.pollId, pollAnswer)} onClick={() => handleVote(poll.pollId, pollAnswer)}
aria-labelledby={`pollAnswerLabel${pollAnswer.key}`} aria-labelledby={`pollAnswerLabel${pollAnswer.key}`}

View File

@ -4,7 +4,6 @@
order: 2; order: 2;
width: 100%; width: 100%;
display: flex; display: flex;
padding: .8rem;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
} }

View File

@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
import { TransitionGroup, CSSTransition } from 'react-transition-group'; import { TransitionGroup, CSSTransition } from 'react-transition-group';
import WhiteboardOverlayContainer from '/imports/ui/components/whiteboard/whiteboard-overlay/container'; import WhiteboardOverlayContainer from '/imports/ui/components/whiteboard/whiteboard-overlay/container';
import WhiteboardToolbarContainer from '/imports/ui/components/whiteboard/whiteboard-toolbar/container'; import WhiteboardToolbarContainer from '/imports/ui/components/whiteboard/whiteboard-toolbar/container';
import PollingContainer from '/imports/ui/components/polling/container';
import CursorWrapperContainer from './cursor/cursor-wrapper-container/container'; import CursorWrapperContainer from './cursor/cursor-wrapper-container/container';
import AnnotationGroupContainer from '../whiteboard/annotation-group/container'; import AnnotationGroupContainer from '../whiteboard/annotation-group/container';
import PresentationToolbarContainer from './presentation-toolbar/container'; import PresentationToolbarContainer from './presentation-toolbar/container';
@ -295,7 +294,6 @@ export default class PresentationArea extends Component {
this.renderWhiteboardToolbar() this.renderWhiteboardToolbar()
: null } : null }
</div> </div>
<PollingContainer />
{this.renderPresentationToolbar()} {this.renderPresentationToolbar()}
</div> </div>
); );