Skip to content

Commit ea9d86c

Browse files
Clean up command groupings
1 parent 42f6d0c commit ea9d86c

File tree

4 files changed

+66
-28
lines changed

4 files changed

+66
-28
lines changed

Alidade/Entrypoint.swift

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -63,34 +63,8 @@ struct MCMapsApp: App {
6363
}
6464
}
6565
.commands {
66-
CommandMenu("Map") {
67-
Button("Go To...", systemImage: "figure.walk") {
68-
redWindowEnvironment.currentModalRoute = .warpToLocation
69-
}
70-
.disabled(redWindowEnvironment.currentRoute != .map)
71-
.keyboardShortcut("G", modifiers: [.command])
72-
Button("Pin Here...", systemImage: "mappin.circle") {
73-
redWindowEnvironment.currentModalRoute = .createPin
74-
}
75-
.disabled(redWindowEnvironment.currentRoute != .map)
76-
.keyboardShortcut("P", modifiers: [.command])
77-
Divider()
78-
Toggle(isOn: $naturalColors) {
79-
Label("Natural Colors", systemImage: "paintpalette")
80-
}
81-
WorldDimensionPickerView(selection: $redWindowEnvironment.currentDimension)
82-
.labelsVisibility(.visible)
83-
}
84-
CommandGroup(replacing: .help) {
85-
Link("\(Self.information.name) Help", destination: URL(appLink: .help)!)
86-
Divider()
87-
if let docs = URL(appLink: .docs) {
88-
Link("View \(Self.information.name) Documentation", destination: docs)
89-
}
90-
if let feedback = URL(appLink: .issues) {
91-
Link("Send \(Self.information.name) Feedback", destination: feedback)
92-
}
93-
}
66+
MapCommands(environment: redWindowEnvironment)
67+
HelpCommands()
9468
CommandGroup(after: .pasteboard) {
9569
Button("Configure World...", systemImage: "globe") {
9670
redWindowEnvironment.currentRoute = .worldEdit
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//
2+
// HelpCommands.swift
3+
// Alidade
4+
//
5+
// Created by Marquis Kurt on 18-01-2026.
6+
//
7+
8+
import SwiftUI
9+
10+
/// A group of commands that make up the "Help" menu.
11+
struct HelpCommands: Commands {
12+
var body: some Commands {
13+
CommandGroup(replacing: .help) {
14+
Link("\(MCMapsApp.information.name) Help", destination: URL(appLink: .help)!)
15+
Divider()
16+
if let docs = URL(appLink: .docs) {
17+
Link("View \(MCMapsApp.information.name) Documentation", destination: docs)
18+
}
19+
if let feedback = URL(appLink: .issues) {
20+
Link("Send \(MCMapsApp.information.name) Feedback", destination: feedback)
21+
}
22+
}
23+
}
24+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//
2+
// MapCommands.swift
3+
// Alidade
4+
//
5+
// Created by Marquis Kurt on 18-01-2026.
6+
//
7+
8+
import Foundation
9+
import SwiftUI
10+
11+
/// A group of commands used to control the map in Alidade.
12+
struct MapCommands: Commands {
13+
@AppStorage(UserDefaults.Keys.mapNaturalColors.rawValue) private var naturalColors = true
14+
@Bindable var redWindowEnvironment: RedWindowEnvironment
15+
16+
init(environment: RedWindowEnvironment) {
17+
self.redWindowEnvironment = environment
18+
}
19+
20+
var body: some Commands {
21+
CommandMenu("Map") {
22+
Button("Go To...", systemImage: "figure.walk") {
23+
redWindowEnvironment.currentModalRoute = .warpToLocation
24+
}
25+
.disabled(redWindowEnvironment.currentRoute != .map)
26+
.keyboardShortcut("G", modifiers: [.command])
27+
Button("Pin Here...", systemImage: "mappin.circle") {
28+
redWindowEnvironment.currentModalRoute = .createPin
29+
}
30+
.disabled(redWindowEnvironment.currentRoute != .map)
31+
.keyboardShortcut("P", modifiers: [.command])
32+
Divider()
33+
Toggle(isOn: $naturalColors) {
34+
Label("Natural Colors", systemImage: "paintpalette")
35+
}
36+
WorldDimensionPickerView(selection: $redWindowEnvironment.currentDimension)
37+
.labelsVisibility(.visible)
38+
}
39+
}
40+
}

0 commit comments

Comments
 (0)