feat: select category
This commit is contained in:
parent
79ce34467c
commit
22e32c9513
2 changed files with 21 additions and 6 deletions
|
|
@ -74,6 +74,8 @@ const market = async () => {
|
|||
},
|
||||
|
||||
searchNostr: false,
|
||||
filterCategories: [],
|
||||
|
||||
drawer: true,
|
||||
pubkeys: new Set(),
|
||||
relays: new Set(),
|
||||
|
|
@ -157,8 +159,12 @@ const market = async () => {
|
|||
return all
|
||||
}, {})
|
||||
const x = Object.keys(countedCategories)
|
||||
.map(category => ({ category, count: countedCategories[category] }))
|
||||
.sort((a,b) => b.count - a.count)
|
||||
.map(category => ({
|
||||
category,
|
||||
count: countedCategories[category],
|
||||
selected: this.filterCategories.indexOf(category) !== -1
|
||||
}))
|
||||
.sort((a, b) => b.count - a.count)
|
||||
console.log('### x', x)
|
||||
return x
|
||||
}
|
||||
|
|
@ -861,7 +867,6 @@ const market = async () => {
|
|||
order = order.eventCreatedAt < eventCreatedAt ? { ...order, ...orderUpdate } : { ...orderUpdate, ...order }
|
||||
}
|
||||
|
||||
// orders = [order].concat(orders.filter(o => o.id !== order.id))
|
||||
orders.splice(orderIndex, 1, order)
|
||||
this.orders[pubkey] = orders
|
||||
this.orders = { ...this.orders }
|
||||
|
|
@ -877,6 +882,15 @@ const market = async () => {
|
|||
dismissMsg: null,
|
||||
show: true
|
||||
}
|
||||
},
|
||||
|
||||
toggleCategoryFilter(category) {
|
||||
const index = this.filterCategories.indexOf(category)
|
||||
if (index === -1) {
|
||||
this.filterCategories.push(category)
|
||||
} else {
|
||||
this.filterCategories.splice(index, 1)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue