From 314f2972fe35e6ae6f6a14fa980ea710141567c4 Mon Sep 17 00:00:00 2001 From: ilya-bkv Date: Fri, 9 Dec 2022 18:30:20 +0300 Subject: [PATCH] Show reply in message box --- public/icons/close-gray.svg | 3 +++ src/components/Inbox/Message.tsx | 5 ++++- src/components/Views/Inbox.tsx | 30 +++++++++++++++++++++++++- src/styles/Inbox.scss | 37 +++++++++++++++++++++++++++++++- 4 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 public/icons/close-gray.svg diff --git a/public/icons/close-gray.svg b/public/icons/close-gray.svg new file mode 100644 index 00000000..fe25f457 --- /dev/null +++ b/public/icons/close-gray.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/components/Inbox/Message.tsx b/src/components/Inbox/Message.tsx index bd629394..af78f306 100644 --- a/src/components/Inbox/Message.tsx +++ b/src/components/Inbox/Message.tsx @@ -11,6 +11,7 @@ type Props = { content: Message ownId: number members: ChatMember[] + replyClick?: () => void } const md = new MarkdownIt({ @@ -31,7 +32,9 @@ const Message = (props: Props) => {
- +
+ +
diff --git a/src/components/Views/Inbox.tsx b/src/components/Views/Inbox.tsx index c36b149b..904eb0e2 100644 --- a/src/components/Views/Inbox.tsx +++ b/src/components/Views/Inbox.tsx @@ -17,6 +17,7 @@ import DialogHeader from '../Inbox/DialogHeader' import { apiClient } from '../../utils/apiClient' import MessagesFallback from '../Inbox/MessagesFallback' import { useRouter } from '../../stores/router' +import styles from '../Inbox/Message.module.scss' const userSearch = (array: Author[], keyword: string) => { const searchTerm = keyword.toLowerCase() @@ -36,6 +37,7 @@ export const InboxView = () => { const [sortByGroup, setSortByGroup] = createSignal(false) const [sortByPerToPer, setSortByPerToPer] = createSignal(false) const [currentDialog, setCurrentDialog] = createSignal() + const [messageToReply, setMessageToReply] = createSignal(null) const { session } = useSession() const currentUserId = createMemo(() => session()?.user.id) // Поиск по диалогам @@ -97,6 +99,7 @@ export const InboxView = () => { const urlParams = new URLSearchParams(window.location.search) const params = Object.fromEntries(urlParams) createEffect(async () => { + console.log('!!! postMessageText:', postMessageText()) if (textareaParent) { textareaParent.dataset.replicatedValue = postMessageText() } @@ -212,7 +215,12 @@ export const InboxView = () => {
{(message) => ( - + setMessageToReply(message)} + /> )} @@ -223,6 +231,26 @@ export const InboxView = () => {
+ +
+
+ +
+
+
+ { + currentDialog().members.find( + (member) => member.id === Number(messageToReply().author) + ).name + } +
+
{messageToReply().body}
+
+
setMessageToReply(null)}> + +
+
+