Skip to content

Commit 5d6976c

Browse files
authored
Merge pull request #235 from TaskarCenterAtUW/feature-unhide-all-elements
Unhide all elements
2 parents 5b28ee5 + 3b41ebf commit 5d6976c

File tree

2 files changed

+30
-7
lines changed

2 files changed

+30
-7
lines changed

GoInfoGame/GoInfoGame/quests/HiddenQuestManager.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ class HiddenQuestManager: ObservableObject {
5555
saveHiddenQuests()
5656
}
5757

58+
//remove all hidden quests
59+
func removeAllHiddenQuests() {
60+
hiddenQuests.removeAll()
61+
saveHiddenQuests()
62+
}
63+
5864
func saveHiddenQuests() {
5965
let encoder = JSONEncoder()
6066
if let encodedData = try? encoder.encode(hiddenQuests) {

GoInfoGame/GoInfoGame/quests/QuestCategory/UI/ManageQuestsView.swift

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,29 @@ struct ManageQuestsView: View {
7878
if hiddenQuestManager.hiddenQuests.isEmpty {
7979
Color.clear.frame(height: 50) // Placeholder to prevent jumpy UI
8080
} else {
81-
Text("HIDDEN ELEMENTS")
82-
.font(.custom("Lato-Bold", size: 15))
83-
.foregroundColor(Color(red: 132/255, green: 135/255, blue: 153/255))
84-
.padding(.horizontal)
85-
.padding(.top, 10)
86-
.padding(.leading, 15)
81+
HStack(alignment: .firstTextBaseline) {
82+
Text("HIDDEN ELEMENTS")
83+
.font(.custom("Lato-Bold", size: 15))
84+
.foregroundColor(Color(red: 132/255, green: 135/255, blue: 153/255))
85+
.padding(.horizontal)
86+
.padding(.top, 10)
87+
.padding(.leading, 15)
88+
Spacer()
89+
Button(action: {
90+
hiddenQuestManager.removeAllHiddenQuests()
91+
}) {
92+
Text("Unhide All")
93+
.font(.custom("Lato-Bold", size: 16))
94+
.foregroundColor(.white)
95+
.padding(.vertical, 10) // vertical padding
96+
.padding(.horizontal, 20) // horizontal padding
97+
.background(Color(red: 135/255, green: 62/255, blue: 242/255))
98+
.cornerRadius(10)
99+
}
100+
.padding(.trailing, 15)
101+
102+
103+
}
87104
Text("Swipe left on item to show delete option and delete it from the list.")
88105
.font(.custom("Lato-Bold", size: 12))
89106
.foregroundColor(Color(red: 132/255, green: 135/255, blue: 153/255))
@@ -94,7 +111,7 @@ struct ManageQuestsView: View {
94111
let quest = hiddenQuestManager.hiddenQuests[index]
95112

96113
HStack {
97-
Text("ID: \(quest.id)")
114+
Text("ID: \(String(quest.id))")
98115
.font(.custom("Lato-Bold", size: 15))
99116
.foregroundColor(Color(red: 69 / 255, green: 81 / 255, blue: 108 / 255))
100117

0 commit comments

Comments
 (0)