58 lines
1.7 KiB
JavaScript
Executable file
58 lines
1.7 KiB
JavaScript
Executable file
/* @flow */
|
|
|
|
import React from 'react';
|
|
import Flux from '../lib/flux';
|
|
import * as PictureInPictureActionCreators from '../actions/PictureInPictureActionCreators';
|
|
import PictureInPictureVideo from './calls/PictureInPictureVideo';
|
|
import PictureInPicture from '../uikit/PictureInPicture';
|
|
import PictureInPictureStore from '../stores/PictureInPictureStore';
|
|
import PictureInPictureVideoStore from '../stores/views/PictureInPictureVideoStore';
|
|
import UserSettingsStore from '../stores/UserSettingsStore';
|
|
import WindowStore from '../stores/WindowStore';
|
|
import {PictureInPictureComponents as ComponentKeys} from '../Constants';
|
|
|
|
const PictureInPictureComponents = {
|
|
[ComponentKeys.VIDEO]: {component: PictureInPictureVideo, store: PictureInPictureVideoStore},
|
|
};
|
|
|
|
class PictureInPictureContainer extends React.PureComponent {
|
|
constructor(props) {
|
|
super(props);
|
|
|
|
(this: any).handleWindowMove = this.handleWindowMove.bind(this);
|
|
}
|
|
|
|
render() {
|
|
const {windows, maxX, maxY, theme} = this.props;
|
|
|
|
return (
|
|
<PictureInPicture
|
|
pictureInPictureComponents={PictureInPictureComponents}
|
|
windows={windows}
|
|
maxX={maxX}
|
|
maxY={maxY}
|
|
theme={theme}
|
|
onWindowMove={this.handleWindowMove}
|
|
/>
|
|
);
|
|
}
|
|
|
|
handleWindowMove(id, position) {
|
|
PictureInPictureActionCreators.moveTo(id, position);
|
|
}
|
|
}
|
|
|
|
export default Flux.connectStores([PictureInPictureStore, WindowStore, UserSettingsStore], () => {
|
|
const windowSize = WindowStore.windowSize();
|
|
return {
|
|
windows: PictureInPictureStore.windows,
|
|
maxX: windowSize.width,
|
|
maxY: windowSize.height,
|
|
theme: UserSettingsStore.theme,
|
|
};
|
|
})(PictureInPictureContainer);
|
|
|
|
|
|
|
|
// WEBPACK FOOTER //
|
|
// ./discord_app/components/PictureInPicture.js
|