import React, { useState } from 'react'; import { FormattedMessage } from 'react-intl'; import { Virtuoso } from 'react-virtuoso'; import { HStack, Icon, Stack, Text } from 'soapbox/components/ui'; import { useOwnAccount } from 'soapbox/hooks'; import { groupSearchHistory } from 'soapbox/settings'; import { clearRecentGroupSearches } from 'soapbox/utils/groups'; interface Props { onSelect(value: string): void } export default (props: Props) => { const { onSelect } = props; const me = useOwnAccount(); const [recentSearches, setRecentSearches] = useState(groupSearchHistory.get(me?.id as string) || []); const onClearRecentSearches = () => { clearRecentGroupSearches(me?.id as string); setRecentSearches([]); }; return ( {recentSearches.length > 0 ? ( <> Recent searches (
)} /> ) : ( )}
); };