mirror of
https://github.com/neon443/NearFuture.git
synced 2026-03-11 06:49:12 +00:00
add new buttons
This commit is contained in:
@@ -36,7 +36,7 @@ struct NearFutureApp: App {
|
||||
viewModel: viewModel,
|
||||
event: Binding(
|
||||
get: {
|
||||
viewModel.events.first(where: {$0.id == eventID})!
|
||||
viewModel.events.first(where: {$0.id == eventID}) ?? viewModel.template
|
||||
},
|
||||
set: { newValue in
|
||||
if let eventIndex = viewModel.events.firstIndex(where: {
|
||||
@@ -49,6 +49,7 @@ struct NearFutureApp: App {
|
||||
)
|
||||
)
|
||||
}
|
||||
.restorationBehavior(.disabled)
|
||||
|
||||
Window("About Near Future", id: "about") {
|
||||
AboutView()
|
||||
|
||||
@@ -40,6 +40,7 @@ struct AddEventView: View {
|
||||
}
|
||||
NavigationStack {
|
||||
Form {
|
||||
LazyVStack {
|
||||
Section(
|
||||
header:
|
||||
Text("Event Details")
|
||||
@@ -84,7 +85,7 @@ struct AddEventView: View {
|
||||
.onSubmit {
|
||||
focusedField = .Notes
|
||||
}
|
||||
// MagicClearButton(text: $eventName)
|
||||
// MagicClearButton(text: $eventName)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +100,7 @@ struct AddEventView: View {
|
||||
.onSubmit {
|
||||
focusedField = nil
|
||||
}
|
||||
// MagicClearButton(text: $eventNotes)
|
||||
// MagicClearButton(text: $eventNotes)
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +108,7 @@ struct AddEventView: View {
|
||||
HStack {
|
||||
Spacer()
|
||||
DatePicker("", selection: $eventDate, displayedComponents: .date)
|
||||
// .datePickerStyle(datepickersty)
|
||||
// .datePickerStyle(datepickersty)
|
||||
Spacer()
|
||||
Button() {
|
||||
eventDate = Date()
|
||||
@@ -141,24 +142,40 @@ struct AddEventView: View {
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
.scrollContentBackground(.hidden)
|
||||
.navigationTitle("\(adding ? "Add Event" : "")")
|
||||
// .navigationBarTitleDisplayMode(.inline)
|
||||
// .navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
ToolbarItem(/*placement: .topBarLeading*/) {
|
||||
#if canImport(UIKit)
|
||||
ToolbarItem(placement: .topBarLeading) {
|
||||
if adding {
|
||||
Button() {
|
||||
resetAddEventView()
|
||||
dismiss()
|
||||
} label: {
|
||||
Image(systemName: "xmark")
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(width: 30)
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
ToolbarItem() {
|
||||
if adding {
|
||||
Button() {
|
||||
resetAddEventView()
|
||||
dismiss()
|
||||
} label: {
|
||||
Image(systemName: "xmark")
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(width: 30)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
ToolbarItem/*(placement: .topBarTrailing)*/ {
|
||||
if adding {
|
||||
Button {
|
||||
|
||||
Reference in New Issue
Block a user