2018-05-18 16:41:47 +00:00
|
|
|
import React from 'react';
|
2018-08-31 16:46:33 +00:00
|
|
|
import { Image, StyleSheet } from 'react-native';
|
2018-05-18 16:41:47 +00:00
|
|
|
import PropTypes from 'prop-types';
|
2019-04-08 12:35:28 +00:00
|
|
|
import { CustomIcon } from '../lib/Icons';
|
2020-05-08 17:36:10 +00:00
|
|
|
import { STATUS_COLORS, themes } from '../constants/colors';
|
2018-05-18 16:41:47 +00:00
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
2018-08-31 16:46:33 +00:00
|
|
|
style: {
|
|
|
|
marginRight: 7,
|
2019-07-18 17:44:02 +00:00
|
|
|
marginTop: 3
|
|
|
|
},
|
2019-04-08 12:35:28 +00:00
|
|
|
discussion: {
|
|
|
|
marginRight: 6
|
2018-05-18 16:41:47 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-12-04 16:39:53 +00:00
|
|
|
const RoomTypeIcon = React.memo(({
|
2020-05-08 17:36:10 +00:00
|
|
|
type, size, isGroupChat, status, style, theme
|
2019-12-04 16:39:53 +00:00
|
|
|
}) => {
|
2018-05-24 20:17:45 +00:00
|
|
|
if (!type) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2019-12-04 16:39:53 +00:00
|
|
|
const color = themes[theme].auxiliaryText;
|
|
|
|
|
2019-04-08 12:35:28 +00:00
|
|
|
if (type === 'discussion') {
|
|
|
|
// FIXME: These are temporary only. We should have all room icons on <Customicon />, but our design team is still working on this.
|
2019-12-04 16:39:53 +00:00
|
|
|
return <CustomIcon name='chat' size={13} style={[styles.style, styles.iconColor, styles.discussion, { color }]} />;
|
2019-04-08 12:35:28 +00:00
|
|
|
}
|
|
|
|
|
2018-08-31 16:46:33 +00:00
|
|
|
if (type === 'c') {
|
2019-12-04 16:39:53 +00:00
|
|
|
return <Image source={{ uri: 'hashtag' }} style={[styles.style, style, { width: size, height: size, tintColor: color }]} />;
|
2019-07-18 17:44:02 +00:00
|
|
|
} if (type === 'd') {
|
2020-04-01 12:28:54 +00:00
|
|
|
if (isGroupChat) {
|
|
|
|
return <CustomIcon name='team' size={13} style={[styles.style, styles.discussion, { color }]} />;
|
|
|
|
}
|
2019-12-04 16:39:53 +00:00
|
|
|
return <CustomIcon name='at' size={13} style={[styles.style, styles.discussion, { color }]} />;
|
2020-02-07 13:24:16 +00:00
|
|
|
} if (type === 'l') {
|
2020-05-08 17:36:10 +00:00
|
|
|
return <CustomIcon name='omnichannel' size={13} style={[styles.style, styles.discussion, { color: STATUS_COLORS[status] }]} />;
|
2018-08-31 16:46:33 +00:00
|
|
|
}
|
2019-12-04 16:39:53 +00:00
|
|
|
return <Image source={{ uri: 'lock' }} style={[styles.style, style, { width: size, height: size, tintColor: color }]} />;
|
2019-03-01 16:49:11 +00:00
|
|
|
});
|
2018-05-18 16:41:47 +00:00
|
|
|
|
|
|
|
RoomTypeIcon.propTypes = {
|
2019-12-04 16:39:53 +00:00
|
|
|
theme: PropTypes.string,
|
2018-05-24 20:17:45 +00:00
|
|
|
type: PropTypes.string,
|
2020-04-01 12:28:54 +00:00
|
|
|
isGroupChat: PropTypes.bool,
|
2020-05-08 17:36:10 +00:00
|
|
|
status: PropTypes.string,
|
2018-08-31 16:46:33 +00:00
|
|
|
size: PropTypes.number,
|
|
|
|
style: PropTypes.object
|
2018-05-18 16:41:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
RoomTypeIcon.defaultProps = {
|
2018-08-31 16:46:33 +00:00
|
|
|
size: 10
|
2018-05-18 16:41:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default RoomTypeIcon;
|