Skip to content

Commit 53ca301

Browse files
marc2332Thoralf-M
andauthored
feat(dapp): Ending sorting (#1071)
* feat(dapp): Ending sorting * Update dapp/src/app/auctions/params.ts Co-authored-by: Thoralf-M <46689931+Thoralf-M@users.noreply.github.com> --------- Co-authored-by: Thoralf-M <46689931+Thoralf-M@users.noreply.github.com>
1 parent 768c769 commit 53ca301

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

dapp/src/app/auctions/page.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,16 @@ const SORT_OPTIONS = [
7272
sort: 'desc' as const,
7373
sortBy: 'name' as const,
7474
},
75+
{
76+
label: 'Ending: soonest first',
77+
sort: 'asc' as const,
78+
sortBy: 'ending' as const,
79+
},
80+
{
81+
label: 'Ending: latest first',
82+
sort: 'desc' as const,
83+
sortBy: 'ending' as const,
84+
},
7585
];
7686

7787
const PAGE_SIZES_RANGE = [10, 20, 50, 100];

dapp/src/app/auctions/params.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export const paramsSchema = z.object({
2323
z.enum(['asc', 'desc']).default('asc'),
2424
),
2525
sortBy: z.preprocess(
26-
(v: unknown) => (typeof v === 'string' && ['bid', 'name'].includes(v) ? v : undefined),
27-
z.enum(['bid', 'name']).default('bid'),
26+
(v: unknown) =>
27+
typeof v === 'string' && ['bid', 'name', 'ending'].includes(v) ? v : undefined,
28+
z.enum(['bid', 'name', 'ending']).default('ending'),
2829
),
2930
});

dapp/src/auctions/hooks/useAuctions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export interface UseAuctionsOptions {
5151
* Sort field for auctions.
5252
* Only applies when fetching all auctions (not user-specific).
5353
*/
54-
sortBy?: 'bid' | 'name';
54+
sortBy?: 'bid' | 'name' | 'ending';
5555

5656
/**
5757
* Current page number.

dapp/src/auctions/services/IotaNamesIndexerClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class IotaNamesIndexerClient {
5858
status: 'all' | 'active' | 'finished',
5959
search?: string,
6060
sort?: 'asc' | 'desc',
61-
sortBy?: 'bid' | 'name',
61+
sortBy?: 'bid' | 'name' | 'ending',
6262
page: number = 0,
6363
pageSize: number = 50,
6464
): Promise<AuctionsResponse> {

0 commit comments

Comments
 (0)