mattermost-mobile/app/components/sidebars/settings/status_label/status_label.js
Miguel Alatzar 2d81b497cf [MM-23520] Port mattermost-redux (#4088)
* Remove mattermost-redux

* Move mm-redux files into app/redux

* Add @redux path to tsconfig.json

* Fix imports

* Install missing dependencies

* Fix tsc errors

* Fix i18n_utils test

* Fix more imports

* Remove redux websocket

* Fix tests

* Rename @redux

* Apply changes from mattermost-redux PR 1103

* Remove mattermost-redux mention in template

* Add missing imports

* Rename app/redux/ to app/mm-redux/

* Remove test file

* Fix fetching Sidebar GM profiles

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
2020-04-17 21:12:09 -07:00

69 lines
1.9 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {General} from '@mm-redux/constants';
import FormattedText from 'app/components/formatted_text';
import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
export default class UserInfo extends PureComponent {
static propTypes = {
status: PropTypes.string,
theme: PropTypes.object.isRequired,
};
static defaultProps = {
status: General.OFFLINE,
};
render() {
const {status, theme} = this.props;
const style = getStyleSheet(theme);
let i18nId = t('status_dropdown.set_offline');
let defaultMessage = 'Offline';
switch (status) {
case General.AWAY:
i18nId = t('status_dropdown.set_away');
defaultMessage = 'Away';
break;
case General.DND:
i18nId = t('status_dropdown.set_dnd');
defaultMessage = 'Do Not Disturb';
break;
case General.ONLINE:
i18nId = t('status_dropdown.set_online');
defaultMessage = 'Online';
break;
}
if (status === General.OUT_OF_OFFICE) {
i18nId = t('status_dropdown.set_ooo');
defaultMessage = 'Out Of Office';
}
return (
<FormattedText
id={i18nId}
defaultMessage={defaultMessage}
style={style.label}
/>
);
}
}
const getStyleSheet = makeStyleSheetFromTheme((theme) => {
return {
label: {
color: changeOpacity(theme.centerChannelColor, 0.5),
flex: 1,
fontSize: 17,
textAlignVertical: 'center',
includeFontPadding: false,
},
};
});