Skip to content

Commit 0f61279

Browse files
Display something when the search page is empty
1 parent 59d4d8a commit 0f61279

File tree

4 files changed

+158
-13
lines changed

4 files changed

+158
-13
lines changed

MCMaps/Red Window/Views/Search/RedWindowSearchView.swift

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,25 +74,37 @@ struct RedWindowSearchView: View {
7474
}
7575

7676
private var initialView: some View {
77-
List {
77+
Group {
7878
if let recentLocations = file.manifest.recentLocations {
79-
Section {
80-
ForEach(recentLocations, id: \.self) { recent in
81-
Label(recent.accessibilityReadout, systemImage: "location")
82-
.onTapGesture {
83-
redWindowEnvironment.mapCenterCoordinate = recent
84-
redWindowEnvironment.currentRoute = .map
85-
}
86-
.contextMenu {
87-
Button("Show on Map", systemImage: "location") {
79+
List {
80+
Section {
81+
ForEach(recentLocations, id: \.self) { recent in
82+
Label(recent.accessibilityReadout, systemImage: "location")
83+
.onTapGesture {
8884
redWindowEnvironment.mapCenterCoordinate = recent
8985
redWindowEnvironment.currentRoute = .map
9086
}
91-
}
87+
.contextMenu {
88+
Button("Show on Map", systemImage: "location") {
89+
redWindowEnvironment.mapCenterCoordinate = recent
90+
redWindowEnvironment.currentRoute = .map
91+
}
92+
}
93+
}
94+
} header: {
95+
Text("Locations You've Visited")
9296
}
93-
} header: {
94-
Text("Locations You've Visited")
9597
}
98+
} else {
99+
// swiftlint:disable line_length
100+
ContentUnavailableView(
101+
"Search Everything",
102+
image: "map.badge.magnifyingglass",
103+
description: Text(
104+
"Search for nearby biomes and structures, pinned places, and any marked locations from integrations like Bluemap."
105+
)
106+
)
107+
// swiftlint:enable line_length
96108
}
97109
}
98110
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
},
6+
"symbols" : [
7+
{
8+
"filename" : "map.badge.magnifyingglass.svg",
9+
"idiom" : "universal"
10+
}
11+
]
12+
}

0 commit comments

Comments
 (0)