diff --git a/src/routes/Search.tsx b/src/routes/Search.tsx index 40781c15..8b84c612 100644 --- a/src/routes/Search.tsx +++ b/src/routes/Search.tsx @@ -7,9 +7,11 @@ import { createResource, createSignal, For, + Match, onMount, Show, - Suspense + Suspense, + Switch } from "solid-js"; import close from "~/assets/icons/close.svg"; @@ -19,6 +21,7 @@ import { ContactEditor, ContactFormValues, LabelCircle, + LoadingShimmer, NavBar, showToast } from "~/components"; @@ -31,6 +34,13 @@ import { } from "~/components/layout"; import { useI18n } from "~/i18n/context"; import { useMegaStore } from "~/state/megaStore"; +import { + actuallyFetchNostrProfile, + hexpubFromNpub, + profileToPseudoContact, + PseudoContact, + searchProfiles +} from "~/utils"; export function Search() { return ( @@ -65,7 +75,6 @@ function ActualSearch() { async function contactsFetcher() { try { - console.log("getting contacts"); const contacts: TagItem[] = state.mutiny_wallet?.get_contacts_sorted(); return contacts || []; @@ -78,11 +87,10 @@ function ActualSearch() { const [contacts] = createResource(contactsFetcher); const filteredContacts = createMemo(() => { + const s = searchValue().toLowerCase(); return ( contacts()?.filter((c) => { - const s = searchValue().toLowerCase(); return ( - // c.ln_address && (c.name.toLowerCase().includes(s) || c.ln_address?.toLowerCase().includes(s) || @@ -92,6 +100,14 @@ function ActualSearch() { ); }); + const foundNpubs = createMemo(() => { + return ( + filteredContacts() + ?.map((c) => c.npub) + .filter((n) => !!n) || [] + ); + }); + const showSendButton = createMemo(() => { if (searchValue() === "") { return false; @@ -104,12 +120,10 @@ function ActualSearch() { let success = false; actions.handleIncomingString( text, - (error) => { - // showToast(error); - console.log("error", error); + (_error) => { + // noop }, - (result) => { - console.log("result", result); + (_result) => { success = true; } ); @@ -258,7 +272,7 @@ function ActualSearch() { Continue -
+ No results found for "{props.searchValue}" +
+