mirror of
https://github.com/aljazceru/mutiny-web.git
synced 2025-12-19 07:14:22 +01:00
feat: use handleClose function
This commit is contained in:
@@ -247,6 +247,20 @@ export const AmountEditable: ParentComponent<{
|
||||
}
|
||||
}
|
||||
|
||||
function handleClose() {
|
||||
props.setAmountSats(BigInt(props.initialAmountSats));
|
||||
setIsOpen(false);
|
||||
setLocalSats(props.initialAmountSats);
|
||||
setLocalFiat(
|
||||
satsToUsd(
|
||||
state.price,
|
||||
parseInt(props.initialAmountSats || "0") || 0,
|
||||
false
|
||||
)
|
||||
);
|
||||
props.exitRoute && navigate(props.exitRoute);
|
||||
}
|
||||
|
||||
// What we're all here for in the first place: returning a value
|
||||
function handleSubmit(e: SubmitEvent | MouseEvent) {
|
||||
e.preventDefault();
|
||||
@@ -328,44 +342,12 @@ export const AmountEditable: ParentComponent<{
|
||||
<div class={DIALOG_POSITIONER}>
|
||||
<Dialog.Content
|
||||
class={DIALOG_CONTENT}
|
||||
onEscapeKeyDown={() => {
|
||||
props.setAmountSats(
|
||||
BigInt(props.initialAmountSats)
|
||||
);
|
||||
setIsOpen(false);
|
||||
setLocalSats(props.initialAmountSats);
|
||||
setLocalFiat(
|
||||
satsToUsd(
|
||||
state.price,
|
||||
parseInt(props.initialAmountSats || "0") ||
|
||||
0,
|
||||
false
|
||||
)
|
||||
);
|
||||
props.exitRoute && navigate(props.exitRoute);
|
||||
}}
|
||||
onEscapeKeyDown={handleClose}
|
||||
>
|
||||
{/* TODO: figure out how to submit on enter */}
|
||||
<div class="w-full flex justify-end">
|
||||
<button
|
||||
onClick={() => {
|
||||
props.setAmountSats(
|
||||
BigInt(props.initialAmountSats)
|
||||
);
|
||||
setIsOpen(false);
|
||||
setLocalSats(props.initialAmountSats);
|
||||
setLocalFiat(
|
||||
satsToUsd(
|
||||
state.price,
|
||||
parseInt(
|
||||
props.initialAmountSats || "0"
|
||||
) || 0,
|
||||
false
|
||||
)
|
||||
);
|
||||
props.exitRoute &&
|
||||
navigate(props.exitRoute);
|
||||
}}
|
||||
onClick={handleClose}
|
||||
class="hover:bg-white/10 rounded-lg active:bg-m-blue w-8 h-8"
|
||||
>
|
||||
<img src={close} alt="Close" />
|
||||
|
||||
@@ -42,7 +42,7 @@ export const WarningModal: ParentComponent<{
|
||||
}> = (props) => {
|
||||
const [open, setOpen] = createSignal(
|
||||
localStorage.getItem("betaWarned") !== "true" &&
|
||||
getExistingSettings().network === "bitcoin"
|
||||
getExistingSettings().network === "bitcoin"
|
||||
);
|
||||
|
||||
function close() {
|
||||
|
||||
@@ -11,7 +11,12 @@ export async function checkBrowserCompatibility(): Promise<boolean> {
|
||||
|
||||
// Check if the browser supports WebAssembly
|
||||
console.debug("Checking WebAssembly");
|
||||
if (typeof WebAssembly !== 'object' || !WebAssembly.validate(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00))) {
|
||||
if (
|
||||
typeof WebAssembly !== "object" ||
|
||||
!WebAssembly.validate(
|
||||
Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00)
|
||||
)
|
||||
) {
|
||||
throw new Error("WebAssembly is not supported.");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user