refactor: return fuzzy profile search
This commit is contained in:
parent
3d2f11f206
commit
2033137ae2
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user