Skip to content

Commit 929a6e9

Browse files
More general UI tweaks
Change the pin detail's toolbar to be less cluttered in either editing mode. Increase the contrast of the header when preferred by the player, removing the cover image. Allow players to toggle the map view when it is available in the current window size.
1 parent dba139b commit 929a6e9

File tree

9 files changed

+116
-56
lines changed

9 files changed

+116
-56
lines changed

MCMaps/Legacy/Views/ContentViewToolbar.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,18 @@ struct ContentViewToolbar: ToolbarContent {
7373
#if os(macOS)
7474
ToolbarItem {
7575
Button {
76-
viewModel.displayCurrentRouteAsInspector.wrappedValue.toggle()
76+
viewModel.currentRoute = .editWorld
7777
} label: {
78-
Label("Pin Inspector", image: "mappin.circle.badge.gearshape.fill")
78+
Label("Update World", image: "globe.desk.badge.gearshape.fill")
7979
}
80-
.disabled(viewModel.currentRoute?.requiresInspectorDisplay != true)
8180
}
8281
ToolbarItem {
8382
Button {
84-
viewModel.currentRoute = .editWorld
83+
viewModel.displayCurrentRouteAsInspector.wrappedValue.toggle()
8584
} label: {
86-
Label("Update World", image: "globe.desk.badge.gearshape.fill")
85+
Label("Pin Inspector", semanticIcon: .inspectorToggle)
8786
}
87+
.disabled(viewModel.currentRoute?.requiresInspectorDisplay != true)
8888
}
8989
#endif
9090
}

MCMaps/Red Window/Views/Detail/Cells/RedWindowDescriptionCell.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ struct RedWindowDescriptionCell: RedWindowDetailCell {
2727
.padding(.top)
2828
if isEditing {
2929
TextEditor(text: $pin.description)
30+
.textFieldStyle(.roundedBorder)
3031
.frame(minHeight: 200)
3132
.overlay(alignment: .topLeading) {
3233
if pin.description.isEmpty {

MCMaps/Red Window/Views/Detail/Cells/RedWindowPinHeader.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import SwiftUI
1717
/// Entering edit mode on the header will allow players to edit the title of the pin, switching to the default system
1818
/// font.
1919
struct RedWindowPinHeader: RedWindowDetailCell {
20+
@Environment(\.colorSchemeContrast) private var colorSchemeContrast
21+
2022
private enum Constants {
2123
static let headerHeight = 300.0
2224
}
@@ -42,7 +44,7 @@ struct RedWindowPinHeader: RedWindowDetailCell {
4244

4345
var body: some View {
4446
Group {
45-
if let coverImage, !isEditing {
47+
if let coverImage, !isEditing, colorSchemeContrast == .standard {
4648
ZStack {
4749
Color.black
4850
Rectangle()
@@ -75,12 +77,14 @@ struct RedWindowPinHeader: RedWindowDetailCell {
7577

7678
.frame(height: Constants.headerHeight)
7779
.backgroundExtensionEffectIfAvailable()
80+
.animation(.interactiveSpring, value: colorSchemeContrast)
7881
.overlay(alignment: .bottomLeading) {
7982
HStack {
8083
VStack(alignment: .leading) {
8184
Group {
8285
if isEditing {
8386
TextField("", text: $pin.name, prompt: Text("Name"))
87+
.textFieldStyle(.roundedBorder)
8488
} else {
8589
Text(pin.name)
8690
.fontDesign(.serif)

MCMaps/Red Window/Views/Detail/RedWindowPinDetailView.swift

Lines changed: 56 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ struct RedWindowPinDetailView: View {
3131

3232
@State private var tags = Set<String>()
3333
@State private var displayAlert = false
34+
@State private var displayInspector = true
3435
@State private var center = CGPoint.zero
3536
@State private var color = CartographyMapPin.Color.blue
3637
@State private var editMode = false
@@ -42,10 +43,14 @@ struct RedWindowPinDetailView: View {
4243
@State private var photosPickerItem: PhotosPickerItem?
4344
@State private var uploadFromFiles = false
4445

45-
private var shouldDisplayMapView: Bool {
46+
private var canDisplayMapView: Bool {
4647
return tabBarPlacement != .sidebar && horizontalSizeClass == .regular
4748
}
4849

50+
private var shouldDisplayMapView: Bool {
51+
return canDisplayMapView && displayInspector
52+
}
53+
4954
var body: some View {
5055
@Bindable var env = redWindowEnvironment
5156

@@ -55,10 +60,10 @@ struct RedWindowPinDetailView: View {
5560
RedWindowPinHeader(pin: $pin, isEditing: $editMode, file: file)
5661
Group {
5762
RedWindowDescriptionCell(pin: $pin, isEditing: $editMode, file: $file)
58-
if !tags.isEmpty {
59-
RedWindowPinTagsCell(pin: $pin, isEditing: $editMode, file: $file)
60-
}
6163
if !editMode {
64+
if !tags.isEmpty {
65+
RedWindowPinTagsCell(pin: $pin, isEditing: $editMode, file: $file)
66+
}
6267
RedWindowPinGalleryCell(pin: $pin, isEditing: $editMode, file: $file)
6368
}
6469
}
@@ -71,6 +76,7 @@ struct RedWindowPinDetailView: View {
7176
.ignoresSafeArea(edges: .vertical)
7277
.animation(.interactiveSpring, value: tabBarPlacement)
7378
.animation(.interactiveSpring, value: editMode)
79+
.animation(.interactiveSpring, value: displayInspector)
7480
.task {
7581
center = pin.position
7682
if let currentColor = pin.color {
@@ -123,31 +129,7 @@ struct RedWindowPinDetailView: View {
123129
}
124130
}
125131
.toolbar {
126-
if !editMode {
127-
ToolbarItem {
128-
Button("Show on Map", semanticIcon: .goHere) {
129-
env.mapCenterCoordinate = pin.position
130-
env.currentRoute = .map
131-
}
132-
}
133-
134-
#if RED_WINDOW
135-
if #available(macOS 16, iOS 19, *) {
136-
ToolbarSpacer(.fixed)
137-
}
138-
#endif
139-
}
140-
141-
ToolbarItem {
142-
editButton
143-
}
144-
145-
if !editMode {
146-
#if RED_WINDOW
147-
if #available(macOS 16, iOS 19, *) {
148-
ToolbarSpacer(.fixed)
149-
}
150-
#endif
132+
if editMode {
151133
ToolbarItem {
152134
pinCustomizationMenu
153135
}
@@ -161,20 +143,47 @@ struct RedWindowPinDetailView: View {
161143
WorldCodedDimensionPicker(selection: $pin.dimension)
162144
}
163145
}
164-
146+
RedWindowToolbarSpacer()
165147
ToolbarItem {
166148
Button("Manage Tags…", systemImage: "tag") {
167149
presentTagEditor.toggle()
168150
}
169151
}
152+
RedWindowToolbarSpacer()
153+
}
170154

171-
#if RED_WINDOW
172-
if #available(macOS 16, iOS 19, *) {
173-
ToolbarSpacer(.fixed)
155+
if !editMode {
156+
RedWindowToolbarSpacer()
157+
photoUploadToolbar
158+
}
159+
160+
RedWindowToolbarSpacer()
161+
162+
if !editMode {
163+
ToolbarItem {
164+
Button("Show on Map", semanticIcon: .goHere) {
165+
env.mapCenterCoordinate = pin.position
166+
env.currentRoute = .map
174167
}
175-
#endif
168+
}
169+
}
176170

177-
photoUploadToolbar
171+
RedWindowToolbarSpacer()
172+
173+
ToolbarItem {
174+
editButton
175+
}
176+
177+
RedWindowToolbarSpacer()
178+
179+
ToolbarItem {
180+
if canDisplayMapView {
181+
Button(displayInspector ? "Hide Inspector" : "Show Inspector", semanticIcon: .inspectorToggle) {
182+
withAnimation {
183+
displayInspector.toggle()
184+
}
185+
}
186+
}
178187
}
179188
}
180189
}
@@ -275,23 +284,31 @@ struct RedWindowPinDetailView: View {
275284
#if RED_WINDOW
276285
if #available(iOS 19, macOS 16, *) {
277286
Button(role: .confirm) {
278-
editMode.toggle()
287+
withAnimation {
288+
editMode.toggle()
289+
}
279290
}
280291
} else {
281292
Button("Done", systemImage: "checkmark") {
282-
editMode.toggle()
293+
withAnimation {
294+
editMode.toggle()
295+
}
283296
}
284297
.buttonStyle(.borderedProminent)
285298
}
286299
#else
287300
Button("Done", systemImage: "checkmark") {
288-
editMode.toggle()
301+
withAnimation {
302+
editMode.toggle()
303+
}
289304
}
290305
.buttonStyle(.borderedProminent)
291306
#endif
292307
} else {
293308
Button("Edit") {
294-
editMode.toggle()
309+
withAnimation {
310+
editMode.toggle()
311+
}
295312
}
296313
}
297314
}

MCMaps/Red Window/Views/RedWindowTagForm.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ struct RedWindowTagForm: View {
5858
.toolbar {
5959
#if os(iOS)
6060
ToolbarItem {
61-
EditButton()
62-
.disabled(tags.isEmpty)
61+
if !tags.isEmpty {
62+
EditButton()
63+
}
6364
}
6465
#endif
6566
ToolbarItem(placement: .confirmationAction) {
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//
2+
// RedWindowToolbarSpacer.swift
3+
// MCMaps
4+
//
5+
// Created by Marquis Kurt on 16-08-2025.
6+
//
7+
8+
import SwiftUI
9+
10+
struct RedWindowToolbarSpacer: ToolbarContent {
11+
var body: some ToolbarContent {
12+
#if RED_WINDOW
13+
if #available(macOS 16, iOS 19, *) {
14+
ToolbarSpacer(.fixed)
15+
} else {
16+
ToolbarItem { EmptyView() }
17+
}
18+
#else
19+
ToolbarItem { EmptyView() }
20+
#endif
21+
}
22+
}

MCMaps/Resources/Localizable.xcstrings

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,9 @@
278278
},
279279
"Hide All Tips" : {
280280

281+
},
282+
"Hide Inspector" : {
283+
281284
},
282285
"Host" : {
283286

@@ -516,6 +519,9 @@
516519
},
517520
"Show in Finder" : {
518521

522+
},
523+
"Show Inspector" : {
524+
519525
},
520526
"Show on Map" : {
521527

MCMaps/Shared/Models/SemanticIcon.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,17 @@ enum SemanticIcon: String {
4040
/// The player is intending to select a world dimension.
4141
case dimensionSelect = "atom"
4242

43-
/// The player is intending to select an icon.
44-
case iconSelect = "xmark.triangle.circle.square"
45-
4643
/// The player is intending to go to a specific location.
4744
///
4845
/// This can also be used to refer to a current location.
4946
case goHere = "location"
5047

48+
/// The player is intending to select an icon.
49+
case iconSelect = "xmark.triangle.circle.square"
50+
51+
/// An icon used to indicate an inspector in the app.
52+
case inspectorToggle = "sidebar.right"
53+
5154
/// The icon representing the Overworld dimension.
5255
case overworld = "tree"
5356

MCMaps/Shared/Views/PinCoordinateStack.swift

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@ struct PinCoordinateStack: View {
2929
)
3030
.accessibilityLabel("Location in " + pin.dimension.rawValue.localizedCapitalized)
3131
.accessibilityValue(pin.position.accessibilityReadout)
32-
Label("(\(pairing.accessibilityReadout))", semanticIcon: symbol(for: pairedDimension))
33-
.help(
34-
"Location in \(pairedDimension.rawValue.localizedCapitalized): \(pairing.accessibilityReadout)"
35-
)
36-
.accessibilityLabel("Location in " + pairedDimension.rawValue.localizedCapitalized)
37-
.accessibilityValue(pairing.accessibilityReadout)
32+
if pinHasPairing {
33+
Label("(\(pairing.accessibilityReadout))", semanticIcon: symbol(for: pairedDimension))
34+
.help(
35+
"Location in \(pairedDimension.rawValue.localizedCapitalized): \(pairing.accessibilityReadout)"
36+
)
37+
.accessibilityLabel("Location in " + pairedDimension.rawValue.localizedCapitalized)
38+
.accessibilityValue(pairing.accessibilityReadout)
39+
}
3840
}
3941
}
4042

@@ -46,6 +48,10 @@ struct PinCoordinateStack: View {
4648
}
4749
}
4850

51+
var pinHasPairing: Bool {
52+
pin.dimension != .end
53+
}
54+
4955
var pairing: CGPoint {
5056
var paired = pin.position
5157
switch pin.dimension {

0 commit comments

Comments
 (0)