Add icons for all filters

This commit is contained in:
Thomas Ricouard 2023-12-30 16:16:19 +01:00
parent 781121d1d4
commit 0497191acf
3 changed files with 9 additions and 7 deletions

View file

@ -189,7 +189,7 @@ struct TimelineTab: View {
Button { Button {
timeline = .latest timeline = .latest
} label: { } label: {
Label(TimelineFilter.latest.localizedTitle(), systemImage: TimelineFilter.latest.iconName() ?? "") Label(TimelineFilter.latest.localizedTitle(), systemImage: TimelineFilter.latest.iconName())
} }
if timeline == .home { if timeline == .home {
Button { Button {
@ -197,7 +197,7 @@ struct TimelineTab: View {
} label: { } label: {
VStack { VStack {
Label(TimelineFilter.resume.localizedTitle(), Label(TimelineFilter.resume.localizedTitle(),
systemImage: TimelineFilter.resume.iconName() ?? "") systemImage: TimelineFilter.resume.iconName())
} }
} }
} }
@ -232,7 +232,7 @@ struct TimelineTab: View {
Button { Button {
self.timeline = timeline self.timeline = timeline
} label: { } label: {
Label(timeline.localizedTitle(), systemImage: timeline.iconName() ?? "") Label(timeline.localizedTitle(), systemImage: timeline.iconName())
} }
} }
} }

View file

@ -115,7 +115,7 @@ public enum TimelineFilter: Hashable, Equatable, Identifiable {
} }
} }
public func iconName() -> String? { public func iconName() -> String {
switch self { switch self {
case .latest: case .latest:
"arrow.counterclockwise" "arrow.counterclockwise"
@ -133,8 +133,10 @@ public enum TimelineFilter: Hashable, Equatable, Identifiable {
"list.bullet" "list.bullet"
case .remoteLocal: case .remoteLocal:
"dot.radiowaves.right" "dot.radiowaves.right"
default: case .tagGroup:
nil "tag"
case .hashtag:
"number"
} }
} }

View file

@ -42,7 +42,7 @@ struct TimelineQuickAccessPills: View {
Button { Button {
timeline = filter timeline = filter
} label: { } label: {
Label(filter.localizedTitle(), systemImage: filter.iconName() ?? "") Label(filter.localizedTitle(), systemImage: filter.iconName())
.font(.callout) .font(.callout)
} }
.transition(.push(from: .leading).combined(with: .opacity)) .transition(.push(from: .leading).combined(with: .opacity))