-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: properly display finished auctions (#90)
- Loading branch information
Ben
authored
Mar 9, 2022
1 parent
d37059a
commit 5494c08
Showing
14 changed files
with
228 additions
and
50 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { getCollateralConfigByType } from '../constants/COLLATERALS'; | ||
|
||
function parseAuctionId(id: string): { collateralType: string; index: number } { | ||
const parts = id.split(':'); | ||
const collateralType = parts[0]; | ||
const index = parts[1]; | ||
|
||
// Check if we support the CollateralType | ||
getCollateralConfigByType(collateralType); | ||
|
||
// Check if auction id is a valid auction id | ||
if (Number.isNaN(parseInt(index))) { | ||
throw new Error(`"${index}" is not a valid Auction Index!`); | ||
} | ||
|
||
return { | ||
collateralType, | ||
index: parseInt(index), | ||
}; | ||
} | ||
|
||
export default parseAuctionId; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<template> | ||
<div class="mt-5"> | ||
<p class="mb-2"> | ||
The auction was taken via {{ takeEvents.length }} transaction<span v-if="takeEvents.length !== 1">s</span> | ||
at {{ takeEvents[takeEvents.length - 1].transactionDate.toUTCString() }}. | ||
</p> | ||
<ul class="list-disc list-inside"> | ||
<li v-for="event of takeEvents" :key="event.transactionHash"> | ||
Transaction <FormatAddress :value="event.transactionHash" :shorten="true" /> | ||
<span v-if="event.transactionDate"> executed <TimeTill :date="event.transactionDate" /> </span> | ||
</li> | ||
</ul> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import Vue from 'vue'; | ||
import { TakeEvent } from 'auctions-core/dist/src/types'; | ||
import FormatAddress from '~/components/utils/FormatAddress.vue'; | ||
import TimeTill from '~/components/common/TimeTill.vue'; | ||
export default Vue.extend({ | ||
name: 'AuctionEventsBlock', | ||
components: { FormatAddress, TimeTill }, | ||
props: { | ||
takeEvents: { | ||
type: Array as Vue.PropType<TakeEvent[]>, | ||
required: true, | ||
}, | ||
}, | ||
}); | ||
</script> |
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
Oops, something went wrong.