You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
984 B
TypeScript
36 lines
984 B
TypeScript
7 years ago
|
import React from 'react';
|
||
7 years ago
|
|
||
5 years ago
|
import _ from 'lodash';
|
||
5 years ago
|
import uuid from 'uuid';
|
||
4 years ago
|
import { useSelector } from 'react-redux';
|
||
3 years ago
|
import { getGenericReadableMessageSelectorProps } from '../../../../state/selectors/conversations';
|
||
|
import { GenericReadableMessage } from './GenericReadableMessage';
|
||
7 years ago
|
|
||
6 years ago
|
// Same as MIN_WIDTH in ImageGrid.tsx
|
||
4 years ago
|
export const MINIMUM_LINK_PREVIEW_IMAGE_WIDTH = 200;
|
||
6 years ago
|
|
||
4 years ago
|
type Props = {
|
||
4 years ago
|
messageId: string;
|
||
4 years ago
|
isDetailView?: boolean; // when the detail is shown for a message, we disble click and some other stuff
|
||
4 years ago
|
};
|
||
|
|
||
4 years ago
|
export const Message = (props: Props) => {
|
||
|
const msgProps = useSelector(state =>
|
||
|
getGenericReadableMessageSelectorProps(state as any, props.messageId)
|
||
|
);
|
||
7 years ago
|
|
||
4 years ago
|
const ctxMenuID = `ctx-menu-message-${uuid()}`;
|
||
7 years ago
|
|
||
4 years ago
|
if (msgProps?.isDeleted && msgProps.direction === 'outgoing') {
|
||
|
return null;
|
||
7 years ago
|
}
|
||
|
|
||
4 years ago
|
return (
|
||
|
<GenericReadableMessage
|
||
|
ctxMenuID={ctxMenuID}
|
||
|
messageId={props.messageId}
|
||
|
isDetailView={props.isDetailView}
|
||
|
/>
|
||
|
);
|
||
|
};
|