diff --git a/CriticalMapsKit/Sources/SettingsFeature/SettingsForm.swift b/CriticalMapsKit/Sources/SettingsFeature/SettingsForm.swift index 566ada84..f8d71acb 100644 --- a/CriticalMapsKit/Sources/SettingsFeature/SettingsForm.swift +++ b/CriticalMapsKit/Sources/SettingsFeature/SettingsForm.swift @@ -23,7 +23,7 @@ public struct SettingsForm: View where Content: View { // MARK: Row -struct SettingsRow: View where Content: View { +struct SettingsRow: View { let content: () -> Content init(@ViewBuilder content: @escaping () -> Content) { @@ -51,7 +51,7 @@ struct SettingsRow: View where Content: View { // MARK: Section /// A view to wrap a form section. -public struct SettingsSection: View where Content: View { +public struct SettingsSection: View { let content: () -> Content let padContents: Bool let title: String @@ -84,13 +84,13 @@ public struct SettingsSection: View where Content: View { // MARK: SettingsNavigationLink /// A view to that wraps the input view in a SettingsRow and NavigationLink -public struct SettingsNavigationLink: View where Destination: View { +public struct SettingsNavigationLink: View { let destination: Destination - let title: String + let title: () -> Label public init( destination: Destination, - title: String + @ViewBuilder title: @escaping () -> Label ) { self.destination = destination self.title = title @@ -107,7 +107,7 @@ public struct SettingsNavigationLink: View where Destination: View var content: some View { HStack { - Text(self.title) + title() .font(.titleOne) Spacer() Image(systemName: "chevron.forward") diff --git a/CriticalMapsKit/Sources/SettingsFeature/SettingsView.swift b/CriticalMapsKit/Sources/SettingsFeature/SettingsView.swift index 984b93d5..c6747b68 100644 --- a/CriticalMapsKit/Sources/SettingsFeature/SettingsView.swift +++ b/CriticalMapsKit/Sources/SettingsFeature/SettingsView.swift @@ -59,7 +59,7 @@ public struct SettingsView: View { action: \.rideevent ) ), - title: L10n.Settings.eventSettings + title: { Text(L10n.Settings.eventSettings) } ) SettingsNavigationLink( @@ -69,13 +69,20 @@ public struct SettingsView: View { action: \.appearance ) ), - title: L10n.Settings.Theme.appearance + title: { Text(L10n.Settings.Theme.appearance) } ) } supportSection infoSection + + linksSection + + HStack { + appVersionAndBuildView + Spacer() + } } } .navigationTitle(L10n.Settings.title) @@ -184,8 +191,9 @@ public struct SettingsView: View { } } - var infoSection: some View { - SettingsSection(title: L10n.Settings.Section.info) { + @ViewBuilder + var linksSection: some View { + SettingsSection(title: "Links") { SettingsRow { Button( action: { viewStore.send(.infoSectionRowTapped(.website)) }, @@ -215,20 +223,28 @@ public struct SettingsView: View { ) .accessibilityAddTraits(.isLink) } - + } + } + + @ViewBuilder + var infoSection: some View { + SettingsSection(title: L10n.Settings.Section.info) { SettingsNavigationLink( destination: GuideView(), - title: L10n.Rules.title + title: { + HStack(spacing: .grid(2)) { + Text(L10n.Rules.title) + Image(systemName: "exclamationmark.bubble") + } + } ) if let acknowledgementsPlistPath = viewStore.acknowledgementsPlistPath { SettingsNavigationLink( destination: AcknowListSwiftUIView(plistPath: acknowledgementsPlistPath), - title: "Acknowledgements" + title: { Text("Acknowledgements") } ) } - - appVersionAndBuildView } } @@ -279,14 +295,12 @@ struct SettingsInfoLink: View { } #Preview { - Preview { - NavigationView { - SettingsView( - store: .init( - initialState: .init(userSettings: .init()), - reducer: { SettingsFeature() } - ) + NavigationView { + SettingsView( + store: .init( + initialState: .init(userSettings: .init()), + reducer: { SettingsFeature() } ) - } + ) } }