feat(search): focus and highlight found message in chat

- store focused message id per chat
- scroll to target message and highlight it after search selection
- clear focus automatically after short timeout
This commit is contained in:
2026-03-08 02:53:03 +03:00
parent 874f9da12c
commit eef89983e0
3 changed files with 31 additions and 2 deletions

View File

@@ -17,6 +17,7 @@ export function ChatsPage() {
const activeChatId = useChatStore((s) => s.activeChatId);
const chats = useChatStore((s) => s.chats);
const setActiveChatId = useChatStore((s) => s.setActiveChatId);
const setFocusedMessage = useChatStore((s) => s.setFocusedMessage);
const loadMessages = useChatStore((s) => s.loadMessages);
const activeChat = chats.find((chat) => chat.id === activeChatId);
const isReadOnlyChannel = Boolean(activeChat && activeChat.type === "channel" && activeChat.my_role === "member");
@@ -147,6 +148,7 @@ export function ChatsPage() {
key={`search-msg-${message.id}`}
onClick={() => {
setActiveChatId(message.chat_id);
setFocusedMessage(message.chat_id, message.id);
setSearchOpen(false);
}}
>