Skip to content

Commit

Permalink
Merge pull request #4136 from traPtitech/fix/stamp_list_priority
Browse files Browse the repository at this point in the history
同じ優先度のとき、別名スタンプは優先度を低めに並べるように
  • Loading branch information
mehm8128 authored Nov 8, 2023
2 parents bea3a2b + 30817de commit 49c1826
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/Main/StampPicker/composables/useStampFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,15 @@ const useStampFilter = () => {
const result = [
...altNameRes.map(r => ({
value: altNameToName(r.value),
priority: r.priority
priority: r.priority,
isAltName: true
})),
...res
...res.map(r => ({ ...r, isAltName: false }))
]
.map(r => ({ value: r.value, sortKey: `${r.priority}${r.value}` }))
.map(r => ({
value: r.value,
sortKey: `${r.priority}${r.isAltName ? 1 : 0}${r.value}` // 同じpriorityの場合、別名は別名でないものよりも優先度が低い
}))
.sort((a, b) => compareStringInsensitive(a.sortKey, b.sortKey))
.map(r => r.value)

Expand Down

0 comments on commit 49c1826

Please sign in to comment.