feat: display language icon for auto translated msgs
This commit is contained in:
parent
274b88701f
commit
ba11b948e7
|
@ -0,0 +1,23 @@
|
|||
import React, { memo } from 'react';
|
||||
import { View } from 'react-native';
|
||||
|
||||
import { CustomIcon } from '../../../CustomIcon';
|
||||
import { useTheme } from '../../../../theme';
|
||||
import { themes } from '../../../../lib/constants';
|
||||
import styles from '../../styles';
|
||||
|
||||
const Translated = memo(({ isTranslated }: { isTranslated: boolean }) => {
|
||||
const { theme } = useTheme();
|
||||
|
||||
if (!isTranslated) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<View style={styles.rightIcons}>
|
||||
<CustomIcon name='language' size={16} color={themes[theme].auxiliaryText} />
|
||||
</View>
|
||||
);
|
||||
});
|
||||
|
||||
export default Translated;
|
|
@ -5,6 +5,7 @@ import Encrypted from './Encrypted';
|
|||
import Edited from './Edited';
|
||||
import MessageError from './MessageError';
|
||||
import ReadReceipt from './ReadReceipt';
|
||||
import Translated from './Translated';
|
||||
import { MessageType } from '../../../../definitions';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
|
@ -20,14 +21,16 @@ interface IRightIcons {
|
|||
isReadReceiptEnabled?: boolean;
|
||||
unread?: boolean;
|
||||
hasError: boolean;
|
||||
isTranslated: boolean;
|
||||
}
|
||||
|
||||
const RightIcons = ({ type, msg, isEdited, hasError, isReadReceiptEnabled, unread }: IRightIcons) => (
|
||||
const RightIcons = ({ type, msg, isEdited, hasError, isReadReceiptEnabled, unread, isTranslated }: IRightIcons) => (
|
||||
<View style={styles.actionIcons}>
|
||||
<Encrypted type={type} />
|
||||
<Edited testID={`${msg}-edited`} isEdited={isEdited} />
|
||||
<MessageError hasError={hasError} />
|
||||
<ReadReceipt isReadReceiptEnabled={isReadReceiptEnabled} unread={unread} />
|
||||
<Translated isTranslated={isTranslated} />
|
||||
</View>
|
||||
);
|
||||
|
||||
|
|
|
@ -117,6 +117,7 @@ const Message = React.memo((props: IMessage) => {
|
|||
hasError={props.hasError}
|
||||
isReadReceiptEnabled={props.isReadReceiptEnabled}
|
||||
unread={props.unread}
|
||||
isTranslated={props.isTranslated}
|
||||
/>
|
||||
) : null}
|
||||
</View>
|
||||
|
|
|
@ -60,10 +60,24 @@ interface IMessageUser {
|
|||
isEdited: boolean;
|
||||
isReadReceiptEnabled?: boolean;
|
||||
unread?: boolean;
|
||||
isTranslated: boolean;
|
||||
}
|
||||
|
||||
const User = React.memo(
|
||||
({ isHeader, useRealName, author, alias, ts, timeFormat, hasError, navToRoomInfo, type, isEdited, ...props }: IMessageUser) => {
|
||||
({
|
||||
isHeader,
|
||||
useRealName,
|
||||
author,
|
||||
alias,
|
||||
ts,
|
||||
timeFormat,
|
||||
hasError,
|
||||
navToRoomInfo,
|
||||
type,
|
||||
isEdited,
|
||||
isTranslated,
|
||||
...props
|
||||
}: IMessageUser) => {
|
||||
const { user } = useContext(MessageContext);
|
||||
const { colors } = useTheme();
|
||||
|
||||
|
@ -110,6 +124,7 @@ const User = React.memo(
|
|||
hasError={hasError}
|
||||
isReadReceiptEnabled={props.isReadReceiptEnabled}
|
||||
unread={props.unread}
|
||||
isTranslated={isTranslated}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue