diff --git a/renderer/components/timelines/Search.tsx b/renderer/components/timelines/Search.tsx index 017a7a21..f290e72b 100644 --- a/renderer/components/timelines/Search.tsx +++ b/renderer/components/timelines/Search.tsx @@ -7,6 +7,7 @@ import { FormattedMessage, useIntl } from 'react-intl' import Statuses from './search/Statuses' import { Account } from '@/db' import Accounts from './search/Accounts' +import Hashtags from './search/Hashtags' type Props = { client: MegalodonInterface @@ -108,9 +109,11 @@ export default function Search(props: Props) { /> - + + + + - hashtags diff --git a/renderer/components/timelines/search/Accounts.tsx b/renderer/components/timelines/search/Accounts.tsx index 6215db05..073accb1 100644 --- a/renderer/components/timelines/search/Accounts.tsx +++ b/renderer/components/timelines/search/Accounts.tsx @@ -1,11 +1,9 @@ import { Avatar, Spinner } from '@material-tailwind/react' -import { Entity, MegalodonInterface } from 'megalodon' +import { Entity } from 'megalodon' import emojify from '@/utils/emojify' -import { Virtuoso } from 'react-virtuoso' import { useRouter } from 'next/router' type Props = { - client: MegalodonInterface users: Array loading: boolean } @@ -21,12 +19,11 @@ export default function Accounts(props: Props) { <>
{props.users.length > 0 ? ( - } - /> + <> + {props.users.map((user, index) => ( + + ))} + ) : ( <> {props.loading && ( diff --git a/renderer/components/timelines/search/Hashtags.tsx b/renderer/components/timelines/search/Hashtags.tsx new file mode 100644 index 00000000..b1d87ab6 --- /dev/null +++ b/renderer/components/timelines/search/Hashtags.tsx @@ -0,0 +1,60 @@ +import { Spinner } from '@material-tailwind/react' +import { Entity } from 'megalodon' +import { useRouter } from 'next/router' +import { FaHashtag } from 'react-icons/fa6' + +type Props = { + hashtags: Array + loading: boolean +} + +export default function Hashtags(props: Props) { + const router = useRouter() + + const openTag = (tag: string) => { + router.push({ query: { id: router.query.id, timeline: router.query.timeline, hashtag: tag, detail: true } }) + } + + return ( + <> +
+ {props.hashtags.length > 0 ? ( + <> + {props.hashtags.map(hashtag => ( + + ))} + + ) : ( + <> + {props.loading && ( +
+ +
+ )} + + )} +
+ + ) +} + +type HashtagProps = { + hashtag: Entity.Tag + openTag: (tag: string) => void +} + +function Hashtag(props: HashtagProps) { + return ( +
+
+
props.openTag(props.hashtag.name)} + > + + {props.hashtag.name} +
+
+
+ ) +}