fix: previews actually reflect state
This commit is contained in:
@@ -58,7 +58,8 @@ struct OnboardingContainerView: View {
|
|||||||
|
|
||||||
BlinkSetupView(
|
BlinkSetupView(
|
||||||
enabled: $blinkEnabled,
|
enabled: $blinkEnabled,
|
||||||
intervalMinutes: $blinkIntervalMinutes
|
intervalMinutes: $blinkIntervalMinutes,
|
||||||
|
subtleReminderSize: subtleReminderSize
|
||||||
)
|
)
|
||||||
.tag(2)
|
.tag(2)
|
||||||
.tabItem {
|
.tabItem {
|
||||||
@@ -67,7 +68,8 @@ struct OnboardingContainerView: View {
|
|||||||
|
|
||||||
PostureSetupView(
|
PostureSetupView(
|
||||||
enabled: $postureEnabled,
|
enabled: $postureEnabled,
|
||||||
intervalMinutes: $postureIntervalMinutes
|
intervalMinutes: $postureIntervalMinutes,
|
||||||
|
subtleReminderSize: subtleReminderSize
|
||||||
)
|
)
|
||||||
.tag(3)
|
.tag(3)
|
||||||
.tabItem {
|
.tabItem {
|
||||||
|
|||||||
@@ -57,7 +57,8 @@ struct SettingsWindowView: View {
|
|||||||
|
|
||||||
BlinkSetupView(
|
BlinkSetupView(
|
||||||
enabled: $blinkEnabled,
|
enabled: $blinkEnabled,
|
||||||
intervalMinutes: $blinkIntervalMinutes
|
intervalMinutes: $blinkIntervalMinutes,
|
||||||
|
subtleReminderSize: subtleReminderSize
|
||||||
)
|
)
|
||||||
.tag(1)
|
.tag(1)
|
||||||
.tabItem {
|
.tabItem {
|
||||||
@@ -66,7 +67,8 @@ struct SettingsWindowView: View {
|
|||||||
|
|
||||||
PostureSetupView(
|
PostureSetupView(
|
||||||
enabled: $postureEnabled,
|
enabled: $postureEnabled,
|
||||||
intervalMinutes: $postureIntervalMinutes
|
intervalMinutes: $postureIntervalMinutes,
|
||||||
|
subtleReminderSize: subtleReminderSize
|
||||||
)
|
)
|
||||||
.tag(2)
|
.tag(2)
|
||||||
.tabItem {
|
.tabItem {
|
||||||
|
|||||||
@@ -42,9 +42,10 @@ struct BlinkReminderView: View {
|
|||||||
.scaleEffect(scale)
|
.scaleEffect(scale)
|
||||||
.shadow(color: .black.opacity(0.2), radius: 5, x: 0, y: 2)
|
.shadow(color: .black.opacity(0.2), radius: 5, x: 0, y: 2)
|
||||||
}
|
}
|
||||||
|
Spacer()
|
||||||
}
|
}
|
||||||
.opacity(opacity)
|
.opacity(opacity)
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
.padding(.top, screenHeight * 0.05)
|
.padding(.top, screenHeight * 0.05)
|
||||||
.onAppear {
|
.onAppear {
|
||||||
startAnimation()
|
startAnimation()
|
||||||
@@ -78,8 +79,3 @@ struct BlinkReminderView: View {
|
|||||||
BlinkReminderView(sizePercentage: 15.0, onDismiss: {})
|
BlinkReminderView(sizePercentage: 15.0, onDismiss: {})
|
||||||
.frame(width: 800, height: 600)
|
.frame(width: 800, height: 600)
|
||||||
}
|
}
|
||||||
|
|
||||||
#Preview("Blink Reminder") {
|
|
||||||
BlinkReminderView(sizePercentage: 15.0, onDismiss: {})
|
|
||||||
.frame(width: 800, height: 600)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import AppKit
|
|||||||
struct BlinkSetupView: View {
|
struct BlinkSetupView: View {
|
||||||
@Binding var enabled: Bool
|
@Binding var enabled: Bool
|
||||||
@Binding var intervalMinutes: Int
|
@Binding var intervalMinutes: Int
|
||||||
|
var subtleReminderSize: ReminderSize = .medium
|
||||||
@State private var previewWindowController: NSWindowController?
|
@State private var previewWindowController: NSWindowController?
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
@@ -139,7 +140,7 @@ struct BlinkSetupView: View {
|
|||||||
window.collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary]
|
window.collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary]
|
||||||
window.acceptsMouseMovedEvents = true
|
window.acceptsMouseMovedEvents = true
|
||||||
|
|
||||||
let contentView = BlinkReminderView(sizePercentage: 15.0) { [weak window] in
|
let contentView = BlinkReminderView(sizePercentage: subtleReminderSize.percentage) { [weak window] in
|
||||||
window?.close()
|
window?.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import SwiftUI
|
|||||||
struct PostureSetupView: View {
|
struct PostureSetupView: View {
|
||||||
@Binding var enabled: Bool
|
@Binding var enabled: Bool
|
||||||
@Binding var intervalMinutes: Int
|
@Binding var intervalMinutes: Int
|
||||||
|
var subtleReminderSize: ReminderSize = .medium
|
||||||
@State private var previewWindowController: NSWindowController?
|
@State private var previewWindowController: NSWindowController?
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
@@ -141,7 +142,7 @@ struct PostureSetupView: View {
|
|||||||
window.collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary]
|
window.collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary]
|
||||||
window.acceptsMouseMovedEvents = true
|
window.acceptsMouseMovedEvents = true
|
||||||
|
|
||||||
let contentView = PostureReminderView(sizePercentage: 10.0) { [weak window] in
|
let contentView = PostureReminderView(sizePercentage: subtleReminderSize.percentage) { [weak window] in
|
||||||
window?.close()
|
window?.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user