refactor: return fuzzy profile search
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Kieran 2024-01-19 22:16:48 +00:00
parent 3d2f11f206
commit 2033137ae2
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
1 changed files with 12 additions and 2 deletions

View File

@ -1,15 +1,25 @@
import { useEffect, useState } from "react";
import { useEffect, useMemo, useState } from "react";
import { FormattedMessage, useIntl } from "react-intl";
import { useNavigate, useParams } from "react-router-dom";
import { LocalSearch } from "@/Components/Feed/LocalSearch";
import TabSelectors, { Tab } from "@/Components/TabSelectors/TabSelectors";
import TrendingNotes from "@/Components/Trending/TrendingPosts";
import TrendingUsers from "@/Components/Trending/TrendingUsers";
import FollowListBase from "@/Components/User/FollowListBase";
import useProfileSearch from "@/Hooks/useProfileSearch";
import { debounce } from "@/Utils";
const NOTES = 0;
const PROFILES = 1;
const Profiles = ({ keyword }: { keyword: string }) => {
const results = useProfileSearch(keyword);
const ids = useMemo(() => results.map(r => r.pubkey), [results]);
const content = keyword ? <FollowListBase pubkeys={ids} showAbout={true} /> : <TrendingUsers />;
return <div className="px-3">{content}</div>;
};
const SearchPage = () => {
const params = useParams();
const { formatMessage } = useIntl();
@ -45,7 +55,7 @@ const SearchPage = () => {
function tabContent() {
if (tab.value === PROFILES) {
return <LocalSearch term={keyword} kind={0} />;
return <Profiles keyword={keyword} />
}
if (!keyword) {