add a "why" to fee warnings

This commit is contained in:
Paul Miller
2023-06-08 12:12:10 -05:00
committed by Tony Giorgio
parent 3eba44f8c7
commit fe22e4cc8c
7 changed files with 86 additions and 16 deletions

View File

@@ -16,6 +16,7 @@ import { InlineAmount } from "./AmountCard";
import { DIALOG_CONTENT, DIALOG_POSITIONER } from "~/styles/dialogs"; import { DIALOG_CONTENT, DIALOG_POSITIONER } from "~/styles/dialogs";
import { InfoBox } from "./InfoBox"; import { InfoBox } from "./InfoBox";
import { Network } from "~/logic/mutinyWalletSetup"; import { Network } from "~/logic/mutinyWalletSetup";
import { FeesModal } from "./MoreInfoModal";
const CHARACTERS = [ const CHARACTERS = [
"1", "1",
@@ -172,9 +173,9 @@ export const AmountEditable: ParentComponent<{
if ((state.balance?.lightning || 0n) === 0n) { if ((state.balance?.lightning || 0n) === 0n) {
const network = state.mutiny_wallet?.get_network() as Network; const network = state.mutiny_wallet?.get_network() as Network;
if (network === "bitcoin") { if (network === "bitcoin") {
return "Your first lightning receive needs to be 50,000 sats or greater."; return "Your first lightning receive needs to be 50,000 sats or greater. A setup fee will be deducted from the requested amount.";
} else { } else {
return "Your first lightning receive needs to be 10,000 sats or greater."; return "Your first lightning receive needs to be 10,000 sats or greater. A setup fee will be deducted from the requested amount.";
} }
} }
@@ -357,8 +358,8 @@ export const AmountEditable: ParentComponent<{
/> />
</div> </div>
<Show when={warningText()}> <Show when={warningText()}>
<InfoBox accent="green"> <InfoBox accent="blue">
{warningText()} {warningText()} <FeesModal />
</InfoBox> </InfoBox>
</Show> </Show>
<div class="flex justify-center gap-4 my-2"> <div class="flex justify-center gap-4 my-2">

View File

@@ -51,7 +51,7 @@ export default function App() {
</A> </A>
</Show> </Show>
</Card> </Card>
<p class="self-center text-neutral-500 mt-4"> <p class="self-center text-neutral-500 mt-4 font-normal">
Bugs? Feedback?{" "} Bugs? Feedback?{" "}
<span class="text-neutral-400"> <span class="text-neutral-400">
<ExternalLink href="https://github.com/MutinyWallet/mutiny-web/issues"> <ExternalLink href="https://github.com/MutinyWallet/mutiny-web/issues">

View File

@@ -9,7 +9,7 @@ export const InfoBox: ParentComponent<{
class="grid grid-cols-[auto_minmax(0,_1fr)] rounded-xl px-4 py-2 md:p-4 gap-4 bg-neutral-950/50 border" class="grid grid-cols-[auto_minmax(0,_1fr)] rounded-xl px-4 py-2 md:p-4 gap-4 bg-neutral-950/50 border"
classList={{ classList={{
"border-m-red": props.accent === "red", "border-m-red": props.accent === "red",
"border-m-blue": props.accent === "blue", "border-m-blue bg-m-blue/10": props.accent === "blue",
"border-m-green": props.accent === "green", "border-m-green": props.accent === "green",
"border-white": props.accent === "white" "border-white": props.accent === "white"
}} }}
@@ -18,7 +18,7 @@ export const InfoBox: ParentComponent<{
<img src={info} alt="info" class="w-8 h-8" /> <img src={info} alt="info" class="w-8 h-8" />
</div> </div>
<div class="flex items-center"> <div class="flex items-center">
<p class="text-base font-light">{props.children}</p> <p class="text-sm font-light">{props.children}</p>
</div> </div>
</div> </div>
); );

View File

@@ -0,0 +1,60 @@
import { Dialog } from "@kobalte/core";
import { ParentComponent, createSignal } from "solid-js";
import { DIALOG_CONTENT, DIALOG_POSITIONER, OVERLAY } from "./DetailsModal";
import { ModalCloseButton, SmallHeader } from "./layout";
import { ExternalLink } from "./layout/ExternalLink";
export function FeesModal() {
return (
<MoreInfoModal title="What's with the fees?" linkText="Why?">
<p>
Mutiny is a self-custodial wallet. To initiate a lightning
payment we must open a lightning channel, which requires a
minimum amount and a setup fee.
</p>
<p>
Future payments, both send and recieve, will only incur normal
network fees and a nominal service fee unless your channel runs
out of inbound capacity.
</p>
<p>
<ExternalLink href="https://github.com/MutinyWallet/mutiny-web/wiki/Understanding-liquidity">
Learn more about liquidity
</ExternalLink>
</p>
</MoreInfoModal>
);
}
export const MoreInfoModal: ParentComponent<{
linkText: string;
title: string;
}> = (props) => {
const [open, setOpen] = createSignal(false);
return (
<Dialog.Root open={open()} onOpenChange={setOpen}>
<Dialog.Trigger>
<button class="underline decoration-light-text hover:decoration-white font-semibold">
{props.linkText}
</button>
</Dialog.Trigger>
<Dialog.Portal>
<Dialog.Overlay class={OVERLAY} />
<div class={DIALOG_POSITIONER}>
<Dialog.Content class={DIALOG_CONTENT}>
<Dialog.Title class="flex justify-between mb-2 items-center">
<SmallHeader>{props.title}</SmallHeader>
<Dialog.CloseButton>
<ModalCloseButton />
</Dialog.CloseButton>
</Dialog.Title>
<Dialog.Description class="flex flex-col gap-4">
<div>{props.children}</div>
</Dialog.Description>
</Dialog.Content>
</div>
</Dialog.Portal>
</Dialog.Root>
);
};

View File

@@ -185,7 +185,7 @@ export const SmallAmount: ParentComponent<{
}; };
export const NiceP: ParentComponent = (props) => { export const NiceP: ParentComponent = (props) => {
return <p class="text-xl font-light">{props.children}</p>; return <p class="text-xl font-light text-neutral-200">{props.children}</p>;
}; };
export const TinyText: ParentComponent = (props) => { export const TinyText: ParentComponent = (props) => {

View File

@@ -24,6 +24,14 @@ a {
@apply underline decoration-light-text hover:decoration-white; @apply underline decoration-light-text hover:decoration-white;
} }
p {
@apply font-light;
}
p:not(:last-child) {
@apply mb-2;
}
#video-container { #video-container {
position: relative; position: relative;
width: max-content; width: max-content;

View File

@@ -42,6 +42,7 @@ import { MegaCheck } from "~/components/successfail/MegaCheck";
import { ExternalLink } from "~/components/layout/ExternalLink"; import { ExternalLink } from "~/components/layout/ExternalLink";
import { CopyableQR } from "~/components/CopyableQR"; import { CopyableQR } from "~/components/CopyableQR";
import { InfoBox } from "~/components/InfoBox"; import { InfoBox } from "~/components/InfoBox";
import { FeesModal } from "~/components/MoreInfoModal";
type OnChainTx = { type OnChainTx = {
transaction: { transaction: {
@@ -83,17 +84,17 @@ function FeeWarning(props: { fee: bigint; flavor: ReceiveFlavor }) {
<Show when={props.fee > 1000n}> <Show when={props.fee > 1000n}>
<Switch> <Switch>
<Match when={props.flavor === "unified"}> <Match when={props.flavor === "unified"}>
<InfoBox accent="green"> <InfoBox accent="blue">
A lightning setup fee of{" "} A lightning setup fee of{" "}
<AmountSmall amountSats={props.fee} /> will be charged <AmountSmall amountSats={props.fee} /> will be charged
if paid over lightning. if paid over lightning. <FeesModal />
</InfoBox> </InfoBox>
</Match> </Match>
<Match when={props.flavor === "lightning"}> <Match when={props.flavor === "lightning"}>
<InfoBox accent="green"> <InfoBox accent="blue">
A lightning setup fee of{" "} A lightning setup fee of{" "}
<AmountSmall amountSats={props.fee} /> will be charged <AmountSmall amountSats={props.fee} /> will be charged
for this receive. for this receive. <FeesModal />
</InfoBox> </InfoBox>
</Match> </Match>
</Switch> </Switch>
@@ -106,17 +107,17 @@ function FeeExplanation(props: { fee: bigint }) {
// TODO: probably won't always be a fixed 2500? // TODO: probably won't always be a fixed 2500?
<Switch> <Switch>
<Match when={props.fee > 1000n}> <Match when={props.fee > 1000n}>
<InfoBox accent="green"> <InfoBox accent="blue">
A lightning setup fee of{" "} A lightning setup fee of{" "}
<AmountSmall amountSats={props.fee} /> was charged for this <AmountSmall amountSats={props.fee} /> was charged for this
receive. receive. <FeesModal />
</InfoBox> </InfoBox>
</Match> </Match>
<Match when={props.fee > 0n}> <Match when={props.fee > 0n}>
<InfoBox accent="green"> <InfoBox accent="blue">
A lightning service fee of{" "} A lightning service fee of{" "}
<AmountSmall amountSats={props.fee} /> was charged for this <AmountSmall amountSats={props.fee} /> was charged for this
receive. receive. <FeesModal />
</InfoBox> </InfoBox>
</Match> </Match>
</Switch> </Switch>