refactor: enhance error handling and add pagination to device queries
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 1m37s

This commit is contained in:
2025-04-12 14:35:23 +05:00
parent d60dd3af14
commit aff9d26e0e
8 changed files with 134 additions and 63 deletions

View File

@ -3,7 +3,7 @@ import { deviceCartAtom } from "@/lib/atoms";
import type { Device } from "@/lib/backend-types";
import { cn } from "@/lib/utils";
import { useAtom } from "jotai";
import { Hourglass } from "lucide-react";
import { HandCoins, Hourglass } from "lucide-react";
import Link from "next/link";
import AddDevicesToCartButton from "./add-devices-to-cart-button";
import BlockDeviceDialog from "./block-device-dialog";
@ -39,7 +39,7 @@ export default function DeviceCard({
isChecked ? "bg-accent" : "bg-",
device.is_active
? "cursor-not-allowed bg-accent-foreground/10 hover:bg-accent-foreground/10"
: "cursor-pointer hover:bg-muted",
: "cursor-pointer hover:bg-muted-foreground/10",
)}
>
<div className="">
@ -50,7 +50,7 @@ export default function DeviceCard({
>
{device.name}
</Link>
<Badge variant={"secondary"}>
<Badge variant={"outline"}>
<span className="font-medium">{device.mac}</span>
</Badge>
</div>
@ -74,8 +74,9 @@ export default function DeviceCard({
)}
{device.has_a_pending_payment && (
<Link href={`/payments/${device.pending_payment_id}`}>
<span className="flex hover:underline items-center justify-center gap-2 text-muted-foreground text-yellow-600">
Payment Pending <Hourglass size={14} />
<span className="bg-muted rounded px-2 p-1 mt-2 flex hover:underline items-center justify-center gap-2 text-muted-foreground text-yellow-600">
Payment Pending{" "}
<HandCoins className="animate-pulse" size={14} />
</span>
</Link>
)}