bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/presentation/presentation-toolbar/component.jsx

272 lines
8.5 KiB
React
Raw Normal View History

import React, { Component } from 'react';
import PropTypes from 'prop-types';
2016-08-03 06:55:20 +08:00
import styles from './styles.scss';
import Button from '/imports/ui/components/button/component';
import classNames from 'classnames';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
2016-08-03 06:55:20 +08:00
const intlMessages = defineMessages({
previousSlideLabel: {
id: 'app.presentation.presentationToolbar.prevSlideLabel',
2017-04-10 23:50:03 +08:00
description: 'Previous slide button label',
},
nextSlideLabel: {
id: 'app.presentation.presentationToolbar.nextSlideLabel',
2017-04-26 22:08:47 +08:00
description: 'Next slide button label',
},
});
class PresentationToolbar extends Component {
2016-08-03 06:55:20 +08:00
constructor(props) {
super(props);
this.state = { sliderValue: 100 };
this.handleValuesChange = this.handleValuesChange.bind(this);
}
componentDidMount() {
//to let the whiteboard know that the presentation area's size has changed
window.dispatchEvent(new Event('resize'));
}
componentWillUnmount() {
//to let the whiteboard know that the presentation area's size has changed
window.dispatchEvent(new Event('resize'));
}
2016-08-03 06:55:20 +08:00
handleValuesChange(event) {
this.setState({ sliderValue: event.target.value });
}
2016-08-06 02:39:24 +08:00
fitToWidthClickHandler() {
console.log('Not implemented yet');
2016-08-03 06:55:20 +08:00
}
2016-08-06 02:39:24 +08:00
fitToScreenClickHandler() {
console.log('Not implemented yet');
2016-08-03 06:55:20 +08:00
}
renderSkipSlideOpts(numberOfSlides) {
// Fill drop down menu with all the slides in presentation
2017-06-03 03:25:02 +08:00
const optionList = [];
2016-08-03 06:55:20 +08:00
for (i = 1; i <= numberOfSlides; i++) {
optionList.push(
<option
value={i}
key={i}
>
Slide {i}
2017-06-03 03:25:02 +08:00
</option>,
2016-08-03 06:55:20 +08:00
);
}
return optionList;
}
render() {
const {
currentSlideNum,
numberOfSlides,
2016-08-06 02:39:24 +08:00
actions,
intl,
2016-08-03 06:55:20 +08:00
} = this.props;
return (
<div id="presentationToolbarWrapper" className={styles.presentationToolbarWrapper}>
2016-08-03 06:55:20 +08:00
{this.renderAriaLabelsDescs()}
2017-06-03 03:25:02 +08:00
{/* Previous Slide button*/}
2016-08-03 06:55:20 +08:00
<Button
role="button"
aria-labelledby="prevSlideLabel"
aria-describedby="prevSlideDescrip"
2017-06-03 03:25:02 +08:00
disabled={!(currentSlideNum > 1)}
2016-08-03 06:55:20 +08:00
color={'default'}
2017-03-02 09:03:02 +08:00
icon={'left_arrow'}
2016-08-03 06:55:20 +08:00
size={'md'}
2016-08-06 02:39:24 +08:00
onClick={actions.previousSlideHandler}
label={intl.formatMessage(intlMessages.previousSlideLabel)}
2017-06-03 03:25:02 +08:00
hideLabel
2016-08-03 06:55:20 +08:00
className={styles.prevSlide}
/>
2017-06-03 03:25:02 +08:00
{/* Skip Slide drop down*/}
2016-08-03 06:55:20 +08:00
<select
id="skipSlide"
role="listbox"
aria-labelledby="skipSlideLabel"
aria-describedby="skipSlideDescrip"
aria-live="polite"
aria-relevant="all"
value={currentSlideNum}
2016-08-06 02:39:24 +08:00
onChange={actions.skipToSlideHandler}
2016-08-03 06:55:20 +08:00
className={styles.skipSlide}
>
{this.renderSkipSlideOpts(numberOfSlides)}
</select>
2017-06-03 03:25:02 +08:00
{/* Next Slide button*/}
<Button
role="button"
aria-labelledby="nextSlideLabel"
aria-describedby="nextSlideDescrip"
2017-06-03 03:25:02 +08:00
disabled={!(currentSlideNum < numberOfSlides)}
color={'default'}
icon={'right_arrow'}
size={'md'}
onClick={actions.nextSlideHandler}
label={intl.formatMessage(intlMessages.nextSlideLabel)}
2017-06-03 03:25:02 +08:00
hideLabel
/>
2017-06-03 03:25:02 +08:00
{/* Fit to width button
2016-08-03 06:55:20 +08:00
<Button
role="button"
aria-labelledby="fitWidthLabel"
aria-describedby="fitWidthDescrip"
color={'default'}
2017-03-02 09:03:02 +08:00
icon={'fit_to_width'}
2016-08-03 06:55:20 +08:00
size={'md'}
circle={false}
2016-08-06 02:39:24 +08:00
onClick={this.fitToWidthClickHandler}
2016-08-03 06:55:20 +08:00
label={'Fit to Width'}
hideLabel={true}
/>*/}
2017-06-03 03:25:02 +08:00
{/* Fit to screen button
2016-08-03 06:55:20 +08:00
<Button
role="button"
aria-labelledby="fitScreenLabel"
aria-describedby="fitScreenDescrip"
color={'default'}
2017-03-02 09:03:02 +08:00
icon={'fit_to_screen'}
2016-08-03 06:55:20 +08:00
size={'md'}
circle={false}
2016-08-06 02:39:24 +08:00
onClick={this.fitToScreenClickHandler}
2016-08-03 06:55:20 +08:00
label={'Fit to Screen'}
hideLabel={true}
/>*/}
2017-06-03 03:25:02 +08:00
{/* Zoom slider
2016-08-06 02:39:24 +08:00
<div
className={classNames(styles.zoomWrapper, { [styles.zoomWrapperNoBorder]: true })}
2016-08-03 06:55:20 +08:00
>
<div className={styles.zoomMinMax}> 100% </div>
<input
role="slider"
aria-labelledby="zoomLabel"
aria-describedby="zoomDescrip"
aria-valuemax="400"
aria-valuemin="100"
aria-valuenow={this.state.sliderValue}
value={this.state.sliderValue}
step="5"
type="range"
min="100"
max="400"
onChange={this.handleValuesChange}
onInput={this.handleValuesChange}
className={styles.zoomSlider}
/>
<div className={styles.zoomMinMax}> 400% </div>
</div>*/}
2016-08-03 06:55:20 +08:00
</div>
2017-06-03 03:25:02 +08:00
);
2016-08-03 06:55:20 +08:00
}
renderAriaLabelsDescs() {
return (
2016-08-06 02:39:24 +08:00
<div hidden >
2017-06-03 03:25:02 +08:00
{/* Previous Slide button aria*/}
2016-08-06 02:39:24 +08:00
<div id="prevSlideLabel">
2016-08-03 06:55:20 +08:00
<FormattedMessage
id="app.presentation.presentationToolbar.prevSlideLabel"
2016-08-03 06:55:20 +08:00
description="Aria label for when switching to previous slide"
defaultMessage="Previous slide"
/>
2016-08-06 02:39:24 +08:00
</div>
<div id="prevSlideDescrip">
2016-08-03 06:55:20 +08:00
<FormattedMessage
id="app.presentation.presentationToolbar.prevSlideDescrip"
2016-08-03 06:55:20 +08:00
description="Aria description for when switching to previous slide"
defaultMessage="Change the presentation to the previous slide"
/>
2016-08-06 02:39:24 +08:00
</div>
2017-06-03 03:25:02 +08:00
{/* Next Slide button aria*/}
2016-08-06 02:39:24 +08:00
<div id="nextSlideLabel">
2016-08-03 06:55:20 +08:00
<FormattedMessage
id="app.presentation.presentationToolbar.nextSlideLabel"
2016-08-03 06:55:20 +08:00
description="Aria label for when switching to next slide"
defaultMessage="Next slide"
/>
2016-08-06 02:39:24 +08:00
</div>
<div id="nextSlideDescrip">
2016-08-03 06:55:20 +08:00
<FormattedMessage
id="app.presentation.presentationToolbar.nextSlideDescrip"
2016-08-03 06:55:20 +08:00
description="Aria description for when switching to next slide"
defaultMessage="Change the presentation to the next slide"
/>
2016-08-06 02:39:24 +08:00
</div>
2017-06-03 03:25:02 +08:00
{/* Skip Slide drop down aria*/}
2016-08-06 02:39:24 +08:00
<div id="skipSlideLabel">
2016-08-03 06:55:20 +08:00
<FormattedMessage
id="app.presentation.presentationToolbar.skipSlideLabel"
2016-08-03 06:55:20 +08:00
description="Aria label for when switching to a specific slide"
defaultMessage="Skip slide"
/>
2016-08-06 02:39:24 +08:00
</div>
<div id="skipSlideDescrip">
2016-08-03 06:55:20 +08:00
<FormattedMessage
id="app.presentation.presentationToolbar.skipSlideDescrip"
2016-08-03 06:55:20 +08:00
description="Aria description for when switching to a specific slide"
defaultMessage="Change the presentation to a specific slide"
/>
2016-08-06 02:39:24 +08:00
</div>
2017-06-03 03:25:02 +08:00
{/* Fit to width button aria*/}
2016-08-06 02:39:24 +08:00
<div id="fitWidthLabel">
2016-08-03 06:55:20 +08:00
<FormattedMessage
id="app.presentation.presentationToolbar.fitWidthLabel"
2016-08-03 06:55:20 +08:00
description="Aria description to display the whole width of the slide"
defaultMessage="Fit to width"
/>
2016-08-06 02:39:24 +08:00
</div>
<div id="fitWidthDescrip">
2016-08-03 06:55:20 +08:00
<FormattedMessage
id="app.presentation.presentationToolbar.fitWidthDescrip"
2016-08-03 06:55:20 +08:00
description="Aria description to display the whole width of the slide"
defaultMessage="Display the whole width of the slide"
/>
2016-08-06 02:39:24 +08:00
</div>
2017-06-03 03:25:02 +08:00
{/* Fit to screen button aria*/}
2016-08-06 02:39:24 +08:00
<div id="fitScreenLabel">
2016-08-03 06:55:20 +08:00
<FormattedMessage
id="app.presentation.presentationToolbar.fitScreenLabel"
2016-08-03 06:55:20 +08:00
description="Aria label to display the whole slide"
defaultMessage="Fit to screen"
/>
2016-08-06 02:39:24 +08:00
</div>
<div id="fitScreenDescrip">
2016-08-03 06:55:20 +08:00
<FormattedMessage
id="app.presentation.presentationToolbar.fitScreenDescrip"
2016-08-03 06:55:20 +08:00
description="Aria label to display the whole slide"
defaultMessage="Display the whole slide"
/>
2016-08-06 02:39:24 +08:00
</div>
2017-06-03 03:25:02 +08:00
{/* Zoom slider aria*/}
2016-08-06 02:39:24 +08:00
<div id="zoomLabel">
2016-08-03 06:55:20 +08:00
<FormattedMessage
id="app.presentation.presentationToolbar.zoomLabel"
2016-08-03 06:55:20 +08:00
description="Aria label to zoom presentation"
defaultMessage="Zoom"
/>
2016-08-06 02:39:24 +08:00
</div>
<div id="zoomDescrip">
2016-08-03 06:55:20 +08:00
<FormattedMessage
id="app.presentation.presentationToolbar.zoomDescrip"
2016-08-03 06:55:20 +08:00
description="Aria label to zoom presentation"
defaultMessage="Change the zoom level of the presentation"
/>
2016-08-06 02:39:24 +08:00
</div>
2016-08-03 06:55:20 +08:00
</div>
);
}
}
export default injectIntl(PresentationToolbar);