mirror of
https://github.com/System-End/scraps.git
synced 2026-04-19 22:05:09 +00:00
fix(shop): make favorites sort prioritize wishlist count first
This commit is contained in:
parent
fcc862e9ff
commit
aea9bd81de
1 changed files with 10 additions and 2 deletions
|
|
@ -59,7 +59,15 @@
|
|||
let sortedItems = $derived.by(() => {
|
||||
let items = [...filteredItems];
|
||||
if (sortBy === 'favorites') {
|
||||
return items.sort((a, b) => b.heartCount - a.heartCount);
|
||||
return items.sort((a, b) => {
|
||||
if (b.heartCount !== a.heartCount) {
|
||||
return b.heartCount - a.heartCount;
|
||||
}
|
||||
if (a.userHearted !== b.userHearted) {
|
||||
return a.userHearted ? -1 : 1;
|
||||
}
|
||||
return a.id - b.id;
|
||||
});
|
||||
} else if (sortBy === 'probability') {
|
||||
return items.sort((a, b) => b.effectiveProbability - a.effectiveProbability);
|
||||
} else if (sortBy === 'cost') {
|
||||
|
|
@ -224,7 +232,7 @@
|
|||
? 'bg-black text-white'
|
||||
: 'hover:border-dashed'}"
|
||||
>
|
||||
{$t.shop.favorites}
|
||||
{$t.shop.favorites} (most wished, then yours)
|
||||
</button>
|
||||
<button
|
||||
onclick={() => (sortBy = 'probability')}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue