-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Combine upcoming + active auctions (#1399)
* Combine upcoming + active auctions * Changeset * Fix tests
- Loading branch information
1 parent
44de1cf
commit 0cd4e87
Showing
7 changed files
with
15 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'minifront': patch | ||
--- | ||
|
||
Combine active + upcoming auctions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 3 additions & 14 deletions
17
apps/minifront/src/components/swap/auction-list/helpers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,6 @@ | ||
import { AuctionInfo } from '../../../fetchers/auction-infos'; | ||
import { Filter } from '../../../state/swap/dutch-auction'; | ||
|
||
const byStartHeight = | ||
(direction: 'ascending' | 'descending') => (a: AuctionInfo, b: AuctionInfo) => { | ||
if (!a.auction.description?.startHeight || !b.auction.description?.startHeight) return 0; | ||
if (direction === 'ascending') { | ||
return Number(a.auction.description.startHeight - b.auction.description.startHeight); | ||
} | ||
return Number(b.auction.description.startHeight - a.auction.description.startHeight); | ||
}; | ||
|
||
export const SORT_FUNCTIONS: Record<Filter, (a: AuctionInfo, b: AuctionInfo) => number> = { | ||
all: byStartHeight('ascending'), | ||
active: byStartHeight('descending'), | ||
upcoming: byStartHeight('ascending'), | ||
export const byStartHeightAscending = (a: AuctionInfo, b: AuctionInfo) => { | ||
if (!a.auction.description?.startHeight || !b.auction.description?.startHeight) return 0; | ||
return Number(a.auction.description.startHeight - b.auction.description.startHeight); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters