'use client'; import { useCallback, useEffect, useState } from 'react'; import Link from 'next/link'; import { Gamepad2, Ticket } from 'lucide-react'; import { fetchApi } from '@/lib/utils/client'; import Loading from '@/app/component/Loading'; import Pagination from '@/app/component/Pagination'; import NavTabs from '../navTabs'; import type { InventoryGroupRow, InventoryGroupsResponse } from '@/types/store'; const PER_PAGE = 24; function TypeBadgeCoupon() { return ( ); } export default function InventoryGroupsPage() { const [groups, setGroups] = useState([]); const [total, setTotal] = useState(0); const [page, setPage] = useState(1); const [loading, setLoading] = useState(true); const load = useCallback(async () => { setLoading(true); const res = await fetchApi(`/api/store/inventory/groups?page=${page}&perPage=${PER_PAGE}`, { silent: true }); if (res.success && res.data) { setGroups(res.data.list); setTotal(res.data.total); } else { setGroups([]); setTotal(0); } setLoading(false); }, [page]); useEffect(() => { load(); }, [load]); return ( <>

보관함

구매한 쿠폰을 상품별로 확인하실 수 있습니다. 상품을 클릭하면 쿠폰 코드를 확인 / 관리할 수 있어요.

총 {total.toLocaleString()}종
{loading ? ( ) : groups.length === 0 ? (
보관함이 비어있습니다.
) : ( <>
{groups.map((g) => { const allUsed = g.unusedCount === 0; return (
{g.productThumbnail ? ( // eslint-disable-next-line @next/next/no-img-element {g.productName} ) : ( 이미지 없음 )} {allUsed && (
사용 완료
)}
{g.gameName}
{g.productName}
{allUsed ? '사용 완료' : `잔여 ${g.unusedCount}장`} / 총 {g.totalCount}장
); })}

)}
); }