diff --git a/app/javascript/mastodon/features/compose/components/search.tsx b/app/javascript/mastodon/features/compose/components/search.tsx index 84e11e44b5..fbbbe06933 100644 --- a/app/javascript/mastodon/features/compose/components/search.tsx +++ b/app/javascript/mastodon/features/compose/components/search.tsx @@ -33,6 +33,10 @@ const messages = defineMessages({ id: 'search.search_or_paste', defaultMessage: 'Search or paste URL', }, + clearAllRecent: { + id: 'search.clear_all_recent', + defaultMessage: 'Clear all recent searches', + }, }); const labelForRecentSearch = (search: RecentSearch) => { @@ -225,6 +229,17 @@ export const Search: React.FC<{ }, })); + const forgetAll = useCallback( + (e: React.MouseEvent) => { + e.preventDefault(); + e.stopPropagation(); + recent.forEach((search) => { + void dispatch(forgetSearchResult(search.q)); + }); + }, + [dispatch, recent], + ); + const navigableOptions = hasValue ? quickActions.concat(searchOptions) : recentOptions.concat(quickActions, searchOptions); @@ -451,6 +466,18 @@ export const Search: React.FC<{ setSelectedOption(-1); }, [setExpanded, setSelectedOption]); + const clearAllRecentButton = + recentOptions.length === 0 ? null : ( + + ); + return (