Merge pull request #3730 from KDSBrowne/action-buttons-center

Actions Bar Positioning
This commit is contained in:
Anton Georgiev 2017-03-21 12:18:46 -04:00 committed by GitHub
commit 5575d32438
7 changed files with 48 additions and 35 deletions

View File

@ -18,17 +18,17 @@ const intlMessages = defineMessages({
class JoinAudioOptions extends React.Component { class JoinAudioOptions extends React.Component {
render() { render() {
const { const {
close,
intl, intl,
isInAudio, isInAudio,
isInListenOnly, isInListenOnly,
open, handleJoinAudio,
handleCloseAudio,
} = this.props; } = this.props;
if (isInAudio || isInListenOnly) { if (isInAudio || isInListenOnly) {
return ( return (
<Button <Button
onClick={close} onClick={handleCloseAudio}
label={intl.formatMessage(intlMessages.leaveAudio)} label={intl.formatMessage(intlMessages.leaveAudio)}
color={'danger'} color={'danger'}
icon={'audio_off'} icon={'audio_off'}
@ -40,7 +40,7 @@ class JoinAudioOptions extends React.Component {
return ( return (
<Button <Button
onClick={open} onClick={handleJoinAudio}
label={intl.formatMessage(intlMessages.joinAudio)} label={intl.formatMessage(intlMessages.joinAudio)}
color={'primary'} color={'primary'}
icon={'audio_on'} icon={'audio_on'}

View File

@ -20,7 +20,7 @@ export default createContainer((params) => {
return { return {
isInAudio: user.voiceUser.joined, isInAudio: user.voiceUser.joined,
isInListenOnly: user.listenOnly, isInListenOnly: user.listenOnly,
open: params.open, handleJoinAudio: params.handleJoinAudio,
close: params.close, handleCloseAudio: params.handleCloseAudio,
}; };
}, JoinAudioOptionsContainer); }, JoinAudioOptionsContainer);

View File

@ -1,15 +1,10 @@
import React, { Component, PropTypes } from 'react'; import React, { Component, PropTypes } from 'react';
import { showModal } from '/imports/ui/components/app/service';
import Audio from '/imports/ui/components/audio-modal/component';
import Button from '/imports/ui/components/button/component'; import Button from '/imports/ui/components/button/component';
import styles from './styles.scss'; import styles from './styles.scss';
import EmojiContainer from './emoji-menu/container'; import EmojiContainer from './emoji-menu/container';
import ActionsDropdown from './actions-dropdown/component'; import ActionsDropdown from './actions-dropdown/component';
import Auth from '/imports/ui/services/auth/index';
import Users from '/imports/api/users/index';
import JoinAudioOptionsContainer from './audio-menu/container'; import JoinAudioOptionsContainer from './audio-menu/container';
import MuteAudioContainer from './mute-button/container'; import MuteAudioContainer from './mute-button/container';
import { exitAudio } from '/imports/api/phone';
import JoinVideo from './video-button/component'; import JoinVideo from './video-button/component';
export default class ActionsBar extends Component { export default class ActionsBar extends Component {
@ -17,10 +12,6 @@ export default class ActionsBar extends Component {
super(props); super(props);
} }
openJoinAudio() {
return showModal(<Audio handleJoinListenOnly={this.props.handleJoinListenOnly} />)
}
renderForPresenter() { renderForPresenter() {
return ( return (
<div className={styles.actionsbar}> <div className={styles.actionsbar}>
@ -30,14 +21,15 @@ export default class ActionsBar extends Component {
<div className={styles.center}> <div className={styles.center}>
<MuteAudioContainer /> <MuteAudioContainer />
<JoinAudioOptionsContainer <JoinAudioOptionsContainer
open={this.openJoinAudio.bind(this)} handleJoinAudio={this.props.handleOpenJoinAudio}
close={() => {exitAudio();}} handleCloseAudio={this.props.handleExitAudio}
/> />
{/*<JoinVideo />*/} {/*<JoinVideo />*/}
<EmojiContainer /> <EmojiContainer />
</div> </div>
<div className={styles.right}> <div className={styles.hidden}>
<ActionsDropdown />
</div> </div>
</div> </div>
); );
@ -49,15 +41,13 @@ export default class ActionsBar extends Component {
<div className={styles.center}> <div className={styles.center}>
<MuteAudioContainer /> <MuteAudioContainer />
<JoinAudioOptionsContainer <JoinAudioOptionsContainer
open={this.openJoinAudio.bind(this)} handleJoinAudio={this.props.handleOpenJoinAudio}
close={() => {exitAudio();}} handleCloseAudio={this.props.handleExitAudio}
/> />
{/*<JoinVideo />*/} {/*<JoinVideo />*/}
<EmojiContainer /> <EmojiContainer />
</div> </div>
<div className={styles.right}>
</div>
</div> </div>
); );
} }

View File

@ -1,8 +1,7 @@
import React, { Component, PropTypes } from 'react'; import React, { Component } from 'react';
import { createContainer } from 'meteor/react-meteor-data'; import { createContainer } from 'meteor/react-meteor-data';
import ActionsBar from './component'; import ActionsBar from './component';
import Service from './service'; import Service from './service';
import { joinListenOnly } from '/imports/api/phone';
class ActionsBarContainer extends Component { class ActionsBarContainer extends Component {
constructor(props) { constructor(props) {
@ -10,19 +9,23 @@ class ActionsBarContainer extends Component {
} }
render() { render() {
const handleJoinListenOnly = () => joinListenOnly();
return ( return (
<ActionsBar <ActionsBar
handleJoinListenOnly={handleJoinListenOnly} {...this.props}>
{...this.props}> {this.props.children}
{this.props.children}
</ActionsBar> </ActionsBar>
); );
} }
} }
export default createContainer(() => { export default createContainer(() => {
let data = Service.isUserPresenter(); const isPresenter = Service.isUserPresenter();
return data; const handleExitAudio = () => Service.handleExitAudio();
const handleOpenJoinAudio = () => Service.handleJoinAudio();
return {
isUserPresenter: isPresenter,
handleExitAudio: handleExitAudio,
handleOpenJoinAudio: handleOpenJoinAudio,
};
}, ActionsBarContainer); }, ActionsBarContainer);

View File

@ -6,10 +6,13 @@ export default class MuteAudio extends React.Component {
render() { render() {
const { isInAudio, isMuted, callback, isTalking} = this.props; const { isInAudio, isMuted, callback, isTalking} = this.props;
if (!isInAudio) return null;
let label = !isMuted ? 'Mute' : 'Unmute'; let label = !isMuted ? 'Mute' : 'Unmute';
let icon = !isMuted ? 'unmute' : 'mute'; let icon = !isMuted ? 'unmute' : 'mute';
let className = !isInAudio ? styles.invisible : null;
let tabIndex = !isInAudio ? -1 : 0; let tabIndex = !isInAudio ? -1 : 0;
let className = null;
if (isInAudio && isTalking) { if (isInAudio && isTalking) {
className = styles.circleGlow; className = styles.circleGlow;

View File

@ -1,5 +1,9 @@
import AuthSingleton from '/imports/ui/services/auth/index.js'; import AuthSingleton from '/imports/ui/services/auth/index.js';
import Users from '/imports/api/users'; import Users from '/imports/api/users';
import { joinListenOnly } from '/imports/api/phone';
import { showModal } from '/imports/ui/components/app/service';
import { exitAudio } from '/imports/api/phone';
import Audio from '/imports/ui/components/audio-modal/component';
let isUserPresenter = () => { let isUserPresenter = () => {
@ -13,6 +17,17 @@ let isUserPresenter = () => {
}; };
}; };
const handleExitAudio = () => {
return exitAudio();
}
const handleJoinAudio = () => {
const handleJoinListenOnly = () => joinListenOnly();
return showModal(<Audio handleJoinListenOnly={handleJoinListenOnly} />);
}
export default { export default {
isUserPresenter, isUserPresenter,
handleJoinAudio,
handleExitAudio,
}; };

View File

@ -7,7 +7,8 @@
.left, .left,
.right, .right,
.center { .center,
.hidden {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
@ -19,7 +20,8 @@
} }
.left, .left,
.right { .right,
.hidden {
flex: 0; flex: 0;
} }
@ -27,7 +29,7 @@
flex: 1; flex: 1;
} }
.invisible { .hidden {
visibility: hidden; visibility: hidden;
} }