Sort lists and tags in timeline filter button menus (#370)

Sorted alphabetically by list.title and tag.name
This commit is contained in:
David Davies-Payne 2023-01-26 00:55:07 +13:00 committed by GitHub
parent f636b94178
commit 06c7e0e324
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -83,8 +83,9 @@ struct TimelineTab: View {
}
}
if !currentAccount.lists.isEmpty {
let sortedLists = currentAccount.lists.sorted { $0.title < $1.title }
Menu("timeline.filter.lists") {
ForEach(currentAccount.lists) { list in
ForEach(sortedLists) { list in
Button {
timeline = .list(list: list)
} label: {
@ -95,8 +96,9 @@ struct TimelineTab: View {
}
if !currentAccount.tags.isEmpty {
let sortedTags = currentAccount.tags.sorted { $0.name < $1.name }
Menu("timeline.filter.tags") {
ForEach(currentAccount.tags) { tag in
ForEach(sortedTags) { tag in
Button {
timeline = .hashtag(tag: tag.name, accountId: nil)
} label: {