aboutsummaryrefslogtreecommitdiff
path: root/Map
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2025-07-07 09:14:56 +0200
committerRuben Beltran del Rio <git@r.bdr.sh>2025-07-07 09:14:56 +0200
commit933078c10e99002c8a5f647e476819f0f1706a14 (patch)
tree664f1f0f8f7651bf2f65e81290b6781b335fde4a /Map
parentf4edef273e4501a28cac7cb43fa7ad6f224fcb4a (diff)
Adjust spacing and add more translation keys
Diffstat (limited to 'Map')
-rw-r--r--Map/Localizable.xcstrings262
-rw-r--r--Map/Presentation/Base Components/MapTextEditor.swift1
-rw-r--r--Map/Presentation/Commands/MapCommands.swift18
-rw-r--r--Map/Presentation/MapEditor.swift4
-rw-r--r--Map/Presentation/Preferences/StagesPreferencesView.swift1
-rw-r--r--Map/Presentation/Preferences/TemplatesPreferencesView.swift128
-rw-r--r--Map/Presentation/Theme/Dimensions.swift2
7 files changed, 289 insertions, 127 deletions
diff --git a/Map/Localizable.xcstrings b/Map/Localizable.xcstrings
index 4e6112d..c40d6ce 100644
--- a/Map/Localizable.xcstrings
+++ b/Map/Localizable.xcstrings
@@ -4,24 +4,37 @@
"" : {
},
- "Add" : {
-
- },
- "Add New Template" : {
-
- },
"Appearance Preferences" : {
},
"Appearance settings will be available here in a future version." : {
},
- "Cancel" : {
-
- },
"Check for Updates…" : {
},
+ "commands.edit.find" : {
+ "extractionState" : "manual",
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Find..."
+ }
+ }
+ }
+ },
+ "commands.file.export" : {
+ "extractionState" : "manual",
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Export..."
+ }
+ }
+ }
+ },
"commands.file.new_from_template" : {
"extractionState" : "manual",
"localizations" : {
@@ -33,6 +46,72 @@
}
}
},
+ "commands.file.new_from_template.empty" : {
+ "extractionState" : "manual",
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "No templates available"
+ }
+ }
+ }
+ },
+ "commands.help.help" : {
+ "extractionState" : "manual",
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Map Help"
+ }
+ }
+ }
+ },
+ "commands.view.layout.horizontal" : {
+ "extractionState" : "manual",
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Use Horizontal Layout"
+ }
+ }
+ }
+ },
+ "commands.view.layout.vertical" : {
+ "extractionState" : "manual",
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Use Vertical Layout"
+ }
+ }
+ }
+ },
+ "commands.view.zoom_in" : {
+ "extractionState" : "manual",
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Zoom In"
+ }
+ }
+ }
+ },
+ "commands.view.zoom_out" : {
+ "extractionState" : "manual",
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Zoom Out"
+ }
+ }
+ }
+ },
"Done" : {
},
@@ -50,18 +129,12 @@
}
}
},
- "Export..." : {
-
- },
"Find Next (⌘G)" : {
},
"Find Previous (⇧⌘G)" : {
},
- "Find..." : {
-
- },
"General Preferences" : {
},
@@ -74,15 +147,34 @@
"Invisible" : {
},
- "Map Help" : {
-
- },
"Map Preferences" : {
},
"Map settings will be available here in a future version." : {
},
+ "map_editor.zoom_in" : {
+ "extractionState" : "manual",
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Zoom In (⌘+)"
+ }
+ }
+ }
+ },
+ "map_editor.zoom_out" : {
+ "extractionState" : "manual",
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Zoom Out (⌘-)"
+ }
+ }
+ }
+ },
"map_template.default.content" : {
"extractionState" : "manual",
"localizations" : {
@@ -119,9 +211,6 @@
"Name" : {
},
- "No templates available" : {
-
- },
"preferences.stages.explanation" : {
"extractionState" : "manual",
"localizations" : {
@@ -144,6 +233,17 @@
}
}
},
+ "preferences.templates.empty_view" : {
+ "extractionState" : "manual",
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Select a template to edit."
+ }
+ }
+ }
+ },
"preferences.templates.explanation" : {
"extractionState" : "manual",
"localizations" : {
@@ -155,6 +255,83 @@
}
}
},
+ "preferences.templates.help.add" : {
+ "extractionState" : "manual",
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Add a new template (⌘T)"
+ }
+ }
+ }
+ },
+ "preferences.templates.help.remove %@" : {
+ "extractionState" : "manual",
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Remove “%@” (⌘⌫)"
+ }
+ }
+ }
+ },
+ "preferences.templates.help.set_as_default" : {
+ "extractionState" : "manual",
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Set as default template (⌘D)"
+ }
+ }
+ }
+ },
+ "preferences.templates.new_template.add" : {
+ "extractionState" : "manual",
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Add Template"
+ }
+ }
+ }
+ },
+ "preferences.templates.new_template.cancel" : {
+ "extractionState" : "manual",
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Cancel"
+ }
+ }
+ }
+ },
+ "preferences.templates.new_template.placeholder" : {
+ "extractionState" : "manual",
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Template Name"
+ }
+ }
+ }
+ },
+ "preferences.templates.new_template.title" : {
+ "extractionState" : "manual",
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Add New Template"
+ }
+ }
+ }
+ },
"preferences.templates.table.title" : {
"extractionState" : "manual",
"localizations" : {
@@ -180,12 +357,6 @@
"Search" : {
},
- "Select a template to edit" : {
-
- },
- "Set as default template" : {
-
- },
"Stage I" : {
},
@@ -394,7 +565,7 @@
"en" : {
"stringUnit" : {
"state" : "translated",
- "value" : "stage_type.market_action"
+ "value" : "Market Action"
}
}
}
@@ -531,17 +702,6 @@
}
}
},
- "stage_type.section.other" : {
- "extractionState" : "stale",
- "localizations" : {
- "en" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Custom"
- }
- }
- }
- },
"stage_type.section.types" : {
"localizations" : {
"en" : {
@@ -585,35 +745,11 @@
}
}
},
- "Template Name" : {
-
- },
- "Template: %@" : {
-
- },
"Uncharted" : {
},
- "Use Horizontal Layout" : {
-
- },
- "Use Vertical Layout" : {
-
- },
"Visible" : {
- },
- "Zoom In" : {
-
- },
- "Zoom In (⌘+)" : {
-
- },
- "Zoom Out" : {
-
- },
- "Zoom Out (⌘-)" : {
-
}
},
"version" : "1.0"
diff --git a/Map/Presentation/Base Components/MapTextEditor.swift b/Map/Presentation/Base Components/MapTextEditor.swift
index 4790a70..fe4a7d6 100644
--- a/Map/Presentation/Base Components/MapTextEditor.swift
+++ b/Map/Presentation/Base Components/MapTextEditor.swift
@@ -72,6 +72,7 @@ class MapTextEditorController: NSViewController {
textView.string = self.text
textView.isEditable = true
textView.font = .monospacedSystemFont(ofSize: 16.0, weight: .regular)
+ textView.textContainerInset = NSSize(width: 0, height: Dimensions.Spacing.coziest)
self.view = scrollView
}
diff --git a/Map/Presentation/Commands/MapCommands.swift b/Map/Presentation/Commands/MapCommands.swift
index e7ee8f8..bd0227d 100644
--- a/Map/Presentation/Commands/MapCommands.swift
+++ b/Map/Presentation/Commands/MapCommands.swift
@@ -42,7 +42,7 @@ struct MapCommands: Commands {
CommandGroup(after: CommandGroupPlacement.newItem) {
Menu(String(localized: "commands.file.new_from_template")) {
if templates.isEmpty {
- Text("No templates available")
+ Text("commands.file.new_from_template.empty")
.disabled(true)
} else {
ForEach(templates) { template in
@@ -56,7 +56,7 @@ struct MapCommands: Commands {
CommandGroup(after: CommandGroupPlacement.saveItem) {
Divider()
- Button("Export...") {
+ Button("commands.file.export") {
if let selectedEvolution, let document {
if let image = document.exportAsImage(withEvolution: selectedEvolution) {
@@ -93,7 +93,7 @@ struct MapCommands: Commands {
CommandGroup(after: CommandGroupPlacement.pasteboard) {
Divider()
- Button("Find...") {
+ Button("commands.edit.find") {
isSearching = isSearching != nil ? !isSearching! : true
}.keyboardShortcut(
"f", modifiers: EventModifiers([.command])
@@ -104,25 +104,25 @@ struct MapCommands: Commands {
CommandGroup(after: CommandGroupPlacement.toolbar) {
if viewStyle == .horizontal {
- Button("Use Vertical Layout") {
+ Button("commands.view.layout.vertical") {
viewStyle = .vertical
}.keyboardShortcut(
"l", modifiers: EventModifiers([.command])
).disabled(document == nil)
} else {
- Button("Use Horizontal Layout") {
+ Button("commands.view.layout.horizontal") {
viewStyle = .horizontal
}.keyboardShortcut(
"l", modifiers: EventModifiers([.command])
).disabled(document == nil)
}
Divider()
- Button("Zoom In") {
+ Button("commands.view.zoom_in") {
zoom = min(Constants.kMaxZoom, zoom + 0.1)
}.keyboardShortcut(
"+", modifiers: EventModifiers([.command])
).disabled(document == nil)
- Button("Zoom Out") {
+ Button("commands.view.zoom_out") {
zoom = max(Constants.kMinZoom, zoom - 0.1)
}.keyboardShortcut(
"-", modifiers: EventModifiers([.command])
@@ -131,7 +131,9 @@ struct MapCommands: Commands {
}
CommandGroup(replacing: CommandGroupPlacement.help) {
- Button("Map Help") { NSWorkspace.shared.open(URL(string: "https://map.tranquil.systems")!) }
+ Button("commands.help.help") {
+ NSWorkspace.shared.open(URL(string: "https://map.tranquil.systems")!)
+ }
}
}
diff --git a/Map/Presentation/MapEditor.swift b/Map/Presentation/MapEditor.swift
index fe10427..267492c 100644
--- a/Map/Presentation/MapEditor.swift
+++ b/Map/Presentation/MapEditor.swift
@@ -138,12 +138,12 @@ struct MapEditor: View {
minimumValueLabel: {
Image(systemName: "minus.magnifyingglass")
.font(.Theme.SmallControl.regular)
- .help("Zoom Out (⌘-)")
+ .help("map_editor.zoom_out")
},
maximumValueLabel: {
Image(systemName: "plus.magnifyingglass")
.font(.Theme.SmallControl.regular)
- .help("Zoom In (⌘+)")
+ .help("map_editor.zoom_in")
}
).frame(width: 200).padding(.trailing, 10.0)
}.padding(4.0)
diff --git a/Map/Presentation/Preferences/StagesPreferencesView.swift b/Map/Presentation/Preferences/StagesPreferencesView.swift
index b1ce31c..cd347bf 100644
--- a/Map/Presentation/Preferences/StagesPreferencesView.swift
+++ b/Map/Presentation/Preferences/StagesPreferencesView.swift
@@ -113,7 +113,6 @@ struct StagesPreferencesView: View {
Button(action: addStage) {
Image(systemName: "plus")
}
- .buttonStyle(.borderless)
}
}
.padding(.vertical, Dimensions.Spacing.loose)
diff --git a/Map/Presentation/Preferences/TemplatesPreferencesView.swift b/Map/Presentation/Preferences/TemplatesPreferencesView.swift
index 2994450..92b9b09 100644
--- a/Map/Presentation/Preferences/TemplatesPreferencesView.swift
+++ b/Map/Presentation/Preferences/TemplatesPreferencesView.swift
@@ -89,43 +89,32 @@ struct TemplatesPreferencesView: View {
.lineSpacing(Dimensions.LineHeight.body - Dimensions.FontSize.body)
.padding(.top, Dimensions.Spacing.loose)
.padding(.bottom, Dimensions.Spacing.regular)
- HStack(spacing: 0) {
+ HStack(spacing: Dimensions.Spacing.cozy) {
VStack(alignment: .leading, spacing: Dimensions.Spacing.regular) {
- HStack {
- Text("preferences.templates.table.title")
- .font(.Theme.Body.emphasized)
-
- Spacer()
-
- Button(action: { showingAddSheet = true }) {
- Image(systemName: "plus")
- }
- .buttonStyle(.borderless)
-
- Button(action: {
- removeTemplate(selectedTemplate)
- }) {
- Image(systemName: "minus")
- }
- .buttonStyle(.borderless)
- .disabled(selectedTemplate == nil)
- }
-
List(templates.wrappedValue) { template in
- HStack {
- Button(action: { setDefaultTemplate(template) }) {
- Image(systemName: template.isDefault ? "largecircle.fill.circle" : "circle")
- .foregroundColor(
- selectedTemplate?.id == template.id
- ? Color.white
- : (template.isDefault
+ HStack(spacing: Dimensions.Spacing.coziest) {
+ if selectedTemplate?.id == template.id {
+ Button(action: { setDefaultTemplate(template) }) {
+ Image(systemName: template.isDefault ? "largecircle.fill.circle" : "circle")
+ .foregroundColor(Color.white)
+ }
+ .buttonStyle(.plain)
+ .keyboardShortcut("d", modifiers: [.command])
+ .help("preferences.templates.help.set_as_default")
+ } else {
+ Button(action: { setDefaultTemplate(template) }) {
+ Image(systemName: template.isDefault ? "largecircle.fill.circle" : "circle")
+ .foregroundColor(
+ template.isDefault
? Color.Theme.UI.accent : Color.Theme.UI.foreground.opacity(0.5))
- )
+ }
+ .buttonStyle(.plain)
+ .help("preferences.templates.help.set_as_default")
}
- .buttonStyle(.plain)
- .help("Set as default template")
Text(template.name)
+ .font(.Theme.Body.regular)
+ .kerning(Dimensions.Kerning.body)
.tag(template)
.foregroundColor(
selectedTemplate?.id == template.id ? Color.white : Color.Theme.UI.foreground
@@ -144,24 +133,40 @@ struct TemplatesPreferencesView: View {
}
}
.listStyle(.plain)
+ .border(Color.Theme.UI.foreground.opacity(0.2), width: 1)
+
+ HStack(spacing: Dimensions.Spacing.coziest) {
+
+ Spacer()
+
+ 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)
+ }
}
.frame(width: Dimensions.Preferences.Sidebar.width)
Divider()
- VStack(alignment: .leading, spacing: 8) {
- if let selected = selectedTemplate {
- HStack {
- Text("Template: \(selected.name)")
- .font(.headline)
- Spacer()
- }
-
+ VStack(alignment: .leading, spacing: Dimensions.Spacing.regular) {
+ if selectedTemplate != nil {
MapTextEditor(text: selectedTemplateContent)
+ .border(Color.Theme.UI.foreground.opacity(0.2), width: 1)
} else {
VStack {
Spacer()
- Text("Select a template to edit")
+ Text("preferences.templates.empty_view")
.foregroundColor(.secondary)
Spacer()
}
@@ -169,7 +174,6 @@ struct TemplatesPreferencesView: View {
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
- .padding(.leading)
}
.onAppear {
// Initialize default templates if needed
@@ -185,24 +189,44 @@ struct TemplatesPreferencesView: View {
}
.sheet(isPresented: $showingAddSheet) {
VStack(spacing: Dimensions.Spacing.indulgent) {
- Text("Add New Template")
+ Text("preferences.templates.new_template.title")
.font(.Theme.Body.emphasized)
+ .kerning(Dimensions.Kerning.body)
- TextField("Template Name", text: $newTemplateName)
+ TextField("preferences.templates.new_template.placeholder", text: $newTemplateName)
.textFieldStyle(.roundedBorder)
.font(.Theme.Body.regular)
-
- HStack {
- Button("Cancel") {
- showingAddSheet = false
- newTemplateName = ""
+ .kerning(Dimensions.Kerning.body)
+ .onSubmit {
+ addTemplate()
}
- Spacer()
+ HStack(spacing: Dimensions.Spacing.coziest) {
- Button("Add") {
- addTemplate()
- }
+ Spacer()
+ Button(
+ action: {
+ showingAddSheet = false
+ newTemplateName = ""
+ },
+ label: {
+ Text("preferences.templates.new_template.cancel")
+ .font(.Theme.Body.regular)
+ .kerning(Dimensions.Kerning.body)
+ }
+ )
+ .keyboardShortcut(.escape)
+ Button(
+ action: {
+ addTemplate()
+ },
+ label: {
+ Text("preferences.templates.new_template.add")
+ .font(.Theme.Body.regular)
+ .kerning(Dimensions.Kerning.body)
+ }
+ )
+ .keyboardShortcut(.return)
.disabled(newTemplateName.isEmpty)
}
}
diff --git a/Map/Presentation/Theme/Dimensions.swift b/Map/Presentation/Theme/Dimensions.swift
index 94ab7c0..f31af9a 100644
--- a/Map/Presentation/Theme/Dimensions.swift
+++ b/Map/Presentation/Theme/Dimensions.swift
@@ -45,7 +45,7 @@ struct Dimensions {
}
struct Kerning {
- static let body: CGFloat = 0.5
+ static let body: CGFloat = 0.4
}
// MARK: - Spacing