Skip to content

Commit 0be5486

Browse files
authored
Merge pull request #2742 from Jarsen136/issue-2741
2 parents 82bb527 + 2bbb6a5 commit 0be5486

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

components/rmrk/Gallery/Holder/Holder.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
</b-table-column>
9393
<b-table-column
9494
:visible="columnsVisible['Date'].display"
95-
field="Date"
95+
field="Timestamp"
9696
label="Date"
9797
sortable
9898
v-slot="props">
@@ -178,7 +178,10 @@ type TableRow = {
178178
Sale: string
179179
SaleFormatted?: string
180180
Date: string
181+
Time: string
182+
SortKey: number
181183
Block: string
184+
Amount: number
182185
Items?: TableRow[]
183186
Item: NFTItem
184187
}
@@ -257,12 +260,14 @@ export default class Holder extends mixins(ChainMixin, KeyboardEventsMixin) {
257260
258261
for (const newEvent of this.events) {
259262
const date = new Date(newEvent['timestamp'])
263+
const timestamp = date.getTime()
260264
const dateStr = parseDate(date)
261265
const formatTime = formatDistanceToNow(date, { addSuffix: true })
262266
const block = String(newEvent['blockNumber'])
263267
const commonInfo = {
264268
Date: dateStr,
265269
Time: formatTime,
270+
Timestamp: timestamp,
266271
Block: block,
267272
Amount: 1,
268273
}
@@ -272,6 +277,7 @@ export default class Holder extends mixins(ChainMixin, KeyboardEventsMixin) {
272277
itemRowMap[nftId] = {
273278
Item: newEvent['nft'],
274279
Holder: newEvent['caller'],
280+
SortKey: timestamp,
275281
Bought: 0,
276282
Sale: 0,
277283
...commonInfo,
@@ -295,11 +301,13 @@ export default class Holder extends mixins(ChainMixin, KeyboardEventsMixin) {
295301
if (itemRowMap[nftId]) {
296302
if (!('Bought' in itemRowMap[nftId])) {
297303
itemRowMap[nftId]['Bought'] = 0
304+
itemRowMap[nftId]['SortKey'] = timestamp
298305
}
299306
} else {
300307
itemRowMap[nftId] = {
301308
Item: newEvent['nft'],
302309
Holder: newEvent['meta'],
310+
SortKey: timestamp,
303311
Bought: 0,
304312
Sale: 0,
305313
...commonInfo,
@@ -320,11 +328,13 @@ export default class Holder extends mixins(ChainMixin, KeyboardEventsMixin) {
320328
if (itemRowMap[nftId]) {
321329
if (!('Bought' in itemRowMap[nftId])) {
322330
itemRowMap[nftId]['Bought'] = bought
331+
itemRowMap[nftId]['SortKey'] = timestamp
323332
}
324333
} else {
325334
itemRowMap[nftId] = {
326335
Item: newEvent['nft'],
327336
Holder: newEvent['caller'],
337+
SortKey: timestamp,
328338
Bought: bought,
329339
Sale: 0,
330340
...commonInfo,
@@ -363,6 +373,7 @@ export default class Holder extends mixins(ChainMixin, KeyboardEventsMixin) {
363373
group['Items'].forEach((item) => {
364374
parsePriceForItem(item, this.decimals, this.unit)
365375
})
376+
group['Items'] = group['Items'].sort((a, b) => b.SortKey - a.SortKey)
366377
})
367378
return holderGroupsList
368379
}

0 commit comments

Comments
 (0)