Skip to content

Commit b789bfb

Browse files
authored
Merge pull request #69 from SK-Rookies5-Auction/feat/mypage-filter-ui
feat: refine My Page filters and add bidding history status tags
2 parents 6f80f18 + a8fcb57 commit b789bfb

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

src/pages/MyPage.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { Pagination } from '../components/common/Pagination';
1616
import { getRenderableImageUrl } from '../utils/image';
1717

1818
type MyPageTab = 'auctions' | 'bids' | 'likes';
19-
type MyPageStatusFilter = 'ALL' | 'READY' | 'LIVE' | 'FINISHED' | 'CANCEL' | 'PAID' | 'SHIPPING' | 'COMPLETED';
19+
type MyPageStatusFilter = 'ALL' | 'LIVE' | 'FINISHED' | 'PAID' | 'SHIPPING' | 'COMPLETED' | 'WON' | 'OUTBID';
2020

2121
interface StoredUser {
2222
id?: number | string;
@@ -34,15 +34,21 @@ interface ApiErrorBody {
3434

3535
const STATUS_FILTERS: { value: MyPageStatusFilter; label: string }[] = [
3636
{ value: 'ALL', label: 'All' },
37-
{ value: 'READY', label: 'Ready' },
3837
{ value: 'LIVE', label: 'Live' },
3938
{ value: 'FINISHED', label: 'Finished' },
40-
{ value: 'CANCEL', label: 'Cancel' },
4139
{ value: 'PAID', label: 'Paid' },
4240
{ value: 'SHIPPING', label: 'Shipping' },
4341
{ value: 'COMPLETED', label: 'Completed' },
4442
];
4543

44+
const BID_STATUS_FILTERS: { value: MyPageStatusFilter; label: string }[] = [
45+
{ value: 'ALL', label: 'All' },
46+
{ value: 'LIVE', label: 'Live' },
47+
{ value: 'FINISHED', label: 'Finished' },
48+
{ value: 'WON', label: 'Won' },
49+
{ value: 'OUTBID', label: 'Outbid' },
50+
];
51+
4652
const TAB_TITLES: Record<MyPageTab, string> = {
4753
auctions: 'My Auctions',
4854
bids: 'Bidding History',
@@ -59,12 +65,8 @@ const getStatusBadgeClass = (status: string) => {
5965
return 'bg-blue-600/20 text-blue-300';
6066
case 'SOLD':
6167
return 'bg-purple-600/20 text-purple-300';
62-
case 'READY':
63-
return 'bg-slate-600/20 text-slate-300';
6468
case 'FINISHED':
6569
return 'bg-blue-600/20 text-blue-300';
66-
case 'CANCEL':
67-
return 'bg-red-600/20 text-red-300';
6870
case 'PAID':
6971
return 'bg-cyan-600/20 text-cyan-300';
7072
case 'SHIPPING':
@@ -155,7 +157,7 @@ export function MyPage() {
155157
const params = {
156158
page: currentPage,
157159
size: PAGE_SIZE,
158-
...(activeTab === 'auctions' && statusFilter !== 'ALL' ? { status: statusFilter } : {}),
160+
...((activeTab === 'auctions' || activeTab === 'bids') && statusFilter !== 'ALL' ? { status: statusFilter } : {}),
159161
};
160162
if (activeTab === 'auctions') res = await userApi.getMyAuctions(params);
161163
else if (activeTab === 'bids') res = await userApi.getMyBids(params);
@@ -434,9 +436,9 @@ export function MyPage() {
434436
<div className="p-6 border-b border-[#1e3a5f] flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between">
435437
<div>
436438
<h2 className="text-xl font-bold text-white">{TAB_TITLES[activeTab]}</h2>
437-
{activeTab === 'auctions' && (
439+
{(activeTab === 'auctions' || activeTab === 'bids') && (
438440
<div className="mt-4 flex flex-wrap gap-2">
439-
{STATUS_FILTERS.map((filter) => (
441+
{(activeTab === 'auctions' ? STATUS_FILTERS : BID_STATUS_FILTERS).map((filter) => (
440442
<button
441443
key={filter.value}
442444
type="button"

0 commit comments

Comments
 (0)