mirror of
https://github.com/neon443/NearFuture.git
synced 2026-03-11 06:49:12 +00:00
Compare commits
3 Commits
2ef000458f
...
5ce48a4bc2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ce48a4bc2 | ||
|
|
a7e09692f6 | ||
|
|
559f891719 |
@@ -36,7 +36,7 @@ struct NearFutureApp: App {
|
|||||||
viewModel: viewModel,
|
viewModel: viewModel,
|
||||||
event: Binding(
|
event: Binding(
|
||||||
get: {
|
get: {
|
||||||
viewModel.events.first(where: {$0.id == eventID})!
|
viewModel.events.first(where: {$0.id == eventID}) ?? viewModel.template
|
||||||
},
|
},
|
||||||
set: { newValue in
|
set: { newValue in
|
||||||
if let eventIndex = viewModel.events.firstIndex(where: {
|
if let eventIndex = viewModel.events.firstIndex(where: {
|
||||||
@@ -49,6 +49,7 @@ struct NearFutureApp: App {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
.restorationBehavior(.disabled)
|
||||||
|
|
||||||
Window("About Near Future", id: "about") {
|
Window("About Near Future", id: "about") {
|
||||||
AboutView()
|
AboutView()
|
||||||
|
|||||||
@@ -40,125 +40,142 @@ struct AddEventView: View {
|
|||||||
}
|
}
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
Form {
|
Form {
|
||||||
Section(
|
LazyVStack {
|
||||||
header:
|
Section(
|
||||||
Text("Event Details")
|
header:
|
||||||
.font(.headline)
|
Text("Event Details")
|
||||||
.foregroundColor(.accentColor)
|
.font(.headline)
|
||||||
) {
|
.foregroundColor(.accentColor)
|
||||||
// name & symbol
|
) {
|
||||||
HStack(spacing: 5) {
|
// name & symbol
|
||||||
Button() {
|
HStack(spacing: 5) {
|
||||||
isSymbolPickerPresented.toggle()
|
Button() {
|
||||||
} label: {
|
isSymbolPickerPresented.toggle()
|
||||||
Image(systemName: eventSymbol)
|
} label: {
|
||||||
.resizable()
|
Image(systemName: eventSymbol)
|
||||||
.scaledToFit()
|
.resizable()
|
||||||
.frame(width: 20, height: 20)
|
.scaledToFit()
|
||||||
.foregroundStyle(eventColor)
|
.frame(width: 20, height: 20)
|
||||||
}
|
.foregroundStyle(eventColor)
|
||||||
.frame(width: 20)
|
}
|
||||||
.buttonStyle(.borderless)
|
.frame(width: 20)
|
||||||
.sheet(isPresented: $isSymbolPickerPresented) {
|
.buttonStyle(.borderless)
|
||||||
SymbolsPicker(
|
.sheet(isPresented: $isSymbolPickerPresented) {
|
||||||
selection: $eventSymbol,
|
SymbolsPicker(
|
||||||
title: "Choose a Symbol",
|
selection: $eventSymbol,
|
||||||
searchLabel: "Search...",
|
title: "Choose a Symbol",
|
||||||
autoDismiss: true)
|
searchLabel: "Search...",
|
||||||
.presentationDetents([.medium])
|
autoDismiss: true)
|
||||||
.apply {
|
.presentationDetents([.medium])
|
||||||
if #available(iOS 16.4, *) {
|
.apply {
|
||||||
$0.presentationBackground(.ultraThinMaterial)
|
if #available(iOS 16.4, *) {
|
||||||
|
$0.presentationBackground(.ultraThinMaterial)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ColorPicker("", selection: $eventColor, supportsOpacity: false)
|
||||||
|
.fixedSize()
|
||||||
|
ZStack {
|
||||||
|
TextField("Event Name", text: $eventName)
|
||||||
|
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||||
|
.padding(.trailing, eventName.isEmpty ? 0 : 30)
|
||||||
|
.animation(.spring, value: eventName)
|
||||||
|
.focused($focusedField, equals: Field.Name)
|
||||||
|
.submitLabel(.next)
|
||||||
|
.onSubmit {
|
||||||
|
focusedField = .Notes
|
||||||
|
}
|
||||||
|
// MagicClearButton(text: $eventName)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ColorPicker("", selection: $eventColor, supportsOpacity: false)
|
|
||||||
.fixedSize()
|
// dscription
|
||||||
ZStack {
|
ZStack {
|
||||||
TextField("Event Name", text: $eventName)
|
TextField("Event Notes", text: $eventNotes)
|
||||||
.textFieldStyle(RoundedBorderTextFieldStyle())
|
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||||
.padding(.trailing, eventName.isEmpty ? 0 : 30)
|
.padding(.trailing, eventNotes.isEmpty ? 0 : 30)
|
||||||
.animation(.spring, value: eventName)
|
.animation(.spring, value: eventNotes)
|
||||||
.focused($focusedField, equals: Field.Name)
|
.focused($focusedField, equals: Field.Notes)
|
||||||
.submitLabel(.next)
|
.submitLabel(.done)
|
||||||
.onSubmit {
|
.onSubmit {
|
||||||
focusedField = .Notes
|
focusedField = nil
|
||||||
}
|
}
|
||||||
// MagicClearButton(text: $eventName)
|
// MagicClearButton(text: $eventNotes)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// dscription
|
// date picker
|
||||||
ZStack {
|
HStack {
|
||||||
TextField("Event Notes", text: $eventNotes)
|
Spacer()
|
||||||
.textFieldStyle(RoundedBorderTextFieldStyle())
|
DatePicker("", selection: $eventDate, displayedComponents: .date)
|
||||||
.padding(.trailing, eventNotes.isEmpty ? 0 : 30)
|
// .datePickerStyle(datepickersty)
|
||||||
.animation(.spring, value: eventNotes)
|
Spacer()
|
||||||
.focused($focusedField, equals: Field.Notes)
|
Button() {
|
||||||
.submitLabel(.done)
|
eventDate = Date()
|
||||||
.onSubmit {
|
} label: {
|
||||||
focusedField = nil
|
Image(systemName: "arrow.uturn.left")
|
||||||
|
.resizable()
|
||||||
|
.scaledToFit()
|
||||||
}
|
}
|
||||||
// MagicClearButton(text: $eventNotes)
|
.buttonStyle(BorderlessButtonStyle())
|
||||||
}
|
.frame(width: 20)
|
||||||
|
|
||||||
|
|
||||||
// date picker
|
|
||||||
HStack {
|
|
||||||
Spacer()
|
|
||||||
DatePicker("", selection: $eventDate, displayedComponents: .date)
|
|
||||||
// .datePickerStyle(datepickersty)
|
|
||||||
Spacer()
|
|
||||||
Button() {
|
|
||||||
eventDate = Date()
|
|
||||||
} label: {
|
|
||||||
Image(systemName: "arrow.uturn.left")
|
|
||||||
.resizable()
|
|
||||||
.scaledToFit()
|
|
||||||
}
|
}
|
||||||
.buttonStyle(BorderlessButtonStyle())
|
|
||||||
.frame(width: 20)
|
DatePicker(
|
||||||
}
|
"",
|
||||||
|
selection: $eventDate,
|
||||||
DatePicker(
|
displayedComponents: .hourAndMinute
|
||||||
"",
|
|
||||||
selection: $eventDate,
|
|
||||||
displayedComponents: .hourAndMinute
|
|
||||||
)
|
|
||||||
|
|
||||||
// re-ocurrence Picker
|
|
||||||
Picker("Recurrence", selection: $eventRecurrence) {
|
|
||||||
ForEach(Event.RecurrenceType.allCases, id: \.self) { recurrence in
|
|
||||||
Text(recurrence.rawValue.capitalized)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.pickerStyle(SegmentedPickerStyle())
|
|
||||||
Text(
|
|
||||||
describeOccurrence(
|
|
||||||
date: eventDate,
|
|
||||||
recurrence: eventRecurrence
|
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
// re-ocurrence Picker
|
||||||
|
Picker("Recurrence", selection: $eventRecurrence) {
|
||||||
|
ForEach(Event.RecurrenceType.allCases, id: \.self) { recurrence in
|
||||||
|
Text(recurrence.rawValue.capitalized)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.pickerStyle(SegmentedPickerStyle())
|
||||||
|
Text(
|
||||||
|
describeOccurrence(
|
||||||
|
date: eventDate,
|
||||||
|
recurrence: eventRecurrence
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.scrollContentBackground(.hidden)
|
.scrollContentBackground(.hidden)
|
||||||
.navigationTitle("\(adding ? "Add Event" : "")")
|
.navigationTitle("\(adding ? "Add Event" : "")")
|
||||||
// .navigationBarTitleDisplayMode(.inline)
|
// .navigationBarTitleDisplayMode(.inline)
|
||||||
.toolbar {
|
.toolbar {
|
||||||
ToolbarItem(/*placement: .topBarLeading*/) {
|
#if canImport(UIKit)
|
||||||
|
ToolbarItem(placement: .topBarLeading) {
|
||||||
if adding {
|
if adding {
|
||||||
Button() {
|
Button() {
|
||||||
resetAddEventView()
|
resetAddEventView()
|
||||||
dismiss()
|
dismiss()
|
||||||
} label: {
|
} label: {
|
||||||
Image(systemName: "xmark.circle.fill")
|
Image(systemName: "xmark")
|
||||||
.symbolRenderingMode(.hierarchical)
|
|
||||||
.resizable()
|
.resizable()
|
||||||
.scaledToFit()
|
.scaledToFit()
|
||||||
.frame(width: 30)
|
.frame(width: 30)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
ToolbarItem() {
|
||||||
|
if adding {
|
||||||
|
Button() {
|
||||||
|
resetAddEventView()
|
||||||
|
dismiss()
|
||||||
|
} label: {
|
||||||
|
Image(systemName: "xmark")
|
||||||
|
.resizable()
|
||||||
|
.scaledToFit()
|
||||||
|
.frame(width: 30)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
ToolbarItem/*(placement: .topBarTrailing)*/ {
|
ToolbarItem/*(placement: .topBarTrailing)*/ {
|
||||||
if adding {
|
if adding {
|
||||||
Button {
|
Button {
|
||||||
@@ -182,6 +199,7 @@ struct AddEventView: View {
|
|||||||
.cornerRadius(10)
|
.cornerRadius(10)
|
||||||
.buttonStyle(BorderedProminentButtonStyle())
|
.buttonStyle(BorderedProminentButtonStyle())
|
||||||
}
|
}
|
||||||
|
.tint(.accent)
|
||||||
.apply {
|
.apply {
|
||||||
if #available(iOS 17, *) {
|
if #available(iOS 17, *) {
|
||||||
$0.sensoryFeedback(.success, trigger: bye)
|
$0.sensoryFeedback(.success, trigger: bye)
|
||||||
|
|||||||
@@ -34,17 +34,12 @@ struct AddEventButton: View {
|
|||||||
Button() {
|
Button() {
|
||||||
showingAddEventView.toggle()
|
showingAddEventView.toggle()
|
||||||
} label: {
|
} label: {
|
||||||
ZStack {
|
Image(systemName: "plus")
|
||||||
Circle()
|
.resizable()
|
||||||
.frame(width: 33)
|
.scaledToFit()
|
||||||
.foregroundStyle(.one)
|
.frame(width: 15)
|
||||||
Image(systemName: "plus")
|
.bold()
|
||||||
.resizable()
|
.foregroundStyle(.two)
|
||||||
.scaledToFit()
|
|
||||||
.frame(width: 15)
|
|
||||||
.bold()
|
|
||||||
.foregroundStyle(.two)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
Resources/NearFuture.icon/Assets/Oval copy.png
Normal file
BIN
Resources/NearFuture.icon/Assets/Oval copy.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 551 KiB |
BIN
Resources/NearFuture.icon/Assets/Rounded Rectangle.png
Normal file
BIN
Resources/NearFuture.icon/Assets/Rounded Rectangle.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 126 KiB |
50
Resources/NearFuture.icon/icon.json
Normal file
50
Resources/NearFuture.icon/icon.json
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
"fill" : {
|
||||||
|
"linear-gradient" : [
|
||||||
|
"display-p3:0.12307,0.73184,0.43944,1.00000",
|
||||||
|
"display-p3:0.12142,0.28022,0.58006,1.00000"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"groups" : [
|
||||||
|
{
|
||||||
|
"layers" : [
|
||||||
|
{
|
||||||
|
"fill" : {
|
||||||
|
"automatic-gradient" : "display-p3:1.00000,0.30347,0.00000,1.00000"
|
||||||
|
},
|
||||||
|
"image-name" : "Rounded Rectangle.png",
|
||||||
|
"name" : "Rounded Rectangle",
|
||||||
|
"position" : {
|
||||||
|
"scale" : 1,
|
||||||
|
"translation-in-points" : [
|
||||||
|
-466.2265625,
|
||||||
|
37.9921875
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fill" : {
|
||||||
|
"automatic-gradient" : "display-p3:0.96611,0.36599,0.00000,1.00000"
|
||||||
|
},
|
||||||
|
"hidden" : false,
|
||||||
|
"image-name" : "Oval copy.png",
|
||||||
|
"name" : "Oval copy"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"shadow" : {
|
||||||
|
"kind" : "neutral",
|
||||||
|
"opacity" : 0.5
|
||||||
|
},
|
||||||
|
"translucency" : {
|
||||||
|
"enabled" : true,
|
||||||
|
"value" : 0.5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"supported-platforms" : {
|
||||||
|
"circles" : [
|
||||||
|
"watchOS"
|
||||||
|
],
|
||||||
|
"squares" : "shared"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user