1
0
mirror of https://github.com/spacebarchat/client.git synced 2024-11-22 10:22:30 +01:00

edited mark

This commit is contained in:
Puyodead1 2023-09-17 16:25:34 -04:00
parent 73ca4219a8
commit 89ff9ef83f
No known key found for this signature in database
GPG Key ID: A4FA4FEC0DD353FC
2 changed files with 14 additions and 2 deletions

View File

@ -142,6 +142,13 @@ function Message({ message, isHeader, isSending, isFailed }: Props) {
</div>
)}
{parseMessageContent(message.content)}
{"edited_timestamp" in message && message.edited_timestamp && (
<MessageTimestamp date={message.edited_timestamp}>
<span style={{ color: "var(--text-secondary)", fontSize: "12px", paddingLeft: "5px" }}>
(edited)
</span>
</MessageTimestamp>
)}
{"attachments" in message
? message.attachments.map((attachment, index) => (
<Fragment key={index}>

View File

@ -11,10 +11,15 @@ const Container = styled.div`
user-select: none;
`;
function MessageTimestamp({ date }: { date: string | number | Date | dayjs.Dayjs }) {
interface Props {
date: string | number | Date | dayjs.Dayjs;
children?: React.ReactElement;
}
function MessageTimestamp({ date, children }: Props) {
return (
<Tooltip title={dayjs(date).format("dddd, MMMM MM, h:mm A")} placement="top">
<Container>{dayjs(date).calendar(undefined, calendarStrings)}</Container>
{children ? children : <Container>{dayjs(date).calendar(undefined, calendarStrings)}</Container>}
</Tooltip>
);
}