changed datepicker slightly

This commit is contained in:
neon443
2025-02-27 11:39:51 +00:00
parent f556f7e4ca
commit f01bc6d28c
8 changed files with 19 additions and 39 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.DS_Store

View File

@@ -459,7 +459,7 @@
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault; "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 15; IPHONEOS_DEPLOYMENT_TARGET = 16;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 13; MACOSX_DEPLOYMENT_TARGET = 13;
@@ -501,7 +501,7 @@
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault; "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 15; IPHONEOS_DEPLOYMENT_TARGET = 16;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 13; MACOSX_DEPLOYMENT_TARGET = 13;

View File

@@ -29,7 +29,7 @@ struct AddEventView: View {
@Environment(\.dismiss) var dismiss @Environment(\.dismiss) var dismiss
var body: some View { var body: some View {
NavigationView { NavigationStack {
Form { Form {
Section( Section(
header: header:
@@ -88,12 +88,8 @@ struct AddEventView: View {
// date picker // date picker
HStack {
Spacer()
DatePicker("", selection: $eventDate, displayedComponents: .date) DatePicker("", selection: $eventDate, displayedComponents: .date)
.datePickerStyle(WheelDatePickerStyle()) .datePickerStyle(WheelDatePickerStyle())
Spacer()
}
// re-ocurrence Picker // re-ocurrence Picker
Picker("Recurrence", selection: $eventRecurrence) { Picker("Recurrence", selection: $eventRecurrence) {
@@ -127,6 +123,9 @@ struct AddEventView: View {
.font(.headline) .font(.headline)
.cornerRadius(10) .cornerRadius(10)
.buttonStyle(BorderedProminentButtonStyle()) .buttonStyle(BorderedProminentButtonStyle())
if eventName.isEmpty {
Text("Give your event a name.")
}
} }
.disabled(eventName.isEmpty) .disabled(eventName.isEmpty)
if eventName.isEmpty { if eventName.isEmpty {

View File

@@ -69,7 +69,7 @@ struct ContentView: View {
var body: some View { var body: some View {
TabView { TabView {
NavigationView { NavigationStack {
ZStack { ZStack {
backgroundGradient backgroundGradient
.ignoresSafeArea(.all) .ignoresSafeArea(.all)
@@ -131,12 +131,6 @@ struct ContentView: View {
adding: true //adding event adding: true //adding event
) )
} }
.sheet(
isPresented: $showSettings) {
SettingsView(
viewModel: viewModel
)
}
.toolbar { .toolbar {
ToolbarItem(placement: .topBarTrailing) { ToolbarItem(placement: .topBarTrailing) {
Button() { Button() {
@@ -147,13 +141,6 @@ struct ContentView: View {
.scaledToFit() .scaledToFit()
} }
} }
ToolbarItem(placement: .topBarLeading) {
Button() {
showSettings.toggle()
} label: {
Image(systemName: "gear")
}
}
} }
} }
} }
@@ -164,6 +151,10 @@ struct ContentView: View {
.tabItem { .tabItem {
Label("Statistics", systemImage: "chart.pie") Label("Statistics", systemImage: "chart.pie")
} }
SettingsView(viewModel: viewModel)
.tabItem {
Label("Settings", systemImage: "gear")
}
} }
} }
} }

View File

@@ -31,7 +31,7 @@ struct EditEventView: View {
} }
var body: some View { var body: some View {
// NavigationView { // NavigationStack {
AddEventView( AddEventView(
viewModel: viewModel, viewModel: viewModel,
eventName: $eventName, eventName: $eventName,

View File

@@ -9,7 +9,6 @@ import SwiftUI
struct SettingsView: View { struct SettingsView: View {
@State var viewModel: EventViewModel @State var viewModel: EventViewModel
@Environment(\.dismiss) var dismiss
@State private var hasUbiquitous: Bool = false @State private var hasUbiquitous: Bool = false
@State private var lastSyncWasSuccessful: Bool = false @State private var lastSyncWasSuccessful: Bool = false
@@ -41,7 +40,7 @@ struct SettingsView: View {
} }
var body: some View { var body: some View {
NavigationView { NavigationStack {
List { List {
NavigationLink() { NavigationLink() {
iCloudSettingsView( iCloudSettingsView(
@@ -69,7 +68,7 @@ struct SettingsView: View {
} }
NavigationLink() { NavigationLink() {
NavigationView() { NavigationStack() {
Button() { Button() {
UIPasteboard.general.string = "\(viewModel.exportEvents())" UIPasteboard.general.string = "\(viewModel.exportEvents())"
print(viewModel.exportEvents()) print(viewModel.exportEvents())
@@ -83,7 +82,7 @@ struct SettingsView: View {
Text("Export events") Text("Export events")
} }
NavigationLink() { NavigationLink() {
NavigationView() { NavigationStack() {
VStack { VStack {
TextEditor(text: $importStr) TextEditor(text: $importStr)
.foregroundStyle(.foreground, .gray) .foregroundStyle(.foreground, .gray)
@@ -133,16 +132,6 @@ struct SettingsView: View {
} }
.navigationTitle("Settings") .navigationTitle("Settings")
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .topBarTrailing) {
Button() {
dismiss()
} label: {
Image(systemName: "xmark.circle.fill")
.symbolRenderingMode(.hierarchical)
}
}
}
} }
} }
} }

View File

@@ -12,7 +12,7 @@ struct StatsView: View {
@ObservedObject var viewModel: EventViewModel @ObservedObject var viewModel: EventViewModel
var body: some View { var body: some View {
NavigationView { NavigationStack {
List { List {
Section(header: Text("Upcoming Events")) { Section(header: Text("Upcoming Events")) {
let upcomingEvents = viewModel.events.filter { $0.date > Date() } let upcomingEvents = viewModel.events.filter { $0.date > Date() }