mirror of
https://github.com/aljazceru/mutiny-web.git
synced 2025-12-23 17:14:23 +01:00
fix some lints
This commit is contained in:
@@ -236,7 +236,7 @@ export function CombinedActivity(props: { limit?: number }) {
|
|||||||
const txs = await state.mutiny_wallet?.list_onchain() as OnChainTx[];
|
const txs = await state.mutiny_wallet?.list_onchain() as OnChainTx[];
|
||||||
const invoices = await state.mutiny_wallet?.list_invoices() as MutinyInvoice[];
|
const invoices = await state.mutiny_wallet?.list_invoices() as MutinyInvoice[];
|
||||||
|
|
||||||
let activity: ActivityItem[] = [];
|
const activity: ActivityItem[] = [];
|
||||||
|
|
||||||
txs.forEach((tx) => {
|
txs.forEach((tx) => {
|
||||||
activity.push({ type: "onchain", item: tx, time: tx.confirmation_time?.Confirmed?.time || Date.now() })
|
activity.push({ type: "onchain", item: tx, time: tx.confirmation_time?.Confirmed?.time || Date.now() })
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ import { useMegaStore } from "~/state/megaStore";
|
|||||||
import { satsToUsd } from "~/utils/conversions";
|
import { satsToUsd } from "~/utils/conversions";
|
||||||
import { AmountEditable } from "./AmountEditable";
|
import { AmountEditable } from "./AmountEditable";
|
||||||
|
|
||||||
|
const noop = () => {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
const KeyValue: ParentComponent<{ key: string, gray?: boolean }> = (props) => {
|
const KeyValue: ParentComponent<{ key: string, gray?: boolean }> = (props) => {
|
||||||
return (
|
return (
|
||||||
<div class="flex justify-between items-center" classList={{ "text-neutral-400": props.gray }}>
|
<div class="flex justify-between items-center" classList={{ "text-neutral-400": props.gray }}>
|
||||||
@@ -54,7 +58,7 @@ export function AmountCard(props: { amountSats: string, fee?: string, initialOpe
|
|||||||
<KeyValue key="Amount">
|
<KeyValue key="Amount">
|
||||||
<Show when={props.isAmountEditable} fallback={<InlineAmount amount={props.amountSats} />
|
<Show when={props.isAmountEditable} fallback={<InlineAmount amount={props.amountSats} />
|
||||||
}>
|
}>
|
||||||
<AmountEditable initialOpen={props.initialOpen ?? false} initialAmountSats={props.amountSats.toString()} setAmountSats={props.setAmountSats ? props.setAmountSats : () => { }} />
|
<AmountEditable initialOpen={props.initialOpen ?? false} initialAmountSats={props.amountSats.toString()} setAmountSats={props.setAmountSats ? props.setAmountSats : noop} />
|
||||||
</Show>
|
</Show>
|
||||||
</KeyValue>
|
</KeyValue>
|
||||||
<KeyValue gray key="+ Fee">
|
<KeyValue gray key="+ Fee">
|
||||||
@@ -74,7 +78,7 @@ export function AmountCard(props: { amountSats: string, fee?: string, initialOpe
|
|||||||
<KeyValue key="Amount">
|
<KeyValue key="Amount">
|
||||||
<Show when={props.isAmountEditable} fallback={<InlineAmount amount={props.amountSats} />
|
<Show when={props.isAmountEditable} fallback={<InlineAmount amount={props.amountSats} />
|
||||||
}>
|
}>
|
||||||
<AmountEditable initialOpen={props.initialOpen ?? false} initialAmountSats={props.amountSats.toString()} setAmountSats={props.setAmountSats ? props.setAmountSats : () => { }} />
|
<AmountEditable initialOpen={props.initialOpen ?? false} initialAmountSats={props.amountSats.toString()} setAmountSats={props.setAmountSats ? props.setAmountSats : noop} />
|
||||||
</Show>
|
</Show>
|
||||||
</KeyValue>
|
</KeyValue>
|
||||||
<USDShower amountSats={props.amountSats} />
|
<USDShower amountSats={props.amountSats} />
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import close from "~/assets/icons/close.svg";
|
|||||||
import { SubmitHandler } from '@modular-forms/solid';
|
import { SubmitHandler } from '@modular-forms/solid';
|
||||||
import { ContactItem } from '~/state/contacts';
|
import { ContactItem } from '~/state/contacts';
|
||||||
import { ContactForm } from './ContactForm';
|
import { ContactForm } from './ContactForm';
|
||||||
|
import { showToast } from './Toaster';
|
||||||
|
|
||||||
export function ContactViewer(props: { contact: ContactItem, gradient: string, saveContact: (contact: ContactItem) => void }) {
|
export function ContactViewer(props: { contact: ContactItem, gradient: string, saveContact: (contact: ContactItem) => void }) {
|
||||||
const [isOpen, setIsOpen] = createSignal(false);
|
const [isOpen, setIsOpen] = createSignal(false);
|
||||||
@@ -58,7 +59,7 @@ export function ContactViewer(props: { contact: ContactItem, gradient: string, s
|
|||||||
|
|
||||||
<div class="flex w-full gap-2">
|
<div class="flex w-full gap-2">
|
||||||
<Button layout="flex" intent="green" onClick={() => setIsEditing(true)}>Edit</Button>
|
<Button layout="flex" intent="green" onClick={() => setIsEditing(true)}>Edit</Button>
|
||||||
<Button intent="blue" onClick={() => { }}>Pay</Button>
|
<Button intent="blue" onClick={() => { showToast({ title: "Unimplemented", description: "We don't do that yet" }) }}>Pay</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Match>
|
</Match>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export function ImportExport() {
|
|||||||
const [state, _] = useMegaStore()
|
const [state, _] = useMegaStore()
|
||||||
|
|
||||||
async function handleSave() {
|
async function handleSave() {
|
||||||
let json = await state.node_manager?.export_json()
|
const json = await state.node_manager?.export_json()
|
||||||
downloadTextFile(json || "", "mutiny-state.json")
|
downloadTextFile(json || "", "mutiny-state.json")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { Show, createSignal, onMount } from "solid-js";
|
import { Show, createSignal, onMount } from "solid-js";
|
||||||
import { Button, ButtonLink, SmallHeader, VStack } from "./layout";
|
import { Button, ButtonLink, SmallHeader, VStack } from "./layout";
|
||||||
import { useMegaStore } from "~/state/megaStore";
|
import { useMegaStore } from "~/state/megaStore";
|
||||||
|
import { showToast } from "./Toaster";
|
||||||
|
|
||||||
export function OnboardWarning() {
|
export function OnboardWarning() {
|
||||||
const [state, actions] = useMegaStore();
|
const [state, actions] = useMegaStore();
|
||||||
@@ -25,7 +26,7 @@ export function OnboardWarning() {
|
|||||||
Do you want to restore an existing Mutiny Wallet?
|
Do you want to restore an existing Mutiny Wallet?
|
||||||
</p>
|
</p>
|
||||||
<div class="w-full flex gap-2">
|
<div class="w-full flex gap-2">
|
||||||
<Button intent="green" onClick={() => { }}>Restore</Button>
|
<Button intent="green" onClick={() => { showToast({ title: "Unimplemented", description: "We don't do that yet" }) }}>Restore</Button>
|
||||||
<Button onClick={actions.dismissRestorePrompt}>Nope</Button>
|
<Button onClick={actions.dismissRestorePrompt}>Nope</Button>
|
||||||
</div>
|
</div>
|
||||||
</VStack>
|
</VStack>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Back } from "~/assets/svg/Back";
|
import { Back } from "~/assets/svg/Back";
|
||||||
|
|
||||||
export function BackButton(props: { onClick: () => void, title?: string }) {
|
export function BackButton(props: { onClick: () => void, title?: string }) {
|
||||||
return (<button onClick={props.onClick} class="text-m-red active:text-m-red/80 text-xl font-semibold no-underline md:hidden flex items-center"><Back />{props.title ? props.title : "Home"}</button>)
|
return (<button onClick={() => props.onClick()} class="text-m-red active:text-m-red/80 text-xl font-semibold no-underline md:hidden flex items-center"><Back />{props.title ? props.title : "Home"}</button>)
|
||||||
}
|
}
|
||||||
@@ -123,7 +123,7 @@ export const NiceP: ParentComponent = (props) => {
|
|||||||
|
|
||||||
export const TinyButton: ParentComponent<{ onClick: () => void }> = (props) => {
|
export const TinyButton: ParentComponent<{ onClick: () => void }> = (props) => {
|
||||||
return (
|
return (
|
||||||
<button class="py-1 px-2 rounded-lg bg-white/10" onClick={props.onClick}>
|
<button class="py-1 px-2 rounded-lg bg-white/10" onClick={() => props.onClick()}>
|
||||||
{props.children}
|
{props.children}
|
||||||
</button>
|
</button>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { For, Show, createResource } from "solid-js";
|
import { For, Show, createResource } from "solid-js";
|
||||||
import NavBar from "~/components/NavBar";
|
import NavBar from "~/components/NavBar";
|
||||||
import { Button, Card, DefaultMain, LargeHeader, NiceP, NodeManagerGuard, SafeArea, SmallHeader, VStack } from "~/components/layout";
|
import { Button, Card, DefaultMain, LargeHeader, NiceP, NodeManagerGuard, SafeArea, VStack } from "~/components/layout";
|
||||||
import { BackLink } from "~/components/layout/BackLink";
|
import { BackLink } from "~/components/layout/BackLink";
|
||||||
import { CombinedActivity, Activity as MutinyActivity } from "~/components/Activity";
|
import { CombinedActivity } from "~/components/Activity";
|
||||||
import { A } from "solid-start";
|
import { A } from "solid-start";
|
||||||
import settings from '~/assets/icons/settings.svg';
|
import settings from '~/assets/icons/settings.svg';
|
||||||
import { ContactItem, addContact, editContact, listContacts } from "~/state/contacts";
|
import { ContactItem, addContact, editContact, listContacts } from "~/state/contacts";
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ export default function Receive() {
|
|||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
<div class="flex-1" />
|
<div class="flex-1" />
|
||||||
<Button class="w-full flex-grow-0 mb-4" style="" disabled={!amount() || !selectedValues().length} intent="green" onClick={onSubmit}>Create Invoice</Button>
|
<Button class="w-full flex-grow-0 mb-4" disabled={!amount() || !selectedValues().length} intent="green" onClick={onSubmit}>Create Invoice</Button>
|
||||||
</div>
|
</div>
|
||||||
</Match>
|
</Match>
|
||||||
<Match when={unified() && receiveState() === "show"}>
|
<Match when={unified() && receiveState() === "show"}>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import Reader from "~/components/Reader";
|
import Reader from "~/components/Reader";
|
||||||
import { createEffect, createSignal, onMount, Show } from "solid-js";
|
import { createEffect, createSignal, onMount } from "solid-js";
|
||||||
import { useNavigate } from "solid-start";
|
import { useNavigate } from "solid-start";
|
||||||
import { Button } from "~/components/layout";
|
import { Button } from "~/components/layout";
|
||||||
import init, { PaymentParams } from "@mutinywallet/waila-wasm";
|
import init, { PaymentParams } from "@mutinywallet/waila-wasm";
|
||||||
@@ -76,12 +76,8 @@ export default function Scanner() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let waila;
|
onMount(async () => {
|
||||||
|
await init()
|
||||||
onMount(() => {
|
|
||||||
init().then((w) => {
|
|
||||||
waila = w;
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// When we have a nice result we can head over to the send screen
|
// When we have a nice result we can head over to the send screen
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
export function downloadTextFile(content: string, fileName: string) {
|
export function downloadTextFile(content: string, fileName: string) {
|
||||||
const contentType = "application/json";
|
const contentType = "application/json";
|
||||||
var a = document.createElement("a");
|
const a = document.createElement("a");
|
||||||
var file = new Blob([content], { type: contentType });
|
const file = new Blob([content], { type: contentType });
|
||||||
a.href = URL.createObjectURL(file);
|
a.href = URL.createObjectURL(file);
|
||||||
a.download = fileName;
|
a.download = fileName;
|
||||||
a.click();
|
a.click();
|
||||||
|
|||||||
@@ -14,9 +14,7 @@ async function generateGradientFromHashedString(str: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function gradientsPerContact(contacts: ContactItem[]) {
|
export async function gradientsPerContact(contacts: ContactItem[]) {
|
||||||
//
|
const gradients = new Map();
|
||||||
// let gradients: { [key: string]: string } = {};
|
|
||||||
let gradients = new Map();
|
|
||||||
for (const contact of contacts) {
|
for (const contact of contacts) {
|
||||||
const gradient = await generateGradientFromHashedString(contact.name);
|
const gradient = await generateGradientFromHashedString(contact.name);
|
||||||
gradients.set(contact.id, gradient);
|
gradients.set(contact.id, gradient);
|
||||||
|
|||||||
Reference in New Issue
Block a user