From 3d85598a2c77cf5a46664bf2e858a0f52edc08dd Mon Sep 17 00:00:00 2001 From: escapedcat Date: Tue, 12 Nov 2024 14:06:02 +0100 Subject: [PATCH] feat(home): use nextui input and checkbox --- src/pages/Home/SendModal/SendLN.tsx | 19 ++++++--- src/pages/Home/SendModal/SendOnChain.tsx | 52 ++++++++++++++++-------- 2 files changed, 48 insertions(+), 23 deletions(-) diff --git a/src/pages/Home/SendModal/SendLN.tsx b/src/pages/Home/SendModal/SendLN.tsx index 60344dd6..2898cce3 100644 --- a/src/pages/Home/SendModal/SendLN.tsx +++ b/src/pages/Home/SendModal/SendLN.tsx @@ -5,8 +5,8 @@ import { Alert } from "@/components/Alert"; import AvailableBalance from "@/components/AvailableBalance"; import { Button } from "@/components/Button"; import { ConfirmModal } from "@/components/ConfirmModal"; -import InputField from "@/components/InputField"; import { convertMSatToSat } from "@/utils/format"; +import { Input } from "@nextui-org/react"; import { FC, useState } from "react"; import type { SubmitHandler } from "react-hook-form"; import { useForm } from "react-hook-form"; @@ -60,7 +60,18 @@ const SendLn: FC = ({ - = ({ message: t("forms.validation.lnInvoice.patternMismatch"), }, })} - label={t("wallet.invoice")} - errorMessage={errors.invoice} - placeholder="lnbc..." - disabled={isLoading} /> {error && {error}} diff --git a/src/pages/Home/SendModal/SendOnChain.tsx b/src/pages/Home/SendModal/SendOnChain.tsx index 6ef339e1..0d36a146 100644 --- a/src/pages/Home/SendModal/SendOnChain.tsx +++ b/src/pages/Home/SendModal/SendOnChain.tsx @@ -4,8 +4,8 @@ import AmountInput from "@/components/AmountInput"; import AvailableBalance from "@/components/AvailableBalance"; import { Button } from "@/components/Button"; import { ConfirmModal } from "@/components/ConfirmModal"; -import InputField from "@/components/InputField"; -import { stringToNumber } from "@/utils/format"; +import { Checkbox } from "@nextui-org/checkbox"; +import { Input } from "@nextui-org/react"; import { ChangeEvent, FC, useState } from "react"; import type { SubmitHandler } from "react-hook-form"; import { useForm } from "react-hook-form"; @@ -67,7 +67,12 @@ const SendOnChain: FC = ({ balance, onConfirm, confirmData }) => {
- = ({ balance, onConfirm, confirmData }) => { })} placeholder="bc1..." label={t("wallet.address")} - errorMessage={errors.address} + isInvalid={!!errors.address} + errorMessage={errors.address?.message} />
@@ -95,9 +101,7 @@ const SendOnChain: FC = ({ balance, onConfirm, confirmData }) => { }, validate: { greaterThanZero: (val) => - //@ts-ignore - stringToNumber(val) > 0 || - t("forms.validation.chainAmount.required"), + val > 0 || t("forms.validation.chainAmount.required"), }, onChange: changeAmountHandler, })} @@ -106,28 +110,42 @@ const SendOnChain: FC = ({ balance, onConfirm, confirmData }) => { )}
- + + {t("tx.spend_all")} +
- + + sat / vByte + +
+ } />
-