68 lines
1.9 KiB
JavaScript
Executable file
68 lines
1.9 KiB
JavaScript
Executable file
import React from 'react';
|
|
import PureRenderMixin from 'react-addons-pure-render-mixin';
|
|
import AppView from './AppView';
|
|
import UploadArea from './UploadArea';
|
|
import Notice from './Notice';
|
|
import AppBadge from './AppBadge';
|
|
import SoundPlayer from './SoundPlayer';
|
|
import AutoAnalytics from './AutoAnalytics';
|
|
import AuthenticationActionCreators from '../actions/AuthenticationActionCreators';
|
|
import AuthenticationStore from '../stores/AuthenticationStore';
|
|
import AuthenticationMixin from '../mixins/web/AuthenticationMixin';
|
|
import Keybinds from '../lib/Keybinds';
|
|
import DEFAULT_LAYOUT from '../keybinds/default';
|
|
import ComponentDispatchMixin from '../mixins/ComponentDispatchMixin';
|
|
import {ComponentActions} from '../Constants';
|
|
import Shakeable from './common/Shakeable';
|
|
import Layers from './Layers';
|
|
import '../styles/chat.styl';
|
|
|
|
const Chat = React.createClass({
|
|
mixins: [AuthenticationMixin, PureRenderMixin, ComponentDispatchMixin],
|
|
|
|
getSubscriptions() {
|
|
return {
|
|
[ComponentActions.SHAKE_APP]: this.shake,
|
|
};
|
|
},
|
|
|
|
shake({duration, intensity}) {
|
|
if (this.refs.shakeable) {
|
|
this.refs.shakeable.shake(duration, intensity);
|
|
}
|
|
},
|
|
|
|
componentDidMount() {
|
|
if (AuthenticationStore.isAuthenticated()) {
|
|
AuthenticationActionCreators.startSession(AuthenticationStore.getToken());
|
|
}
|
|
Keybinds.setLayout(DEFAULT_LAYOUT);
|
|
Keybinds.enable();
|
|
},
|
|
|
|
componentWillUnmount() {
|
|
Keybinds.disable();
|
|
},
|
|
|
|
render() {
|
|
return (
|
|
<Shakeable ref="shakeable" className={`app flex-vertical theme-${this.props.theme}`}>
|
|
<Notice />
|
|
<Layers className="flex-vertical flex-spacer">
|
|
<AppView />
|
|
</Layers>
|
|
<UploadArea />
|
|
<AppBadge />
|
|
<SoundPlayer />
|
|
<AutoAnalytics />
|
|
</Shakeable>
|
|
);
|
|
},
|
|
});
|
|
|
|
export default Chat;
|
|
|
|
|
|
|
|
// WEBPACK FOOTER //
|
|
// ./discord_app/components/Chat.js
|