From 15588a6ec85b557742690ce50d8b64bd57279fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malte=20Bu=CC=88nz?= Date: Sat, 3 Jun 2023 09:04:08 +0200 Subject: [PATCH] fix contextmenu title --- CriticalMapsKit/Sources/AppFeature/AppView.swift | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/CriticalMapsKit/Sources/AppFeature/AppView.swift b/CriticalMapsKit/Sources/AppFeature/AppView.swift index 7e2c7277..653a257e 100644 --- a/CriticalMapsKit/Sources/AppFeature/AppView.swift +++ b/CriticalMapsKit/Sources/AppFeature/AppView.swift @@ -23,6 +23,14 @@ public struct AppView: View { viewStore = ViewStore(store) } + private var contextMenuTitle: String { + if viewStore.bottomSheetPosition == .hidden { + return L10n.Map.NextRideEvents.showAll + } else { + return L10n.Map.NextRideEvents.hideAll + } + } + public var body: some View { ZStack(alignment: .topLeading) { MapFeatureView( @@ -39,10 +47,7 @@ public struct AppView: View { .contextMenu { Button( action: { viewStore.send(.set(\.$bottomSheetPosition, .relative(0.4))) }, - label: { - let title = viewStore.bottomSheetPosition == .hidden ? L10n.Map.NextRideEvents.hideAll : L10n.Map.NextRideEvents.showAll - Label(title, systemImage: "list.bullet") - } + label: { Label(contextMenuTitle, systemImage: "list.bullet") } ) } } @@ -147,7 +152,7 @@ public struct AppView: View { ? Color.white : Color(.attention) ) - .accessibilityLabel(Text("internet not available")) + .accessibilityLabel(Text("Internet not available")) .padding() .background( Group {