Skip to content

Commit

Permalink
simplify search items
Browse files Browse the repository at this point in the history
  • Loading branch information
futurepaul committed Feb 1, 2024
1 parent 2c8f6c1 commit 59b1970
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 41 deletions.
1 change: 0 additions & 1 deletion src/components/ActualSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ export function ActualSearch(props: { initialValue?: string }) {
<ContactButton
contact={contact}
onClick={() => sendToContact(contact)}
inList
/>
)}
</For>
Expand Down
43 changes: 3 additions & 40 deletions src/components/ContactButton.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,14 @@
import { TagItem } from "@mutinywallet/mutiny-wasm";
import { createMemo, Show } from "solid-js";

import receive from "~/assets/icons/receive.svg";
import send from "~/assets/icons/send.svg";
import { LabelCircle } from "~/components";
import { useI18n } from "~/i18n/context";
import { PseudoContact } from "~/utils";

export function ContactButton(props: {
contact: PseudoContact | TagItem;
onClick: () => void;
inList?: boolean;
}) {
const i18n = useI18n();

const canSend = createMemo(() => {
return !!props.contact.ln_address || !!props.contact.lnurl;
});

return (
<div
class="flex items-center gap-2"
classList={{
"text-white/20 opacity-60": !canSend()
}}
>
<div class="flex items-center gap-2">
<LabelCircle
name={props.contact.name}
image_url={props.contact.primal_image_url}
Expand All @@ -36,31 +20,10 @@ export function ContactButton(props: {
<h2 class="overflow-hidden overflow-ellipsis text-base font-semibold">
{props.contact.name}
</h2>
<h3
class="overflow-hidden overflow-ellipsis text-left text-xs font-normal"
classList={{
"text-m-grey-400": canSend(),
"text-m-grey-700": !canSend()
}}
>
{props.contact.ln_address ||
props.contact.lnurl
?.toLowerCase()
.substring(0, 15)
.concat("...") ||
i18n.t("send.no_payment_info")}
<h3 class="overflow-hidden overflow-ellipsis text-left text-xs font-normal text-m-grey-400">
{props.contact.ln_address || ""}
</h3>
</div>
<Show when={canSend() && props.inList}>
<div class="flex gap-2">
<button onClick={() => {}}>
<img src={send} width={"24px"} height={"24px"} />
</button>
<button>
<img src={receive} width={"24px"} height={"24px"} />
</button>
</div>
</Show>
</div>
);
}

0 comments on commit 59b1970

Please sign in to comment.