From 7b85d612da9274cf152751d843fdf9fcd4ae5439 Mon Sep 17 00:00:00 2001 From: SimonLaux Date: Fri, 13 Oct 2023 20:33:35 +0200 Subject: [PATCH] fix: remove duplicated search button on "search in chat" fixes #3014 --- CHANGELOG.md | 1 + src/renderer/components/SearchInput.tsx | 20 ++++++++++++++----- src/renderer/components/chat/ChatList.tsx | 4 ++-- .../components/screens/MainScreen.tsx | 3 +++ 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b15f2b85c7..d900a9e993 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ - add description for enableChatAuditLog setting - fix: import key from file instead of folder, fixes #1863 - fix webxdc title not updated in document title changes #3412 +- fix: remove duplicated search button on "search in chat" #3014 diff --git a/src/renderer/components/SearchInput.tsx b/src/renderer/components/SearchInput.tsx index af6583ebb0..904c3ade06 100644 --- a/src/renderer/components/SearchInput.tsx +++ b/src/renderer/components/SearchInput.tsx @@ -5,16 +5,20 @@ import { useTranslationFunction } from '../contexts' export function ClearButton(props: { onChange: (event: { target: { value: '' } }) => void value: string + extraCleanAction?: () => void }) { - const { onChange, value } = props - const onClear = () => onChange({ target: { value: '' } }) + const { onChange, extraCleanAction, value } = props + const onClear = () => { + onChange({ target: { value: '' } }) + extraCleanAction?.() + } return ( + */}
{translate_n('n_messages', messageResultIds.length)} diff --git a/src/renderer/components/screens/MainScreen.tsx b/src/renderer/components/screens/MainScreen.tsx index c1f560ae08..f4fba77ffd 100644 --- a/src/renderer/components/screens/MainScreen.tsx +++ b/src/renderer/components/screens/MainScreen.tsx @@ -227,6 +227,9 @@ export default function MainScreen() { value={queryStr} className='icon-rotated' inputRef={searchRef} + extraCleanAction={ + queryChatId ? () => setQueryChatId(null) : undefined + } /> )}