Sort categories by translated name (#5307)

* Sort categories by translated name

* Use locale and numeric

* Remove @modrinth/ui import
This commit is contained in:
Jerozgen
2026-02-09 04:19:04 +03:00
committed by GitHub
parent 4eb0f0c206
commit a8c5e036d0
4 changed files with 26 additions and 73 deletions

View File

@@ -104,22 +104,6 @@ export default defineNuxtPlugin((nuxtApp) => {
getProjectTypeForUrlShorthand(type, loaders, tags),
)
nuxtApp.provide('cycleValue', cycleValue)
nuxtApp.provide('sortedCategories', () => {
return tagStore.value.categories.slice().sort((a, b) => {
const headerCompare = a.header.localeCompare(b.header)
if (headerCompare !== 0) {
return headerCompare
}
if (a.header === 'resolutions' && b.header === 'resolutions') {
return a.name.replace(/\D/g, '') - b.name.replace(/\D/g, '')
} else if (a.header === 'performance impact' && b.header === 'performance impact') {
const x = ['potato', 'low', 'medium', 'high', 'screenshot']
return x.indexOf(a.name) - x.indexOf(b.name)
}
return 0
})
})
})
export const formatNumber = (number, abbreviate = true) => {
const x = +number