aboutsummaryrefslogtreecommitdiff
path: root/Map/Presentation/Preferences
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2025-07-07 13:09:13 +0200
committerRuben Beltran del Rio <git@r.bdr.sh>2025-07-07 13:09:13 +0200
commit3fdaeab6a7fa19b0c5424de487efc37c0994c86e (patch)
tree09af4c1d54924350b4e6c89fb4f284170e89b945 /Map/Presentation/Preferences
parent933078c10e99002c8a5f647e476819f0f1706a14 (diff)
More localization and map preferences
Diffstat (limited to 'Map/Presentation/Preferences')
-rw-r--r--Map/Presentation/Preferences/MapPreferencesView.swift36
-rw-r--r--Map/Presentation/Preferences/StagesPreferencesView.swift45
-rw-r--r--Map/Presentation/Preferences/TemplatesPreferencesView.swift55
3 files changed, 84 insertions, 52 deletions
diff --git a/Map/Presentation/Preferences/MapPreferencesView.swift b/Map/Presentation/Preferences/MapPreferencesView.swift
index fb5f8c2..f8c976e 100644
--- a/Map/Presentation/Preferences/MapPreferencesView.swift
+++ b/Map/Presentation/Preferences/MapPreferencesView.swift
@@ -16,14 +16,36 @@
import SwiftUI
struct MapPreferencesView: View {
+ @AppStorage("showMapBackground") private var showBackground = true
+ @AppStorage("useSmartEditor") private var useSmartEditor = false
+
var body: some View {
- VStack {
- Text("Map Preferences")
- .font(.largeTitle)
- .padding()
-
- Text("Map settings will be available here in a future version.")
- .foregroundColor(.secondary)
+ VStack(alignment: .center, spacing: Dimensions.Spacing.loose) {
+ HStack(alignment: .firstTextBaseline, spacing: Dimensions.Spacing.regular) {
+ Text("preferences.map.map_style.title")
+ .font(.Theme.Body.emphasized)
+ .frame(maxWidth: .infinity, alignment: .trailing)
+
+ VStack(alignment: .leading, spacing: Dimensions.Spacing.cozy) {
+ Toggle(isOn: $showBackground, label: { Text("preferences.map.map_style.show_background")
+ .font(.Theme.Body.regular)
+ })
+ }
+ .frame(maxWidth: .infinity, alignment: .leading)
+ }
+
+ Divider()
+
+ HStack(alignment: .firstTextBaseline, spacing: Dimensions.Spacing.regular) {
+ Text("preferences.map.editor.title")
+ .font(.Theme.Body.emphasized)
+ .frame(maxWidth: .infinity, alignment: .trailing)
+
+ VStack(alignment: .leading, spacing: Dimensions.Spacing.cozy) {
+ Toggle(String(localized: "preferences.map.editor.use_smart_editor"), isOn: $useSmartEditor)
+ }
+ .frame(maxWidth: .infinity, alignment: .leading)
+ }
Spacer()
}
diff --git a/Map/Presentation/Preferences/StagesPreferencesView.swift b/Map/Presentation/Preferences/StagesPreferencesView.swift
index cd347bf..6d2154c 100644
--- a/Map/Presentation/Preferences/StagesPreferencesView.swift
+++ b/Map/Presentation/Preferences/StagesPreferencesView.swift
@@ -18,23 +18,14 @@ import SwiftUI
struct StagesPreferencesView: View {
@AppStorage("customStages") private var customStagesData: Data = Data()
@State private var customStages: [CustomStage] = []
+ @State private var showingHelpPopover = false
var body: some View {
VStack(alignment: .leading, spacing: Dimensions.Spacing.regular) {
- Text("preferences.stages.title")
- .font(.Theme.Title.emphasized)
- .lineSpacing(Dimensions.LineHeight.title - Dimensions.FontSize.title)
- Text("preferences.stages.explanation")
- .font(.Theme.Body.regular)
- .kerning(Dimensions.Kerning.body)
- .lineSpacing(Dimensions.LineHeight.body - Dimensions.FontSize.body)
- .padding(.top, Dimensions.Spacing.loose)
- .padding(.bottom, Dimensions.Spacing.regular)
-
Table(customStages) {
- TableColumn("Name") { customStage in
+ TableColumn("preferences.stages.column.name") { customStage in
TextField(
- "Stage Name",
+ "preferences.stages.placeholder.name",
text: Binding(
get: { customStage.name },
set: { newValue in
@@ -46,9 +37,9 @@ struct StagesPreferencesView: View {
}
.width(120)
- TableColumn("Stage I") { customStage in
+ TableColumn("preferences.stages.column.stage_i") { customStage in
TextField(
- "Stage I",
+ "preferences.stages.placeholder.stage_i",
text: Binding(
get: { customStage.stage.i },
set: { newValue in
@@ -59,9 +50,9 @@ struct StagesPreferencesView: View {
.textFieldStyle(.plain)
}
- TableColumn("Stage II") { customStage in
+ TableColumn("preferences.stages.column.stage_ii") { customStage in
TextField(
- "Stage II",
+ "preferences.stages.placeholder.stage_ii",
text: Binding(
get: { customStage.stage.ii },
set: { newValue in
@@ -72,9 +63,9 @@ struct StagesPreferencesView: View {
.textFieldStyle(.plain)
}
- TableColumn("Stage III") { customStage in
+ TableColumn("preferences.stages.column.stage_iii") { customStage in
TextField(
- "Stage III",
+ "preferences.stages.placeholder.stage_iii",
text: Binding(
get: { customStage.stage.iii },
set: { newValue in
@@ -85,9 +76,9 @@ struct StagesPreferencesView: View {
.textFieldStyle(.plain)
}
- TableColumn("Stage IV") { customStage in
+ TableColumn("preferences.stages.column.stage_iv") { customStage in
TextField(
- "Stage IV",
+ "preferences.stages.placeholder.stage_iv",
text: Binding(
get: { customStage.stage.iv },
set: { newValue in
@@ -108,8 +99,20 @@ struct StagesPreferencesView: View {
}
.tableStyle(.bordered(alternatesRowBackgrounds: true))
- HStack {
+ HStack(spacing: Dimensions.Spacing.regular) {
Spacer()
+ Button(action: { showingHelpPopover = true }) {
+ Image(systemName: "questionmark.circle")
+ }
+ .buttonStyle(.borderless)
+ .popover(isPresented: $showingHelpPopover, arrowEdge: .bottom) {
+ Text("preferences.stages.explanation")
+ .font(.Theme.Body.regular)
+ .kerning(Dimensions.Kerning.body)
+ .lineSpacing(Dimensions.LineHeight.body - Dimensions.FontSize.body)
+ .frame(width: 300)
+ .padding(Dimensions.Spacing.regular)
+ }
Button(action: addStage) {
Image(systemName: "plus")
}
diff --git a/Map/Presentation/Preferences/TemplatesPreferencesView.swift b/Map/Presentation/Preferences/TemplatesPreferencesView.swift
index 92b9b09..2b70b67 100644
--- a/Map/Presentation/Preferences/TemplatesPreferencesView.swift
+++ b/Map/Presentation/Preferences/TemplatesPreferencesView.swift
@@ -41,6 +41,7 @@ struct TemplatesPreferencesView: View {
@State private var selectedTemplate: Template?
@State private var showingAddSheet = false
@State private var newTemplateName = ""
+ @State private var showingHelpPopover = false
private var templates: Binding<[Template]> {
Binding(
@@ -80,15 +81,6 @@ struct TemplatesPreferencesView: View {
var body: some View {
VStack(alignment: .leading, spacing: Dimensions.Spacing.regular) {
- Text("preferences.templates.title")
- .font(.Theme.Title.emphasized)
- .lineSpacing(Dimensions.LineHeight.title - Dimensions.FontSize.title)
- Text("preferences.templates.explanation")
- .font(.Theme.Body.regular)
- .kerning(Dimensions.Kerning.body)
- .lineSpacing(Dimensions.LineHeight.body - Dimensions.FontSize.body)
- .padding(.top, Dimensions.Spacing.loose)
- .padding(.bottom, Dimensions.Spacing.regular)
HStack(spacing: Dimensions.Spacing.cozy) {
VStack(alignment: .leading, spacing: Dimensions.Spacing.regular) {
List(templates.wrappedValue) { template in
@@ -135,24 +127,39 @@ struct TemplatesPreferencesView: View {
.listStyle(.plain)
.border(Color.Theme.UI.foreground.opacity(0.2), width: 1)
- HStack(spacing: Dimensions.Spacing.coziest) {
-
+ HStack(spacing: Dimensions.Spacing.regular) {
+
Spacer()
-
- Button(action: { showingAddSheet = true }) {
- Image(systemName: "plus")
+
+ Button(action: { showingHelpPopover = true }) {
+ Image(systemName: "questionmark.circle")
}
- .keyboardShortcut("t", modifiers: [.command])
- .help("preferences.templates.help.add")
-
- Button(action: {
- removeTemplate(selectedTemplate)
- }) {
- Image(systemName: "minus")
+ .buttonStyle(.borderless)
+ .popover(isPresented: $showingHelpPopover, arrowEdge: .bottom) {
+ Text("preferences.templates.explanation")
+ .font(.Theme.Body.regular)
+ .kerning(Dimensions.Kerning.body)
+ .lineSpacing(Dimensions.LineHeight.body - Dimensions.FontSize.body)
+ .frame(width: 300)
+ .padding(Dimensions.Spacing.regular)
+ }
+
+ HStack(spacing: Dimensions.Spacing.coziest) {
+ Button(action: { showingAddSheet = true }) {
+ Image(systemName: "plus")
+ }
+ .keyboardShortcut("t", modifiers: [.command])
+ .help("preferences.templates.help.add")
+
+ Button(action: {
+ removeTemplate(selectedTemplate)
+ }) {
+ Image(systemName: "minus")
+ }
+ .keyboardShortcut(.delete, modifiers: [.command])
+ .help("preferences.templates.help.remove \(selectedTemplate?.name ?? "")")
+ .disabled(selectedTemplate == nil)
}
- .keyboardShortcut(.delete, modifiers: [.command])
- .help("preferences.templates.help.remove \(selectedTemplate?.name ?? "")")
- .disabled(selectedTemplate == nil)
}
}
.frame(width: Dimensions.Preferences.Sidebar.width)