2020-05-08 17:36:10 +00:00
|
|
|
import React from 'react';
|
2021-09-13 20:41:05 +00:00
|
|
|
import { Text, View } from 'react-native';
|
2020-05-08 17:36:10 +00:00
|
|
|
|
2022-04-07 14:10:03 +00:00
|
|
|
import { themes } from '../../lib/constants';
|
2020-05-08 17:36:10 +00:00
|
|
|
import I18n from '../../i18n';
|
2022-03-03 21:46:53 +00:00
|
|
|
import { useTheme } from '../../theme';
|
2020-05-08 17:36:10 +00:00
|
|
|
import Timezone from './Timezone';
|
|
|
|
import CustomFields from './CustomFields';
|
|
|
|
import styles from './styles';
|
2022-05-11 18:20:59 +00:00
|
|
|
import { IUserParsed } from '.';
|
2020-05-08 17:36:10 +00:00
|
|
|
|
2022-05-11 18:20:59 +00:00
|
|
|
const Roles = ({ roles }: { roles?: string[] }) => {
|
2022-03-03 21:46:53 +00:00
|
|
|
const { theme } = useTheme();
|
|
|
|
|
|
|
|
if (roles && roles.length) {
|
2021-09-13 20:41:05 +00:00
|
|
|
<View style={styles.item}>
|
|
|
|
<Text style={[styles.itemLabel, { color: themes[theme].titleText }]}>{I18n.t('Roles')}</Text>
|
|
|
|
<View style={styles.rolesContainer}>
|
|
|
|
{roles.map(role =>
|
|
|
|
role ? (
|
2022-01-11 14:33:18 +00:00
|
|
|
<View style={[styles.roleBadge, { backgroundColor: themes[theme].chatComponentBackground }]} key={role}>
|
|
|
|
<Text style={[styles.role, { color: themes[theme].titleText }]}>{role}</Text>
|
2021-09-13 20:41:05 +00:00
|
|
|
</View>
|
|
|
|
) : null
|
|
|
|
)}
|
|
|
|
</View>
|
2022-03-03 21:46:53 +00:00
|
|
|
</View>;
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
2020-05-08 17:36:10 +00:00
|
|
|
};
|
|
|
|
|
2022-05-11 18:20:59 +00:00
|
|
|
const Direct = ({ roomUser }: { roomUser: IUserParsed }) => (
|
2020-05-08 17:36:10 +00:00
|
|
|
<>
|
2022-03-03 21:46:53 +00:00
|
|
|
<Roles roles={roomUser.parsedRoles} />
|
|
|
|
<Timezone utcOffset={roomUser.utcOffset} />
|
|
|
|
<CustomFields customFields={roomUser.customFields} />
|
2020-05-08 17:36:10 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
|
|
|
|
export default Direct;
|