mirror of
https://github.com/neon443/NearFuture.git
synced 2026-03-11 06:49:12 +00:00
locked the freak in for this one -
can cancel events being completed!!!!! added a cancel to symbolpicker and made it dip after choosing extracted completevent into viewmodel eventlistview is pretty full rn -- need to cleana added color picker ot addeventview wtf why wasnt it there
This commit is contained in:
@@ -222,6 +222,17 @@ class EventViewModel: ObservableObject, @unchecked Sendable {
|
||||
saveEvents() //sync with icloud
|
||||
}
|
||||
|
||||
func completeEvent(_ event: inout Event) {
|
||||
withAnimation { event.complete.toggle() }
|
||||
let eventToModify = self.events.firstIndex() { currEvent in
|
||||
currEvent.id == event.id
|
||||
}
|
||||
if let eventToModify = eventToModify {
|
||||
self.events[eventToModify] = event
|
||||
self.saveEvents()
|
||||
}
|
||||
}
|
||||
|
||||
func removeEvent(at index: IndexSet) {
|
||||
events.remove(atOffsets: index)
|
||||
saveEvents() //sync local and icl
|
||||
|
||||
@@ -14,6 +14,7 @@ struct SymbolsPicker: View {
|
||||
@FocusState var searchfocuesd: Bool
|
||||
|
||||
@State var searchInput: String = ""
|
||||
@Environment(\.dismiss) var dismiss
|
||||
|
||||
var symbols: [String] {
|
||||
return symbolsLoader.getSymbols(searchInput)
|
||||
@@ -45,6 +46,8 @@ struct SymbolsPicker: View {
|
||||
ForEach(symbols, id: \.self) { symbol in
|
||||
Button() {
|
||||
selection = symbol
|
||||
searchInput = ""
|
||||
dismiss()
|
||||
} label: {
|
||||
VStack {
|
||||
Image(systemName: symbol)
|
||||
@@ -62,7 +65,15 @@ struct SymbolsPicker: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.searchable(text: $searchInput)
|
||||
}
|
||||
.searchable(text: $searchInput)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .cancellationAction) {
|
||||
Button("Cancel") {
|
||||
searchInput = ""
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user