Browse Source

fix: 🐛

imwald
codytseng 1 year ago
parent
commit
6ef4e960d6
  1. 18
      src/components/SearchDialog/index.tsx

18
src/components/SearchDialog/index.tsx

@ -27,6 +27,12 @@ export function SearchDialog({ open, setOpen }: { open: boolean; setOpen: Dispat
} }
}, [input]) }, [input])
useEffect(() => {
profiles.forEach((profile) => {
console.log(profile.pubkey)
})
}, [profiles])
const list = useMemo(() => { const list = useMemo(() => {
const search = input.trim() const search = input.trim()
if (!search) return if (!search) return
@ -66,7 +72,7 @@ export function SearchDialog({ open, setOpen }: { open: boolean; setOpen: Dispat
))} ))}
{profiles.length >= 10 && ( {profiles.length >= 10 && (
<SecondaryPageLink to={toProfileList({ search })} onClick={() => setOpen(false)}> <SecondaryPageLink to={toProfileList({ search })} onClick={() => setOpen(false)}>
<CommandItem onClick={() => setOpen(false)} className="text-center"> <CommandItem value="show-more" onClick={() => setOpen(false)} className="text-center">
<div className="font-semibold">{t('Show more...')}</div> <div className="font-semibold">{t('Show more...')}</div>
</CommandItem> </CommandItem>
</SecondaryPageLink> </SecondaryPageLink>
@ -96,7 +102,7 @@ export function SearchDialog({ open, setOpen }: { open: boolean; setOpen: Dispat
function NormalItem({ search, onClick }: { search: string; onClick?: () => void }) { function NormalItem({ search, onClick }: { search: string; onClick?: () => void }) {
return ( return (
<SecondaryPageLink to={toNoteList({ search })} onClick={onClick}> <SecondaryPageLink to={toNoteList({ search })} onClick={onClick}>
<CommandItem> <CommandItem value={`search-${search}`}>
<Notebook className="text-muted-foreground" /> <Notebook className="text-muted-foreground" />
<div className="font-semibold">{search}</div> <div className="font-semibold">{search}</div>
</CommandItem> </CommandItem>
@ -119,7 +125,7 @@ function HashtagItem({ search, onClick }: { search: string; onClick?: () => void
function NoteItem({ id, onClick }: { id: string; onClick?: () => void }) { function NoteItem({ id, onClick }: { id: string; onClick?: () => void }) {
return ( return (
<SecondaryPageLink to={toNote(id)} onClick={onClick}> <SecondaryPageLink to={toNote(id)} onClick={onClick}>
<CommandItem> <CommandItem value={`note-id-${id}`}>
<Notebook className="text-muted-foreground" /> <Notebook className="text-muted-foreground" />
<div className="font-semibold truncate">{id}</div> <div className="font-semibold truncate">{id}</div>
</CommandItem> </CommandItem>
@ -130,7 +136,7 @@ function NoteItem({ id, onClick }: { id: string; onClick?: () => void }) {
function ProfileIdItem({ id, onClick }: { id: string; onClick?: () => void }) { function ProfileIdItem({ id, onClick }: { id: string; onClick?: () => void }) {
return ( return (
<SecondaryPageLink to={toProfile(id)} onClick={onClick}> <SecondaryPageLink to={toProfile(id)} onClick={onClick}>
<CommandItem> <CommandItem value={`profile-id-${id}`}>
<UserRound className="text-muted-foreground" /> <UserRound className="text-muted-foreground" />
<div className="font-semibold truncate">{id}</div> <div className="font-semibold truncate">{id}</div>
</CommandItem> </CommandItem>
@ -141,7 +147,7 @@ function ProfileIdItem({ id, onClick }: { id: string; onClick?: () => void }) {
function ProfileItem({ profile, onClick }: { profile: TProfile; onClick?: () => void }) { function ProfileItem({ profile, onClick }: { profile: TProfile; onClick?: () => void }) {
return ( return (
<SecondaryPageLink to={toProfile(profile.pubkey)} onClick={onClick}> <SecondaryPageLink to={toProfile(profile.pubkey)} onClick={onClick}>
<CommandItem> <CommandItem value={`profile-${profile.pubkey}`}>
<div className="flex gap-2"> <div className="flex gap-2">
<Avatar> <Avatar>
<AvatarImage src={profile.avatar} alt={profile.username} /> <AvatarImage src={profile.avatar} alt={profile.username} />
@ -162,7 +168,7 @@ function ProfileItem({ profile, onClick }: { profile: TProfile; onClick?: () =>
function RelayItem({ url, onClick }: { url: string; onClick?: () => void }) { function RelayItem({ url, onClick }: { url: string; onClick?: () => void }) {
return ( return (
<SecondaryPageLink to={toRelay(url)} onClick={onClick}> <SecondaryPageLink to={toRelay(url)} onClick={onClick}>
<CommandItem> <CommandItem value={`relay-${url}`}>
<Server className="text-muted-foreground" /> <Server className="text-muted-foreground" />
<div className="font-semibold truncate">{url}</div> <div className="font-semibold truncate">{url}</div>
</CommandItem> </CommandItem>

Loading…
Cancel
Save