* added MENU_ITEM_HEIGHT to constant/view * fix user presence and your profile * added MENU_ITEM_HEIGHT to constant/view * fix user presence and your profile * UI Polish - Custom Status * UI Polish - Settings * UI Polish - logout * refactored styles * removed 'throws DataOperatorException' from './database/` * fix for copy link option * fix autoresponder 1. user should be allowed to enter paragraph 2. the OOO was not immediately being updated on the notification main screen. The fix is to cal fetchStatusInBatch after the updateMe operation * About Screen - code clean up * removed MenuItem component from common_post_options * removed MenuItem from Settings * refactored show_more and recent_item * removed menu_item component * Update setting_container.tsx * PR review correction * Update setting_container.tsx * Update recent_item.tsx
67 lines
1.9 KiB
TypeScript
67 lines
1.9 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import React from 'react';
|
|
import {StyleProp, TextStyle} from 'react-native';
|
|
|
|
import FormattedText from '@components/formatted_text';
|
|
import {General} from '@constants';
|
|
import {useTheme} from '@context/theme';
|
|
import {t} from '@i18n';
|
|
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme';
|
|
import {typography} from '@utils/typography';
|
|
|
|
type StatusLabelProps = {
|
|
status?: string;
|
|
labelStyle?: StyleProp<TextStyle>;
|
|
}
|
|
|
|
const getStyleSheet = makeStyleSheetFromTheme((theme) => {
|
|
return {
|
|
label: {
|
|
color: changeOpacity(theme.centerChannelColor, 0.5),
|
|
...typography('Body', 200),
|
|
textAlignVertical: 'center',
|
|
includeFontPadding: false,
|
|
},
|
|
};
|
|
});
|
|
|
|
const StatusLabel = ({status = General.OFFLINE, labelStyle}: StatusLabelProps) => {
|
|
const theme = useTheme();
|
|
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, labelStyle]}
|
|
testID={`user_status.label.${status}`}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default StatusLabel;
|