2020-05-08 17:36:10 +00:00
|
|
|
import React from 'react';
|
2021-10-01 18:12:19 +00:00
|
|
|
import { Text, View } from 'react-native';
|
2020-05-08 17:36:10 +00:00
|
|
|
|
|
|
|
import { themes } from '../../constants/colors';
|
|
|
|
import I18n from '../../i18n';
|
2022-03-29 18:53:27 +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-03-29 18:53:27 +00:00
|
|
|
const Roles = ({ roles }: { roles: string[] }) => {
|
|
|
|
const { theme } = useTheme();
|
|
|
|
|
|
|
|
if (roles && roles.length) {
|
2021-10-01 18:12:19 +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-24 20:12:25 +00:00
|
|
|
<View style={[styles.roleBadge, { backgroundColor: themes[theme].chatComponentBackground }]} key={role}>
|
|
|
|
<Text style={[styles.role, { color: themes[theme].titleText }]}>{role}</Text>
|
2021-10-01 18:12:19 +00:00
|
|
|
</View>
|
|
|
|
) : null
|
|
|
|
)}
|
|
|
|
</View>
|
2022-03-29 18:53:27 +00:00
|
|
|
</View>;
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
2020-05-08 17:36:10 +00:00
|
|
|
};
|
|
|
|
|
2022-03-29 18:53:27 +00:00
|
|
|
const Direct = ({ roomUser }: { roomUser: any }) => (
|
2020-05-08 17:36:10 +00:00
|
|
|
<>
|
2022-03-29 18:53:27 +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;
|