Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly sort groups #1788

Merged
merged 1 commit into from
Sep 6, 2020
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
7 changes: 6 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"p-queue": "^6.6.1",
"qr-image": "^3.2.0",
"regenerator-runtime": "^0.13.7",
"string-natural-compare": "^3.0.1",
"uuid": "^8.3.0",
"vue": "^2.6.12",
"vue-click-outside": "^1.1.0",
Expand Down
3 changes: 2 additions & 1 deletion src/views/Contacts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ import { VCardTime } from 'ical.js'
import download from 'downloadjs'
import moment from 'moment'
import pLimit from 'p-limit'
import naturalCompare from 'string-natural-compare'

import ContactDetails from '../components/ContactDetails'
import ContactsList from '../components/ContactsList'
Expand Down Expand Up @@ -447,7 +448,7 @@ export default {
toString: () => group.name,
})
})
menu.sort()
menu.sort((a, b) => naturalCompare(a.toString(), b.toString(), { caseInsensitive: true }))

// Find the Recently Contacted group, delete it from array
const recentlyIndex = menu.findIndex(group => group.name === GROUP_RECENTLY_CONTACTED)
Expand Down