add new buttons

This commit is contained in:
neon443
2025-06-10 15:09:10 +01:00
parent a7e09692f6
commit 5ce48a4bc2
2 changed files with 110 additions and 92 deletions

View File

@@ -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()

View File

@@ -40,6 +40,7 @@ struct AddEventView: View {
}
NavigationStack {
Form {
LazyVStack {
Section(
header:
Text("Event Details")
@@ -141,24 +142,40 @@ struct AddEventView: View {
)
}
}
}
.scrollContentBackground(.hidden)
.navigationTitle("\(adding ? "Add Event" : "")")
// .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 {