mirror of
https://github.com/aljazceru/mutiny-web.git
synced 2026-01-29 11:04:20 +01:00
add load bar home and emergency kit
This commit is contained in:
@@ -2,63 +2,9 @@ import Reader from "~/components/Reader";
|
||||
import { createEffect, createSignal } from "solid-js";
|
||||
import { useNavigate } from "solid-start";
|
||||
import { Button } from "~/components/layout";
|
||||
import { PaymentParams } from "@mutinywallet/waila-wasm";
|
||||
import { showToast } from "~/components/Toaster";
|
||||
import { useMegaStore } from "~/state/megaStore";
|
||||
import { Result } from "~/utils/typescript";
|
||||
|
||||
export type ParsedParams = {
|
||||
address?: string;
|
||||
invoice?: string;
|
||||
amount_sats?: bigint;
|
||||
network?: string;
|
||||
memo?: string;
|
||||
node_pubkey?: string;
|
||||
lnurl?: string;
|
||||
};
|
||||
|
||||
export function toParsedParams(
|
||||
str: string,
|
||||
ourNetwork: string
|
||||
): Result<ParsedParams> {
|
||||
let params;
|
||||
try {
|
||||
params = new PaymentParams(str || "");
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return { ok: false, error: new Error("Invalid payment request") };
|
||||
}
|
||||
|
||||
// If WAILA doesn't return a network we should default to our own
|
||||
// If the networks is testnet and we're on signet we should use signet
|
||||
const network = !params.network
|
||||
? ourNetwork
|
||||
: params.network === "testnet" && ourNetwork === "signet"
|
||||
? "signet"
|
||||
: params.network;
|
||||
|
||||
if (network !== ourNetwork) {
|
||||
return {
|
||||
ok: false,
|
||||
error: new Error(
|
||||
`Destination is for ${params.network} but you're on ${ourNetwork}`
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
ok: true,
|
||||
value: {
|
||||
address: params.address,
|
||||
invoice: params.invoice,
|
||||
amount_sats: params.amount_sats,
|
||||
network,
|
||||
memo: params.memo,
|
||||
node_pubkey: params.node_pubkey,
|
||||
lnurl: params.lnurl
|
||||
}
|
||||
};
|
||||
}
|
||||
import { toParsedParams } from "~/logic/waila";
|
||||
|
||||
export default function Scanner() {
|
||||
const [state, actions] = useMegaStore();
|
||||
|
||||
@@ -26,7 +26,6 @@ import { Scan } from "~/assets/svg/Scan";
|
||||
import { useMegaStore } from "~/state/megaStore";
|
||||
import { Contact, MutinyInvoice } from "@mutinywallet/mutiny-wasm";
|
||||
import { StyledRadioGroup } from "~/components/layout/Radio";
|
||||
import { ParsedParams, toParsedParams } from "./Scanner";
|
||||
import { showToast } from "~/components/Toaster";
|
||||
import eify from "~/utils/eify";
|
||||
import megacheck from "~/assets/icons/megacheck.png";
|
||||
@@ -44,6 +43,7 @@ import { SuccessModal } from "~/components/successfail/SuccessModal";
|
||||
import { ExternalLink } from "~/components/layout/ExternalLink";
|
||||
import { InfoBox } from "~/components/InfoBox";
|
||||
import { useI18n } from "~/i18n/context";
|
||||
import { ParsedParams, toParsedParams } from "~/logic/waila";
|
||||
|
||||
export type SendSource = "lightning" | "onchain";
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { DeleteEverything } from "~/components/DeleteEverything";
|
||||
import { ImportExport } from "~/components/ImportExport";
|
||||
import { LoadingIndicator } from "~/components/LoadingIndicator";
|
||||
import { Logs } from "~/components/Logs";
|
||||
import NavBar from "~/components/NavBar";
|
||||
import {
|
||||
@@ -13,6 +14,19 @@ import {
|
||||
import { BackLink } from "~/components/layout/BackLink";
|
||||
import { ExternalLink } from "~/components/layout/ExternalLink";
|
||||
|
||||
function EmergencyStack() {
|
||||
return (
|
||||
<VStack>
|
||||
<ImportExport emergency />
|
||||
<Logs />
|
||||
<div class="rounded-xl p-4 flex flex-col gap-2 bg-m-red overflow-x-hidden">
|
||||
<SmallHeader>Danger zone</SmallHeader>
|
||||
<DeleteEverything emergency />
|
||||
</div>
|
||||
</VStack>
|
||||
);
|
||||
}
|
||||
|
||||
export default function EmergencyKit() {
|
||||
return (
|
||||
<SafeArea>
|
||||
@@ -20,6 +34,7 @@ export default function EmergencyKit() {
|
||||
<BackLink href="/settings" title="Settings" />
|
||||
<LargeHeader>Emergency Kit</LargeHeader>
|
||||
<VStack>
|
||||
<LoadingIndicator />
|
||||
<NiceP>
|
||||
If your wallet seems broken, here are some tools to try
|
||||
to debug and repair it.
|
||||
@@ -31,12 +46,7 @@ export default function EmergencyKit() {
|
||||
reach out to us for support.
|
||||
</ExternalLink>
|
||||
</NiceP>
|
||||
<ImportExport emergency />
|
||||
<Logs />
|
||||
<div class="rounded-xl p-4 flex flex-col gap-2 bg-m-red overflow-x-hidden">
|
||||
<SmallHeader>Danger zone</SmallHeader>
|
||||
<DeleteEverything emergency />
|
||||
</div>
|
||||
<EmergencyStack />
|
||||
</VStack>
|
||||
</DefaultMain>
|
||||
<NavBar activeTab="settings" />
|
||||
|
||||
Reference in New Issue
Block a user