mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-22 00:11:00 +00:00
Also sort tags and lists in profile view (#764)
* Add CurrentAccount.sortedLists and .sortedTags Sorts alphabetically, ascending, lowercased on title and name respectively. * TimelineTab uses CurrentAccount.sortedLists and .sortedTags * Account detail sorts tags and lists Alphabetically, ascending, lowercased via CurrentAccount.sortedTags, .sortedLists
This commit is contained in:
parent
22b4044dfd
commit
11167c35c3
3 changed files with 12 additions and 6 deletions
|
@ -112,9 +112,8 @@ struct TimelineTab: View {
|
|||
}
|
||||
}
|
||||
if !currentAccount.lists.isEmpty {
|
||||
let sortedLists = currentAccount.lists.sorted { $0.title.lowercased() < $1.title.lowercased() }
|
||||
Menu("timeline.filter.lists") {
|
||||
ForEach(sortedLists) { list in
|
||||
ForEach(currentAccount.sortedLists) { list in
|
||||
Button {
|
||||
timeline = .list(list: list)
|
||||
} label: {
|
||||
|
@ -125,9 +124,8 @@ struct TimelineTab: View {
|
|||
}
|
||||
|
||||
if !currentAccount.tags.isEmpty {
|
||||
let sortedTags = currentAccount.tags.sorted { $0.name.lowercased() < $1.name.lowercased() }
|
||||
Menu("timeline.filter.tags") {
|
||||
ForEach(sortedTags) { tag in
|
||||
ForEach(currentAccount.sortedTags) { tag in
|
||||
Button {
|
||||
timeline = .hashtag(tag: tag.name, accountId: nil)
|
||||
} label: {
|
||||
|
|
|
@ -264,7 +264,7 @@ public struct AccountDetailView: View {
|
|||
|
||||
private var tagsListView: some View {
|
||||
Group {
|
||||
ForEach(currentAccount.tags) { tag in
|
||||
ForEach(currentAccount.sortedTags) { tag in
|
||||
HStack {
|
||||
TagRowView(tag: tag)
|
||||
Spacer()
|
||||
|
@ -280,7 +280,7 @@ public struct AccountDetailView: View {
|
|||
|
||||
private var listsListView: some View {
|
||||
Group {
|
||||
ForEach(currentAccount.lists) { list in
|
||||
ForEach(currentAccount.sortedLists) { list in
|
||||
NavigationLink(value: RouterDestinations.list(list: list)) {
|
||||
HStack {
|
||||
Text(list.title)
|
||||
|
|
|
@ -16,6 +16,14 @@ public class CurrentAccount: ObservableObject {
|
|||
|
||||
public static let shared = CurrentAccount()
|
||||
|
||||
public var sortedLists: [List] {
|
||||
lists.sorted { $0.title.lowercased() < $1.title.lowercased() }
|
||||
}
|
||||
|
||||
public var sortedTags: [Tag] {
|
||||
tags.sorted { $0.name.lowercased() < $1.name.lowercased() }
|
||||
}
|
||||
|
||||
private init() {}
|
||||
|
||||
public func setClient(client: Client) {
|
||||
|
|
Loading…
Reference in a new issue