diff --git a/LeCountdown.xcodeproj/project.pbxproj b/LeCountdown.xcodeproj/project.pbxproj index 0033239..3fb1af9 100644 --- a/LeCountdown.xcodeproj/project.pbxproj +++ b/LeCountdown.xcodeproj/project.pbxproj @@ -63,6 +63,7 @@ C4742B5B298414B000D5D950 /* ImageSelectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4742B5A298414B000D5D950 /* ImageSelectionView.swift */; }; C4742B5F2984205000D5D950 /* ViewModifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4742B5E2984205000D5D950 /* ViewModifiers.swift */; }; C4F8B1532987FE6F005C86A5 /* LaunchWidgetLiveActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C438C7D72981216200BF3EF9 /* LaunchWidgetLiveActivity.swift */; }; + C4F8B1552988751B005C86A5 /* DialView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4F8B1542988751B005C86A5 /* DialView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -160,6 +161,7 @@ C4742B58298411E800D5D950 /* CountdownFormView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CountdownFormView.swift; sourceTree = ""; }; C4742B5A298414B000D5D950 /* ImageSelectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageSelectionView.swift; sourceTree = ""; }; C4742B5E2984205000D5D950 /* ViewModifiers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModifiers.swift; sourceTree = ""; }; + C4F8B1542988751B005C86A5 /* DialView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DialView.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -347,6 +349,7 @@ C4742B5A298414B000D5D950 /* ImageSelectionView.swift */, C4060DF6297AFEF2003FAB80 /* NewCountdownView.swift */, C438C80E29828B8600BF3EF9 /* RecordsView.swift */, + C4F8B1542988751B005C86A5 /* DialView.swift */, ); path = Views; sourceTree = ""; @@ -563,6 +566,7 @@ C4060DC9297AE73D003FAB80 /* Persistence.swift in Sources */, C438C80F29828B8600BF3EF9 /* RecordsView.swift in Sources */, C438C80D2982847300BF3EF9 /* CoreDataRequests.swift in Sources */, + C4F8B1552988751B005C86A5 /* DialView.swift in Sources */, C4742B5F2984205000D5D950 /* ViewModifiers.swift in Sources */, C438C81129829EAF00BF3EF9 /* PropertyWrappers.swift in Sources */, C438C807298195E600BF3EF9 /* Model+Extensions.swift in Sources */, diff --git a/LeCountdown/Views/ContentView.swift b/LeCountdown/Views/ContentView.swift index 5001a72..29f3229 100644 --- a/LeCountdown/Views/ContentView.swift +++ b/LeCountdown/Views/ContentView.swift @@ -16,20 +16,33 @@ struct CountdownLiveView: View { var body: some View { VStack { - Text(countdown.activity?.name ?? "") + + HStack { + Text(countdown.activity?.name?.uppercased() ?? "") + Spacer() + } + if let dateInterval = environment.notificationDates[countdown.stringId] { - Text(dateInterval.end, style: .timer).monospaced() + Text(dateInterval.end, style: .timer) Button { CountdownScheduler.master.cancelCurrentNotifications(countdown: countdown) } label: { - Text("Cancel").buttonStyle(.bordered).tint(.red) + Text("Cancel") + .buttonStyle(.bordered) + .tint(.red) } } else { - Text(countdown.duration.minuteSecond).monospaced() + HStack { + Text(countdown.duration.minuteSecond) + Spacer() + } } + } - .font(Font.system(size: 24.0, weight: .semibold)) + .padding(24.0) + .monospaced() + .font(Font.system(size: 16.0, weight: .semibold)) .foregroundColor(Color.white) } @@ -92,9 +105,9 @@ struct ContentView: View { .environment(\.managedObjectContext, viewContext) } label: { Image(systemName: "gearshape.fill") - .font(.system(size: 30)) - .padding(12.0) - .foregroundColor(Color.orange) + .font(.system(size: 24, weight: .light)) + .padding() + .foregroundColor(Color.white) } } diff --git a/LeCountdown/Views/DialView.swift b/LeCountdown/Views/DialView.swift new file mode 100644 index 0000000..2e2c7b7 --- /dev/null +++ b/LeCountdown/Views/DialView.swift @@ -0,0 +1,43 @@ +// +// DialView.swift +// LeCountdown +// +// Created by Laurent Morvillier on 30/01/2023. +// + +import SwiftUI + +struct DialView: View { + + @EnvironmentObject var environment: AppEnvironment + + var name: String + var duration: String + + var body: some View { + + VStack { + HStack { + Text(name.uppercased()).monospaced() + Spacer() + } + HStack { + Text(duration).monospaced() + Spacer() + } + Spacer() + }.padding() + .frame(width: 200, height: 200) + .foregroundColor(.white) + .background(Color.cyan) + .cornerRadius(32.0) + } + +} + +struct DialView_Previews: PreviewProvider { + + static var previews: some View { + DialView(name: "Running", duration: "2:00").environment(\.managedObjectContext, PersistenceController.preview.container.viewContext) + } +}