Rocket.Chat.ReactNative/app/views/RoomView/Header/Icon.js

75 lines
1.5 KiB
JavaScript
Raw Normal View History

2019-03-27 20:06:57 +00:00
import React from 'react';
import { StyleSheet } from 'react-native';
import PropTypes from 'prop-types';
2019-12-04 16:39:53 +00:00
import { STATUS_COLORS, themes } from '../../../constants/colors';
2019-03-27 20:06:57 +00:00
import { CustomIcon } from '../../../lib/Icons';
import Status from '../../../containers/Status/Status';
2019-12-04 16:39:53 +00:00
import { isAndroid } from '../../../utils/deviceInfo';
2019-03-27 20:06:57 +00:00
const ICON_SIZE = 18;
const styles = StyleSheet.create({
type: {
width: ICON_SIZE,
height: ICON_SIZE,
marginRight: 4,
marginLeft: -4
2019-03-27 20:06:57 +00:00
},
status: {
marginRight: 8
2019-03-27 20:06:57 +00:00
}
});
const Icon = React.memo(({
roomUserId, type, status, theme
}) => {
if (type === 'd' && roomUserId) {
2019-03-27 20:06:57 +00:00
return <Status size={10} style={styles.status} status={status} />;
}
2019-12-04 16:39:53 +00:00
let colorStyle = {};
[NEW] Livechat (#2004) * [WIP][NEW] Livechat info/actions * [IMPROVEMENT] RoomActionsView * [NEW] Visitor Navigation * [NEW] Get Department REST * [FIX] Borders * [IMPROVEMENT] Refactor RoomInfo View * [FIX] Error while navigate from mention -> roomInfo * [NEW] Livechat Fields * [NEW] Close Livechat * [WIP] Forward livechat * [NEW] Return inquiry * [WIP] Comment when close livechat * [WIP] Improve roomInfo * [IMPROVEMENT] Forward room * [FIX] Department picker * [FIX] Picker without results * [FIX] Superfluous argument * [FIX] Check permissions on RoomActionsView * [FIX] Livechat permissions * [WIP] Show edit to livechat * [I18N] Add pt-br translations * [WIP] Livechat Info * [IMPROVEMENT] Livechat info * [WIP] Livechat Edit * [WIP] Livechat edit * [WIP] Livechat Edit * [WIP] Livechat edit scroll * [FIX] Edit customFields * [FIX] Clean livechat customField * [FIX] Visitor Navigation * [NEW] Next input logic LivechatEdit * [FIX] Add livechat data to subscription * [FIX] Revert change * [NEW] Livechat user Status * [WIP] Livechat tags * [NEW] Edit livechat tags * [FIX] Prevent some crashes * [FIX] Forward * [FIX] Return Livechat error * [FIX] Prevent livechat info crash * [IMPROVEMENT] Use input style on forward chat * OnboardingSeparator -> OrSeparator * [FIX] Go to next input * [NEW] Added some icons * [NEW] Livechat close * [NEW] Forward Room Action * [FIX] Livechat edit style * [FIX] Change status logic * [CHORE] Remove unnecessary logic * [CHORE] Remove unnecessary code * [CHORE] Remove unecessary case * [FIX] Superfluous argument * [IMPROVEMENT] Submit livechat edit * [CHORE] Remove textInput type * [FIX] Livechat edit * [FIX] Livechat Edit * [FIX] Use same effect * [IMPROVEMENT] Tags input * [FIX] Add empty tag * Fix minor issues * Fix typo * insert livechat room data to our room object * review * add method calls server version Co-authored-by: Diego Mello <diegolmello@gmail.com>
2020-05-08 17:36:10 +00:00
if (type === 'l') {
2019-12-04 16:39:53 +00:00
colorStyle = { color: STATUS_COLORS[status] };
} else {
colorStyle = { color: isAndroid && theme === 'light' ? themes[theme].buttonText : themes[theme].auxiliaryText };
}
2019-04-08 12:35:28 +00:00
let icon;
if (type === 'discussion') {
icon = 'chat';
2019-04-17 17:01:03 +00:00
} else if (type === 'thread') {
icon = 'thread';
2019-04-08 12:35:28 +00:00
} else if (type === 'c') {
icon = 'hashtag';
2020-02-07 13:24:16 +00:00
} else if (type === 'l') {
icon = 'livechat';
} else if (type === 'd') {
icon = 'team';
2019-04-08 12:35:28 +00:00
} else {
icon = 'lock';
}
2019-03-27 20:06:57 +00:00
return (
<CustomIcon
name={icon}
size={ICON_SIZE * 1}
style={[
styles.type,
{
width: ICON_SIZE * 1,
height: ICON_SIZE * 1
},
2019-12-04 16:39:53 +00:00
colorStyle
2019-03-27 20:06:57 +00:00
]}
/>
);
});
Icon.propTypes = {
roomUserId: PropTypes.string,
2019-03-27 20:06:57 +00:00
type: PropTypes.string,
2019-12-04 16:39:53 +00:00
status: PropTypes.string,
theme: PropTypes.string
2019-03-27 20:06:57 +00:00
};
export default Icon;