From 8c94c92281babd29f9f849ee38833d94a7ac679e Mon Sep 17 00:00:00 2001 From: i701 Date: Sun, 6 Jul 2025 20:12:25 +0500 Subject: [PATCH] =?UTF-8?q?refactor:=20enhance=20topup=20status=20display?= =?UTF-8?q?=20and=20improve=20conditional=20rendering=20in=20TopupsTable?= =?UTF-8?q?=20component=20=F0=9F=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/topups-table.tsx | 58 ++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/components/topups-table.tsx b/components/topups-table.tsx index dd5879c..f7fb0ab 100644 --- a/components/topups-table.tsx +++ b/components/topups-table.tsx @@ -103,19 +103,19 @@ export async function TopupsTable({ View Details - {!topup.is_expired && ( - - - {topup.paid ? "Paid" : "Unpaid"} - - )} + {!topup.is_expired && + topup.status !== "CANCELLED" && ( + + {topup.paid ? "Paid" : "Unpaid"} + + )} @@ -123,7 +123,12 @@ export async function TopupsTable({ {topup.paid ? ( - {topup.status} + + {topup.status} + ) : topup.is_expired ? ( Expired ) : ( @@ -144,19 +149,14 @@ export async function TopupsTable({ {meta?.total === 1 ? ( -

- Total {meta?.total} topup. -

+

Total {meta?.total} topup.

) : ( -

- Total {meta?.total} topups. -

+

Total {meta?.total} topups.

)}
-
{data.map((topup) => ( @@ -203,7 +203,7 @@ function MobileTopupDetails({ topup }: { topup: Topup }) { View Details - {topup.status !== "CANCELLED" && ( + {!topup.is_expired && topup.status !== "CANCELLED" && ( )}
-
+ +

Amount

{topup.amount.toFixed(2)} MVR
+ + {topup.paid ? ( + + {topup.status} + + ) : topup.is_expired ? ( + Expired + ) : ( + {topup.status} + )} +
);