From e0c6127ab53d32360e9f71df6a5e0a298722aa79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nicole=20miko=C5=82ajczyk?= Date: Fri, 17 Oct 2025 20:53:36 +0200 Subject: [PATCH] pl-fe: we don't really need this component MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nicole mikołajczyk --- .../pl-fe/src/components/account-search.tsx | 92 ------------------- packages/pl-fe/src/locales/en.json | 1 - .../src/pages/status-lists/conversations.tsx | 11 --- 3 files changed, 104 deletions(-) delete mode 100644 packages/pl-fe/src/components/account-search.tsx diff --git a/packages/pl-fe/src/components/account-search.tsx b/packages/pl-fe/src/components/account-search.tsx deleted file mode 100644 index db7789855..000000000 --- a/packages/pl-fe/src/components/account-search.tsx +++ /dev/null @@ -1,92 +0,0 @@ -import clsx from 'clsx'; -import React, { useState } from 'react'; -import { defineMessages, useIntl } from 'react-intl'; - -import AutosuggestAccountInput from 'pl-fe/components/autosuggest-account-input'; - -import SvgIcon from './ui/svg-icon'; - -const messages = defineMessages({ - placeholder: { id: 'account_search.placeholder', defaultMessage: 'Search for an account' }, -}); - -interface IAccountSearch { - /** Callback when a searched account is chosen. */ - onSelected: (accountId: string) => void; - /** Override the default placeholder of the input. */ - placeholder?: string; -} - -/** Input to search for accounts. */ -const AccountSearch: React.FC = ({ onSelected, ...rest }) => { - const intl = useIntl(); - - const [value, setValue] = useState(''); - - const isEmpty = (): boolean => !(value.length > 0); - - const clearState = () => { - setValue(''); - }; - - const handleChange: React.ChangeEventHandler = ({ target }) => { - setValue(target.value); - }; - - const handleSelected = (accountId: string) => { - clearState(); - onSelected(accountId); - }; - - const handleClear: React.MouseEventHandler = e => { - e.preventDefault(); - - if (!isEmpty()) { - setValue(''); - } - }; - - const handleKeyDown: React.KeyboardEventHandler = e => { - if (e.key === 'Escape') { - document.querySelector('.ui')?.parentElement?.focus(); - } - }; - - return ( -
- - -
- - -
- - - -
-
-
- ); -}; - -export { AccountSearch as default }; diff --git a/packages/pl-fe/src/locales/en.json b/packages/pl-fe/src/locales/en.json index 6c8b909fb..903d2fe34 100644 --- a/packages/pl-fe/src/locales/en.json +++ b/packages/pl-fe/src/locales/en.json @@ -99,7 +99,6 @@ "account_moderation_modal.roles.user": "User", "account_note.header": "Note", "account_note.placeholder": "Click to add a note", - "account_search.placeholder": "Search for an account", "admin.announcements.action": "Create announcement", "admin.announcements.all_day": "All day", "admin.announcements.delete": "Delete", diff --git a/packages/pl-fe/src/pages/status-lists/conversations.tsx b/packages/pl-fe/src/pages/status-lists/conversations.tsx index 504166f98..b52b47ca9 100644 --- a/packages/pl-fe/src/pages/status-lists/conversations.tsx +++ b/packages/pl-fe/src/pages/status-lists/conversations.tsx @@ -1,10 +1,8 @@ import React, { useEffect } from 'react'; import { defineMessages, useIntl } from 'react-intl'; -import { directComposeById } from 'pl-fe/actions/compose'; import { mountConversations, unmountConversations, expandConversations } from 'pl-fe/actions/conversations'; import { useDirectStream } from 'pl-fe/api/hooks/streaming/use-direct-stream'; -import AccountSearch from 'pl-fe/components/account-search'; import Column from 'pl-fe/components/ui/column'; import ConversationsList from 'pl-fe/features/conversations/components/conversations-list'; import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; @@ -29,17 +27,8 @@ const ConversationsTimeline = () => { }; }, []); - const handleSuggestion = (accountId: string) => { - dispatch(directComposeById(accountId)); - }; - return ( - - );