From 13989c0702c158e5486ebf8da466f3795ad50be6 Mon Sep 17 00:00:00 2001 From: Khairul Hidayat Date: Fri, 18 Sep 2026 07:30:23 +0800 Subject: [PATCH] feat: update ui --- ui/src/app/chats.tsx | 73 ++++++++++++++++++++++------------------- ui/src/app/messages.tsx | 33 ++++++++++++++++--- 2 files changed, 67 insertions(+), 39 deletions(-) diff --git a/ui/src/app/chats.tsx b/ui/src/app/chats.tsx index 513f57e..f19c5ea 100644 --- a/ui/src/app/chats.tsx +++ b/ui/src/app/chats.tsx @@ -41,6 +41,7 @@ export default function ChatsSection({ selected, onSelect }: Props) { return items.slice(0, 100).map((i) => ({ ...i, + contact: i.accountLid ? contacts.findById(i.accountLid) : null, from: i.isGroup ? contacts.findById(i.previewMessage?.author || null) : null, @@ -81,54 +82,58 @@ export default function ChatsSection({ selected, onSelect }: Props) { {chats == null || isLoading ? [...Array(20)].map((_, i) => (
- +
- - + +
)) : null} - {filteredChats?.map((chat) => ( - - ))} + + ); + })} ); diff --git a/ui/src/app/messages.tsx b/ui/src/app/messages.tsx index 4c40590..cdd88f8 100644 --- a/ui/src/app/messages.tsx +++ b/ui/src/app/messages.tsx @@ -12,7 +12,7 @@ import { SendIcon, XIcon, } from "lucide-react"; -import { useEffect, useMemo, useState } from "react"; +import { useEffect, useMemo, useRef, useState } from "react"; import dayjs from "dayjs"; import relativeTime from "dayjs/plugin/relativeTime"; import MessageMedia from "@/components/message-media"; @@ -187,9 +187,18 @@ export default function MessagesSection({ chatId, maxCount = 50 }: Props) { className={`mb-3 flex ${item.fromMe ? "justify-end" : "justify-start"}`} >
-

+ { + e.preventDefault(); + router.push( + `/?chatId=${getId(item.author || item.from?.id)}`, + ); + }} + className="mb-1 text-xs text-muted-foreground" + > {getFormattedName(item.from) || item.notifyName} -

+
@@ -290,9 +299,8 @@ export default function MessagesSection({ chatId, maxCount = 50 }: Props) { i % 2 === 0 ? "self-start" : "self-end", )} > - + void; }) { + const fileRef = useRef(null); const { client, isReady } = useWAClient(); const [message, setMessage] = useState(""); const [files, setFiles] = useState<{ id: string; file: File }[]>([]); @@ -414,6 +423,19 @@ function MessageInputSection({ return (
+ { + if (e.target.files?.length) { + onFileAttached([...e.target.files]); + } + e.target.value = ""; + }} + /> + {files.length > 0 && (
{files.map((i) => ( @@ -429,6 +451,7 @@ function MessageInputSection({