"use client" import * as React from "react" import { Button } from "@/components/ui/button" import { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, } from "@/components/ui/drawer" import { cartDrawerOpenAtom, deviceCartAtom } from "@/lib/atoms" import type { Device } from "@prisma/client" import { useAtom, useAtomValue, useSetAtom } from "jotai" import { CircleDollarSign, ShoppingCart, Trash2 } from "lucide-react" import Link from "next/link" import { usePathname } from "next/navigation" export function DeviceCartDrawer() { const pathname = usePathname() const devices = useAtomValue(deviceCartAtom) const setDeviceCart = useSetAtom(deviceCartAtom) const [isOpen, setIsOpen] = useAtom(cartDrawerOpenAtom) if (pathname === "/payment") { return null } return (
Cart Devices Devices in your cart to pay.
{devices.map((device) => ( ))}
) } function DeviceCard({ device }: { device: Device }) { const setDeviceCart = useSetAtom(deviceCartAtom) return (
) }