import React from 'react';
import Flux from '../lib/flux';
import {Helmet} from 'react-helmet';
import classNames from 'classnames';
import {DragDropContext} from 'react-dnd';
import HTML5Backend from 'react-dnd-html5-backend';
import PureRenderMixin from 'react-addons-pure-render-mixin';
import UserSettingsStore from '../stores/UserSettingsStore';
import AccessibilityStore from '../stores/AccessibilityStore';
import NativeUtils from '../utils/NativeUtils';
import Connecting from './Connecting';
import Overlay from './overlay/Overlay';
import PictureInPicture from './PictureInPicture';
import Popouts from './Popouts';
import Tooltips from './Tooltips';
import NativeButtons from './NativeButtons';
import TutorialIndicators from './TutorialIndicators';
import Modals from './Modals';
import IncomingCalls from './IncomingCalls';
import ContextMenu from './common/ContextMenu';
import TransitionGroup from '../lib/transitions/TransitionGroup';
export const AppOverlay = DragDropContext(HTML5Backend)(
React.createClass({
render() {
return (
);
},
})
);
export const App = DragDropContext(HTML5Backend)(
React.createClass({
mixins: [Flux.StoreListenerMixin(AccessibilityStore, UserSettingsStore), PureRenderMixin],
getStateFromStores() {
return {
locale: UserSettingsStore.locale,
theme: UserSettingsStore.theme,
fontScale: AccessibilityStore.fontScale,
fontScaleClass: AccessibilityStore.fontScaleClass,
};
},
componentWillMount() {
NativeUtils.setZoomFactor(AccessibilityStore.zoom);
},
render() {
const {theme, locale, fontScale, fontScaleClass} = this.state;
const className = classNames(fontScaleClass, {
'platform-win': NativeUtils.isWindows(),
'platform-osx': NativeUtils.isOSX(),
'platform-linux': NativeUtils.isLinux(),
});
return (
{React.cloneElement(this.props.children, {theme})}
);
},
})
);
// Used to transition between the welcome and app views
export const AppTransition = ({children, ...props}) => {
const childElement = React.Children.only(children);
const key = childElement.type.displayName;
const clonedElement = React.cloneElement(childElement, {...props, key});
return (
{clonedElement}
);
};
// WEBPACK FOOTER //
// ./discord_app/components/App.js