From fa12cd74d7cc8e84a7b738123ea505d3c922fb4f Mon Sep 17 00:00:00 2001 From: i701 Date: Tue, 8 Jul 2025 21:09:17 +0500 Subject: [PATCH] =?UTF-8?q?refactor:=20use=20single=20seperate=20AccountIn?= =?UTF-8?q?fomation=20component=20and=20integrate=20it=20into=20DevicesToP?= =?UTF-8?q?ay=20and=20TopupToPay=20components=20=F0=9F=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/account-information.tsx | 56 ++++++++++++++++++++++++++++++ components/devices-to-pay.tsx | 47 +++---------------------- components/topup-to-pay.tsx | 55 ++--------------------------- 3 files changed, 63 insertions(+), 95 deletions(-) create mode 100644 components/account-information.tsx diff --git a/components/account-information.tsx b/components/account-information.tsx new file mode 100644 index 0000000..d1d0106 --- /dev/null +++ b/components/account-information.tsx @@ -0,0 +1,56 @@ +"use client" +import { Clipboard, ClipboardCheck } from "lucide-react"; +import { useState } from "react"; +import { toast } from "sonner"; +import { Button } from "./ui/button"; + +export function AccountInfomation({ + accountNo, + accName, +}: { + accountNo: string; + accName: string; +}) { + const [accNo, setAccNo] = useState(false); + return ( +
+
+ Account Information +
+
+
Account Name
+ {accName} +
+
+
+

Account No

+ {accountNo} + +
+
+
+ ); +} \ No newline at end of file diff --git a/components/devices-to-pay.tsx b/components/devices-to-pay.tsx index ed545b1..04acd97 100644 --- a/components/devices-to-pay.tsx +++ b/components/devices-to-pay.tsx @@ -1,12 +1,10 @@ "use client"; import { BadgeDollarSign, - Clipboard, - ClipboardCheck, Loader2, - Wallet, + Wallet } from "lucide-react"; -import { useActionState, useEffect, useState } from "react"; +import { useActionState, useEffect } from "react"; import { toast } from "sonner"; import { type VerifyDevicePaymentState, verifyDevicePayment } from "@/actions/payment"; import { @@ -19,6 +17,7 @@ import { } from "@/components/ui/table"; import type { Payment } from "@/lib/backend-types"; import type { User } from "@/lib/types/user"; +import { AccountInfomation } from "./account-information"; import { Button } from "./ui/button"; const initialState: VerifyDevicePaymentState = { @@ -164,42 +163,4 @@ export default function DevicesToPay({ ); } -function AccountInfomation({ - accountNo, - accName, -}: { - accountNo: string; - accName: string; -}) { - const [accNo, setAccNo] = useState(false); - return ( -
-
- Account Information -
-
-
Account Name
- {accName} -
-
-
-

Account No

- {accountNo} -
- -
-
- ); -} + diff --git a/components/topup-to-pay.tsx b/components/topup-to-pay.tsx index d3ef110..54f93ea 100644 --- a/components/topup-to-pay.tsx +++ b/components/topup-to-pay.tsx @@ -1,10 +1,9 @@ "use client"; import { BadgeDollarSign, - ClipboardCheck, Loader2 } from "lucide-react"; -import { useActionState, useEffect, useState } from "react"; +import { useActionState, useEffect } from "react"; import { toast } from "sonner"; import { type VerifyTopupPaymentState, @@ -19,6 +18,7 @@ import { TableRow, } from "@/components/ui/table"; import type { Topup } from "@/lib/backend-types"; +import { AccountInfomation } from "./account-information"; import { Button } from "./ui/button"; const initialState: VerifyTopupPaymentState = { @@ -155,53 +155,4 @@ export default function TopupToPay({ ); } -function AccountInfomation({ - accountNo, - accName, -}: { - accountNo: string; - accName: string; -}) { - const [accNo, setAccNo] = useState(false); - return ( -
-
- Account Information -
-
-
Account Name
- {accName} -
-
-
-

Account No

- {accountNo} - -
-
-
- ); -} +