Support replying to files, show icon in reply.

This commit is contained in:
Paul
2021-06-26 09:45:07 +01:00
parent 5c0e14b6ca
commit 90713b3c5d
4 changed files with 26 additions and 14 deletions

View File

@@ -2,7 +2,7 @@ import { Text } from "preact-i18n";
import UserShort from "../../user/UserShort";
import styled, { css } from "styled-components";
import Markdown from "../../../markdown/Markdown";
import { CornerUpRight } from "@styled-icons/feather";
import { CornerUpRight, File } from "@styled-icons/feather";
import { useUser } from "../../../../context/revoltjs/hooks";
import { useRenderState } from "../../../../lib/renderer/Singleton";
@@ -22,7 +22,12 @@ export const ReplyBase = styled.div<{ head?: boolean, fail?: boolean, preview?:
align-items: center;
color: var(--secondary-foreground);
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
svg {
flex-shrink: 0;
color: var(--tertiary-foreground);
}
@@ -59,7 +64,8 @@ export function MessageReply({ index, channel, id }: Props) {
<ReplyBase head={index === 0}>
<CornerUpRight size={16} />
<UserShort user={user} size={16} />
<Markdown disallowBigEmoji content={(message.content as string).split('\n').shift()} />
{ message.attachments && message.attachments.length > 0 && <File size={16} /> }
<Markdown disallowBigEmoji content={(message.content as string).replace(/\n/g, ' ')} />
</ReplyBase>
)
}