bug: fix payment status display and force timezones in creation date in PaymentsTable and DevicesToPay components 🐛
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 7m27s

This commit is contained in:
2025-07-09 21:14:49 +05:00
parent 783d4b360d
commit 27a0b5d4b3
4 changed files with 54 additions and 24 deletions

View File

@ -76,12 +76,15 @@ export async function PaymentsTable({
className={cn(
"flex flex-col items-start border rounded p-2",
payment?.paid
? "bg-green-500/10 border-dashed border-green=500"
: "bg-yellow-500/10 border-dashed border-yellow-500 dark:border-yellow-500/50",
? "bg-green-500/10 border-dashed border-green-500"
: payment?.is_expired
? "bg-gray-500/10 border-dashed border-gray-500 dark:border-gray-500/50"
: "bg-yellow-500/10 border-dashed border-yellow-500 dark:border-yellow-500/50",
)}
>
<div className="flex items-center gap-2">
<Calendar size={16} opacity={0.5} />
<pre>{JSON.stringify(payment.created_at, null, 2)}</pre>
<span className="text-muted-foreground">
{new Date(payment.created_at).toLocaleDateString(
"en-US",
@ -91,6 +94,7 @@ export async function PaymentsTable({
year: "numeric",
minute: "2-digit",
hour: "2-digit",
timeZone: "Indian/Maldives", // Force consistent timezone
},
)}
</span>
@ -132,7 +136,7 @@ export async function PaymentsTable({
className={cn(
payment.status === "PENDING"
? "bg-yellow-100 text-yellow-700 dark:bg-yellow-700 dark:text-yellow-100"
: "bg-green-100 dark:bg-green-700"
: "bg-green-100 dark:bg-green-700",
)}
variant="outline"
>
@ -156,8 +160,7 @@ export async function PaymentsTable({
</TableBody>
<TableFooter>
<TableRow>
<TableCell colSpan={3} className="text-muted-foreground">
<TableCell colSpan={4} className="text-muted-foreground">
{meta?.total === 1 ? (
<p className="text-center">
Total {meta?.total} payment.
@ -166,7 +169,8 @@ export async function PaymentsTable({
<p className="text-center">
Total {meta?.total} payments.
</p>
)} </TableCell>
)}{" "}
</TableCell>
</TableRow>
</TableFooter>
</Table>
@ -205,6 +209,7 @@ function MobilePaymentDetails({ payment }: { payment: Payment }) {
year: "numeric",
minute: "2-digit",
hour: "2-digit",
timeZone: "Indian/Maldives", // Force consistent timezone
})}
</span>
</div>
@ -246,7 +251,7 @@ function MobilePaymentDetails({ payment }: { payment: Payment }) {
className={cn(
payment.status === "PENDING"
? "bg-yellow-100 text-yellow-700 dark:bg-yellow-700 dark:text-yellow-100"
: "bg-green-100 dark:bg-green-700"
: "bg-green-100 dark:bg-green-700",
)}
variant="outline"
>