1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- // @flow
-
- import InlineDialog from '@atlaskit/inline-dialog';
- import React from 'react';
-
- import {
- getVideoDeviceIds,
- setVideoInputDeviceAndUpdateSettings
- } from '../../../../base/devices';
- import { connect } from '../../../../base/redux';
- import { getCurrentCameraDeviceId } from '../../../../base/settings';
- import { toggleVideoSettings } from '../../../actions';
- import { getVideoSettingsVisibility } from '../../../functions';
-
- import VideoSettingsContent, { type Props as VideoSettingsProps } from './VideoSettingsContent';
-
-
- type Props = VideoSettingsProps & {
-
- /**
- * Component children (the Video button).
- */
- children: React$Node,
-
- /**
- * Flag controlling the visibility of the popup.
- */
- isOpen: boolean,
-
- /**
- * Callback executed when the popup closes.
- */
- onClose: Function,
- }
-
- /**
- * Popup with a preview of all the video devices.
- *
- * @returns {ReactElement}
- */
- function VideoSettingsPopup({
- currentCameraDeviceId,
- children,
- isOpen,
- onClose,
- setVideoInputDevice,
- videoDeviceIds
- }: Props) {
- return (
- <div className = 'video-preview'>
- <InlineDialog
- content = { <VideoSettingsContent
- currentCameraDeviceId = { currentCameraDeviceId }
- setVideoInputDevice = { setVideoInputDevice }
- toggleVideoSettings = { onClose }
- videoDeviceIds = { videoDeviceIds } /> }
- isOpen = { isOpen }
- onClose = { onClose }
- placement = 'top-end'>
- { children }
- </InlineDialog>
- </div>
- );
- }
-
- /**
- * Maps (parts of) the redux state to the associated {@code VideoSettingsPopup}'s
- * props.
- *
- * @param {Object} state - Redux state.
- * @returns {Object}
- */
- function mapStateToProps(state) {
- return {
- currentCameraDeviceId: getCurrentCameraDeviceId(state),
- isOpen: getVideoSettingsVisibility(state),
- videoDeviceIds: getVideoDeviceIds(state)
- };
- }
-
- const mapDispatchToProps = {
- onClose: toggleVideoSettings,
- setVideoInputDevice: setVideoInputDeviceAndUpdateSettings
- };
-
- export default connect(mapStateToProps, mapDispatchToProps)(VideoSettingsPopup);
|