diff --git a/src/components/TagEditor.tsx b/src/components/TagEditor.tsx
index 9816a3f..af538c4 100644
--- a/src/components/TagEditor.tsx
+++ b/src/components/TagEditor.tsx
@@ -15,7 +15,7 @@ const createValue = (name: string): TextItem => {
return { id: createUniqueId(), name, kind: "text" };
};
-export function TagEditor(props: { title: string, values: TagItem[], setValues: (values: TagItem[]) => void, selectedValues: TagItem[], setSelectedValues: (values: TagItem[]) => void }) {
+export function TagEditor(props: { title: string, values: TagItem[], setValues: (values: TagItem[]) => void, selectedValues: TagItem[], setSelectedValues: (values: TagItem[]) => void, placeholder: string }) {
console.log(props.values);
const onChange = (selected: TagItem[]) => {
props.setSelectedValues(selected);
@@ -47,7 +47,7 @@ export function TagEditor(props: { title: string, values: TagItem[], setValues:
multiple
initialValue={props.selectedValues}
onChange={onChange}
- placeholder="Where's it coming from?"
+ placeholder={props.placeholder}
{...selectProps}
/>
diff --git a/src/routes/Receive.tsx b/src/routes/Receive.tsx
index db8e086..1ada186 100644
--- a/src/routes/Receive.tsx
+++ b/src/routes/Receive.tsx
@@ -91,9 +91,6 @@ export default function Receive() {
// Tagging stuff
const [selectedValues, setSelectedValues] = createSignal
([]);
-
- // const [tagItems] = createResource(listTags);
-
const [values, setValues] = createSignal([{ id: createUniqueId(), name: "Unknown", kind: "text" }]);
onMount(() => {
@@ -224,7 +221,7 @@ export default function Receive() {
-
+
diff --git a/src/routes/Send.tsx b/src/routes/Send.tsx
index 15b1786..816e17f 100644
--- a/src/routes/Send.tsx
+++ b/src/routes/Send.tsx
@@ -1,7 +1,7 @@
import { Match, Show, Switch, createEffect, createMemo, createResource, createSignal, onCleanup, onMount } from "solid-js";
import { Amount } from "~/components/Amount";
import NavBar from "~/components/NavBar";
-import { Button, ButtonLink, DefaultMain, HStack, LargeHeader, NodeManagerGuard, SafeArea, SmallHeader, VStack } from "~/components/layout";
+import { Button, ButtonLink, DefaultMain, HStack, LargeHeader, NodeManagerGuard, SafeArea, SmallAmount, SmallHeader, VStack } from "~/components/layout";
import { Paste } from "~/assets/svg/Paste";
import { Scan } from "~/assets/svg/Scan";
import { useMegaStore } from "~/state/megaStore";
@@ -17,23 +17,160 @@ import megaex from "~/assets/icons/megaex.png";
import mempoolTxUrl from "~/utils/mempoolTxUrl";
import { useNavigate } from "solid-start";
import { BackLink } from "~/components/layout/BackLink";
+import { TagEditor } from "~/components/TagEditor";
+import { TagItem, createUniqueId, listTags } from "~/state/contacts";
type SendSource = "lightning" | "onchain";
const PAYMENT_METHODS = [{ value: "lightning", label: "Lightning", caption: "Fast and cool" }, { value: "onchain", label: "On-chain", caption: "Just like Satoshi did it" }]
-// const TEST_DEST = "bitcoin:tb1pdh43en28jmhnsrhxkusja46aufdlae5qnfrhucw5jvefw9flce3sdxfcwe?amount=0.00001&label=heyo&lightning=lntbs10u1pjrwrdedq8dpjhjmcnp4qd60w268ve0jencwzhz048ruprkxefhj0va2uspgj4q42azdg89uupp5gngy2pqte5q5uvnwcxwl2t8fsdlla5s6xl8aar4xcsvxeus2w2pqsp5n5jp3pz3vpu92p3uswttxmw79a5lc566herwh3f2amwz2sp6f9tq9qyysgqcqpcxqrpwugv5m534ww5ukcf6sdw2m75f2ntjfh3gzeqay649256yvtecgnhjyugf74zakaf56sdh66ec9fqep2kvu6xv09gcwkv36rrkm38ylqsgpw3yfjl"
-// const TEST_DEST_ADDRESS = "tb1pdh43en28jmhnsrhxkusja46aufdlae5qnfrhucw5jvefw9flce3sdxfcwe"
+const TEST_DEST = "bitcoin:tb1pdh43en28jmhnsrhxkusja46aufdlae5qnfrhucw5jvefw9flce3sdxfcwe?amount=0.00001&label=heyo&lightning=lntbs10u1pjrwrdedq8dpjhjmcnp4qd60w268ve0jencwzhz048ruprkxefhj0va2uspgj4q42azdg89uupp5gngy2pqte5q5uvnwcxwl2t8fsdlla5s6xl8aar4xcsvxeus2w2pqsp5n5jp3pz3vpu92p3uswttxmw79a5lc566herwh3f2amwz2sp6f9tq9qyysgqcqpcxqrpwugv5m534ww5ukcf6sdw2m75f2ntjfh3gzeqay649256yvtecgnhjyugf74zakaf56sdh66ec9fqep2kvu6xv09gcwkv36rrkm38ylqsgpw3yfjl"
+const TEST_DEST_ADDRESS = "tb1pdh43en28jmhnsrhxkusja46aufdlae5qnfrhucw5jvefw9flce3sdxfcwe"
// TODO: better success / fail type
type SentDetails = { amount?: bigint, destination?: string, txid?: string, failure_reason?: string }
+function MethodChooser(props: { source: SendSource, setSource: (source: string) => void }) {
+ const [store, actions] = useMegaStore();
+
+ const amount = createMemo(() => {
+ if (props.source === "lightning") {
+ return store.balance?.lightning
+ } else {
+ return store.balance?.confirmed
+ }
+ })
+ return (
+
+
+ Payment Method
+
+
+ Current balance
+
+ )
+}
+
+function DestinationInput(props: {
+ fieldDestination: string,
+ setFieldDestination: (destination: string) => void,
+ handleDecode: () => void,
+ handlePaste: () => void,
+}) {
+ return (
+
+ Destination
+
+ )
+}
+
+function DestinationShower(props: {
+ source: SendSource,
+ description?: string,
+ address?: string,
+ invoice?: MutinyInvoice,
+ nodePubkey?: string,
+ clearAll: () => void,
+}) {
+ return (
+
+ Destination
+
+
+ {"Address: "} {props.address}
+
+
+ {"Description:"} {props.description}
+
+
+
+
+ {"Invoice: "} {props.invoice?.bolt11}
+
+
+ {"Description:"} {props.description}
+
+
+
+
+ {"Node Pubkey: "} {props.nodePubkey}
+
+
+
+
+
+
+ )
+}
+
+function AmountThing(props: { invoice?: MutinyInvoice, amountSats: bigint, fakeFee: bigint, setAmountSats: (amount: bigint) => void }) {
+ return (
+
+ Amount
+
+
+ {/* if the amount came with the invoice we can't allow setting it */}
+
}>
+
+
+
+
+
+ Fee
+
+ {props.fakeFee.toLocaleString()} SATS
+
+
+
+
Total
+
+ {(props.amountSats.valueOf() + props.fakeFee.valueOf()).toLocaleString()} SATS
+
+
+
+
+
+ )
+}
+
+function SendTags() {
+ // Tagging stuff
+ const [selectedValues, setSelectedValues] = createSignal([]);
+ const [values, setValues] = createSignal([{ id: createUniqueId(), name: "Unknown", kind: "text" }]);
+
+ onMount(() => {
+ listTags().then((tags) => {
+ setValues(prev => [...prev, ...tags || []])
+ });
+ })
+
+ return (
+
+ )
+}
+
+
export default function Send() {
const [state, actions] = useMegaStore();
const navigate = useNavigate()
// These can only be set by the user
- const [fieldDestination, setFieldDestination] = createSignal("");
+ const [fieldDestination, setFieldDestination] = createSignal(TEST_DEST);
const [destination, setDestination] = createSignal();
const [privateLabel, setPrivateLabel] = createSignal("");
@@ -226,94 +363,24 @@ export default function Send() {
-
- -
- Destination
-
- -
-
-
-
-
- {"Address: "} {address()}
-
-
- {"Description:"} {description()}
-
-
-
-
- {"Invoice: "} {invoice()?.bolt11}
-
-
- {"Description:"} {description()}
-
-
-
-
- {"Node Pubkey: "} {nodePubkey()}
-
-
-
-
-
-
- {/* if the amount came with the invoice we can't allow setting it */}
-
}>
-
-
-
-
-
+ Fee
-
- {fakeFee().toLocaleString()} SATS
-
-
-
-
Total
-
- {(amountSats().valueOf() + fakeFee().valueOf()).toLocaleString()} SATS
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
- Payment Method
-
-
- -
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+