2017-06-08_509bba0/509bba0_unpacked_with_node_modules/discord_app/components/StatusPickerPopout.js
2022-07-26 10:06:20 -07:00

50 lines
1.8 KiB
JavaScript
Executable file

/* @flow */
import React from 'react';
import PureRenderMixin from 'react-addons-pure-render-mixin';
import i18n from '../i18n';
import {StatusTypes} from '../Constants';
import UserSettingsActionCreators from '../actions/UserSettingsActionCreators';
import PopoutMenu, {PopoutMenuItem, PopoutMenuSeparator} from './common/PopoutMenu';
const StatusItem = ({status, text, children, onSelect}) =>
<PopoutMenuItem onClick={() => onSelect(status)}>
<div className="status-icon-text">
<span className={`status status-${status}`} style={{marginRight: 14}} />
<div className="status-text">{text}</div>
</div>
{children}
</PopoutMenuItem>;
const StatusPickerPopout = React.createClass({
mixins: [PureRenderMixin],
handleSelect(status: string) {
UserSettingsActionCreators.updateRemoteSettings({status});
this.props.onClose();
},
render() {
const {...props} = this.props;
return (
<PopoutMenu className="status-picker" {...props}>
<StatusItem status={StatusTypes.ONLINE} onSelect={this.handleSelect} text={i18n.Messages.STATUS_ONLINE} />
<PopoutMenuSeparator />
<StatusItem status={StatusTypes.IDLE} onSelect={this.handleSelect} text={i18n.Messages.STATUS_IDLE} />
<StatusItem status={StatusTypes.DND} onSelect={this.handleSelect} text={i18n.Messages.STATUS_DND}>
<div className="helper">{i18n.Messages.STATUS_DND_HELP}</div>
</StatusItem>
<StatusItem status={StatusTypes.INVISIBLE} onSelect={this.handleSelect} text={i18n.Messages.STATUS_INVISIBLE}>
<div className="helper">{i18n.Messages.STATUS_INVISIBLE_HELPER}</div>
</StatusItem>
</PopoutMenu>
);
},
});
export default StatusPickerPopout;
// WEBPACK FOOTER //
// ./discord_app/components/StatusPickerPopout.js