Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const filterCategories = computed<DropdownFilterBarCategory[]>(() => [
{
key: 'gameVersion',
label: formatMessage(messages.gameVersion),
searchable: true,
searchable: new Set(instances.value.map((instance) => instance.game_version)).size > 5,
options: [...new Set(instances.value.map((instance) => instance.game_version))]
.sort((a, b) => b.localeCompare(a, undefined, { numeric: true }))
.map((version) => ({ value: version, label: version })),
Expand Down
6 changes: 3 additions & 3 deletions apps/app-frontend/src/components/ui/library/use-library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ function createLibraryState(instances: Ref<GameInstance[]>) {
const groupedDifference = Number(a.group_ids.length > 0) - Number(b.group_ids.length > 0)
if (groupedDifference !== 0) return groupedDifference

return a.name.localeCompare(b.name)
return a.name.localeCompare(b.name, undefined, { numeric: true })
})
})
const groupInstancesModalGroup = computed(() => {
Expand All @@ -311,7 +311,7 @@ function createLibraryState(instances: Ref<GameInstance[]>) {
return instances.value
.filter((instance) => !query || instance.name.toLowerCase().includes(query))
.slice()
.sort((a, b) => a.name.localeCompare(b.name))
.sort((a, b) => a.name.localeCompare(b.name, undefined, { numeric: true }))
})
const canCreateGroup = computed(
() => normalizedNewGroupName.value.length > 0 && !creatingGroup.value,
Expand Down Expand Up @@ -433,7 +433,7 @@ function createLibraryState(instances: Ref<GameInstance[]>) {

switch (displayState.value.sortBy) {
case 'Name':
visibleInstances.sort((a, b) => a.name.localeCompare(b.name))
visibleInstances.sort((a, b) => a.name.localeCompare(b.name, undefined, { numeric: true }))
break
case 'Loader':
visibleInstances.sort((a, b) =>
Expand Down
Loading