From 0497191acfb7bc5354bad3700fac7b8c0247da68 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Sat, 30 Dec 2023 16:16:19 +0100 Subject: [PATCH] Add icons for all filters --- IceCubesApp/App/Tabs/Timeline/TimelineTab.swift | 6 +++--- Packages/Timeline/Sources/Timeline/TimelineFilter.swift | 8 +++++--- .../Sources/Timeline/View/TimelineQuickAccessPills.swift | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/IceCubesApp/App/Tabs/Timeline/TimelineTab.swift b/IceCubesApp/App/Tabs/Timeline/TimelineTab.swift index d40a617d..b43a6d92 100644 --- a/IceCubesApp/App/Tabs/Timeline/TimelineTab.swift +++ b/IceCubesApp/App/Tabs/Timeline/TimelineTab.swift @@ -189,7 +189,7 @@ struct TimelineTab: View { Button { timeline = .latest } label: { - Label(TimelineFilter.latest.localizedTitle(), systemImage: TimelineFilter.latest.iconName() ?? "") + Label(TimelineFilter.latest.localizedTitle(), systemImage: TimelineFilter.latest.iconName()) } if timeline == .home { Button { @@ -197,7 +197,7 @@ struct TimelineTab: View { } label: { VStack { Label(TimelineFilter.resume.localizedTitle(), - systemImage: TimelineFilter.resume.iconName() ?? "") + systemImage: TimelineFilter.resume.iconName()) } } } @@ -232,7 +232,7 @@ struct TimelineTab: View { Button { self.timeline = timeline } label: { - Label(timeline.localizedTitle(), systemImage: timeline.iconName() ?? "") + Label(timeline.localizedTitle(), systemImage: timeline.iconName()) } } } diff --git a/Packages/Timeline/Sources/Timeline/TimelineFilter.swift b/Packages/Timeline/Sources/Timeline/TimelineFilter.swift index 0bae2b02..a68d955e 100644 --- a/Packages/Timeline/Sources/Timeline/TimelineFilter.swift +++ b/Packages/Timeline/Sources/Timeline/TimelineFilter.swift @@ -115,7 +115,7 @@ public enum TimelineFilter: Hashable, Equatable, Identifiable { } } - public func iconName() -> String? { + public func iconName() -> String { switch self { case .latest: "arrow.counterclockwise" @@ -133,8 +133,10 @@ public enum TimelineFilter: Hashable, Equatable, Identifiable { "list.bullet" case .remoteLocal: "dot.radiowaves.right" - default: - nil + case .tagGroup: + "tag" + case .hashtag: + "number" } } diff --git a/Packages/Timeline/Sources/Timeline/View/TimelineQuickAccessPills.swift b/Packages/Timeline/Sources/Timeline/View/TimelineQuickAccessPills.swift index 2580e295..f3778ca0 100644 --- a/Packages/Timeline/Sources/Timeline/View/TimelineQuickAccessPills.swift +++ b/Packages/Timeline/Sources/Timeline/View/TimelineQuickAccessPills.swift @@ -42,7 +42,7 @@ struct TimelineQuickAccessPills: View { Button { timeline = filter } label: { - Label(filter.localizedTitle(), systemImage: filter.iconName() ?? "") + Label(filter.localizedTitle(), systemImage: filter.iconName()) .font(.callout) } .transition(.push(from: .leading).combined(with: .opacity))