feat: add message pinned icon
This commit is contained in:
parent
54f2cea4e9
commit
f7d4f0d0be
|
@ -0,0 +1,15 @@
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import { CustomIcon } from '../../../CustomIcon';
|
||||||
|
import styles from '../../styles';
|
||||||
|
import { useTheme } from '../../../../theme';
|
||||||
|
|
||||||
|
const Pinned = React.memo(({ pinned }: { pinned?: boolean }) => {
|
||||||
|
const { colors } = useTheme();
|
||||||
|
if (pinned) {
|
||||||
|
return <CustomIcon name='pin' color={colors.auxiliaryTintColor} size={16} style={styles.rightIcons} />;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
|
||||||
|
export default Pinned;
|
|
@ -1,11 +1,12 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { StyleSheet, View } from 'react-native';
|
import { StyleSheet, View } from 'react-native';
|
||||||
|
|
||||||
import Encrypted from './Encrypted';
|
|
||||||
import Edited from './Edited';
|
|
||||||
import MessageError from './MessageError';
|
|
||||||
import ReadReceipt from './ReadReceipt';
|
|
||||||
import { MessageType } from '../../../../definitions';
|
import { MessageType } from '../../../../definitions';
|
||||||
|
import Edited from './Edited';
|
||||||
|
import Encrypted from './Encrypted';
|
||||||
|
import MessageError from './MessageError';
|
||||||
|
import Pinned from './Pinned';
|
||||||
|
import ReadReceipt from './ReadReceipt';
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
actionIcons: {
|
actionIcons: {
|
||||||
|
@ -20,10 +21,12 @@ interface IRightIcons {
|
||||||
isReadReceiptEnabled?: boolean;
|
isReadReceiptEnabled?: boolean;
|
||||||
unread?: boolean;
|
unread?: boolean;
|
||||||
hasError: boolean;
|
hasError: boolean;
|
||||||
|
pinned?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const RightIcons = ({ type, msg, isEdited, hasError, isReadReceiptEnabled, unread }: IRightIcons) => (
|
const RightIcons = ({ type, msg, isEdited, hasError, isReadReceiptEnabled, unread, pinned }: IRightIcons): React.ReactElement => (
|
||||||
<View style={styles.actionIcons}>
|
<View style={styles.actionIcons}>
|
||||||
|
<Pinned pinned={pinned} />
|
||||||
<Encrypted type={type} />
|
<Encrypted type={type} />
|
||||||
<Edited testID={`${msg}-edited`} isEdited={isEdited} />
|
<Edited testID={`${msg}-edited`} isEdited={isEdited} />
|
||||||
<MessageError hasError={hasError} />
|
<MessageError hasError={hasError} />
|
||||||
|
|
|
@ -117,6 +117,7 @@ const Message = React.memo((props: IMessage) => {
|
||||||
hasError={props.hasError}
|
hasError={props.hasError}
|
||||||
isReadReceiptEnabled={props.isReadReceiptEnabled}
|
isReadReceiptEnabled={props.isReadReceiptEnabled}
|
||||||
unread={props.unread}
|
unread={props.unread}
|
||||||
|
pinned={props.pinned}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
</View>
|
</View>
|
||||||
|
|
|
@ -390,7 +390,8 @@ class MessageContainer extends React.Component<IMessageContainerProps, IMessageC
|
||||||
autoTranslate: autoTranslateMessage,
|
autoTranslate: autoTranslateMessage,
|
||||||
replies,
|
replies,
|
||||||
md,
|
md,
|
||||||
comment
|
comment,
|
||||||
|
pinned
|
||||||
} = item;
|
} = item;
|
||||||
|
|
||||||
let message = msg;
|
let message = msg;
|
||||||
|
@ -485,6 +486,7 @@ class MessageContainer extends React.Component<IMessageContainerProps, IMessageC
|
||||||
isTranslated={isTranslated}
|
isTranslated={isTranslated}
|
||||||
isBeingEdited={isBeingEdited}
|
isBeingEdited={isBeingEdited}
|
||||||
isPreview={isPreview}
|
isPreview={isPreview}
|
||||||
|
pinned={pinned}
|
||||||
/>
|
/>
|
||||||
</MessageContext.Provider>
|
</MessageContext.Provider>
|
||||||
);
|
);
|
||||||
|
|
|
@ -64,6 +64,7 @@ export interface IMessageContent {
|
||||||
hasError: boolean;
|
hasError: boolean;
|
||||||
isHeader: boolean;
|
isHeader: boolean;
|
||||||
isTranslated: boolean;
|
isTranslated: boolean;
|
||||||
|
pinned?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IMessageEmoji {
|
export interface IMessageEmoji {
|
||||||
|
|
Loading…
Reference in New Issue