general: conform reminder pages
This commit is contained in:
43
Gaze/Views/Components/InfoBox.swift
Normal file
43
Gaze/Views/Components/InfoBox.swift
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
//
|
||||||
|
// InfoBox.swift
|
||||||
|
// Gaze
|
||||||
|
//
|
||||||
|
// Created by Mike Freno on 1/8/26.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct InfoBox: View {
|
||||||
|
let text: String
|
||||||
|
let url: String?
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
HStack(spacing: 12) {
|
||||||
|
if let url = url, let urlObj = URL(string: url) {
|
||||||
|
Button(action: {
|
||||||
|
#if os(iOS)
|
||||||
|
UIApplication.shared.open(urlObj)
|
||||||
|
#elseif os(macOS)
|
||||||
|
NSWorkspace.shared.open(urlObj)
|
||||||
|
#endif
|
||||||
|
}) {
|
||||||
|
Image(systemName: "info.circle")
|
||||||
|
.foregroundColor(.white)
|
||||||
|
}.buttonStyle(.plain)
|
||||||
|
} else {
|
||||||
|
Image(systemName: "info.circle")
|
||||||
|
.foregroundColor(.white)
|
||||||
|
}
|
||||||
|
Text(text)
|
||||||
|
.font(.headline)
|
||||||
|
.foregroundColor(.white)
|
||||||
|
}
|
||||||
|
.padding()
|
||||||
|
.glassEffect(.regular.tint(.blue), in: .rect(cornerRadius: 8))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview {
|
||||||
|
InfoBox(text: "This is an informational message that provides helpful context to the user.", url: "https://www.healthline.com/health/eye-health/20-20-20-rule")
|
||||||
|
.padding()
|
||||||
|
}
|
||||||
@@ -24,6 +24,31 @@ struct BlinkSetupView: View {
|
|||||||
.font(.title3)
|
.font(.title3)
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
|
// InfoBox with link functionality
|
||||||
|
HStack(spacing: 12) {
|
||||||
|
Button(action: {
|
||||||
|
if let url = URL(
|
||||||
|
string: "https://www.healthline.com/health/eye-health/eye-strain#symptoms")
|
||||||
|
{
|
||||||
|
#if os(iOS)
|
||||||
|
UIApplication.shared.open(url)
|
||||||
|
#elseif os(macOS)
|
||||||
|
NSWorkspace.shared.open(url)
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
Image(systemName: "info.circle")
|
||||||
|
.foregroundColor(.white)
|
||||||
|
}.buttonStyle(.plain)
|
||||||
|
Text(
|
||||||
|
"We blink much less when focusing on screens. Regular blink reminders help prevent dry eyes"
|
||||||
|
)
|
||||||
|
.font(.headline)
|
||||||
|
.foregroundColor(.white)
|
||||||
|
}
|
||||||
|
.padding()
|
||||||
|
.glassEffect(.regular.tint(.blue), in: .rect(cornerRadius: 8))
|
||||||
|
|
||||||
VStack(alignment: .leading, spacing: 20) {
|
VStack(alignment: .leading, spacing: 20) {
|
||||||
Toggle("Enable Blink Reminders", isOn: $enabled)
|
Toggle("Enable Blink Reminders", isOn: $enabled)
|
||||||
.font(.headline)
|
.font(.headline)
|
||||||
@@ -35,7 +60,8 @@ struct BlinkSetupView: View {
|
|||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
HStack {
|
HStack {
|
||||||
Slider(value: Binding(
|
Slider(
|
||||||
|
value: Binding(
|
||||||
get: { Double(intervalMinutes) },
|
get: { Double(intervalMinutes) },
|
||||||
set: { intervalMinutes = Int($0) }
|
set: { intervalMinutes = Int($0) }
|
||||||
), in: 1...15, step: 1)
|
), in: 1...15, step: 1)
|
||||||
@@ -50,7 +76,9 @@ struct BlinkSetupView: View {
|
|||||||
.padding()
|
.padding()
|
||||||
.glassEffect(.regular, in: .rect(cornerRadius: 12))
|
.glassEffect(.regular, in: .rect(cornerRadius: 12))
|
||||||
|
|
||||||
InfoBox(text: "We blink much less when focusing on screens. Regular blink reminders help prevent dry eyes")
|
Text(
|
||||||
|
"You will be subtly reminded every \(intervalMinutes) minutes to blink"
|
||||||
|
)
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,10 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
import UIKit
|
import UIKit
|
||||||
#elseif os(macOS)
|
#else
|
||||||
import AppKit
|
import AppKit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -26,7 +27,28 @@ struct LookAwaySetupView: View {
|
|||||||
Text("Look Away Reminder")
|
Text("Look Away Reminder")
|
||||||
.font(.system(size: 28, weight: .bold))
|
.font(.system(size: 28, weight: .bold))
|
||||||
|
|
||||||
InfoBox(text: "Suggested: 20-20-20 rule")
|
// InfoBox with link functionality
|
||||||
|
HStack(spacing: 12) {
|
||||||
|
Button(action: {
|
||||||
|
if let url = URL(
|
||||||
|
string: "https://www.healthline.com/health/eye-health/20-20-20-rule")
|
||||||
|
{
|
||||||
|
#if os(iOS)
|
||||||
|
UIApplication.shared.open(url)
|
||||||
|
#elseif os(macOS)
|
||||||
|
NSWorkspace.shared.open(url)
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
Image(systemName: "info.circle")
|
||||||
|
.foregroundColor(.white)
|
||||||
|
}.buttonStyle(.plain)
|
||||||
|
Text("Suggested: 20-20-20 rule")
|
||||||
|
.font(.headline)
|
||||||
|
.foregroundColor(.white)
|
||||||
|
}
|
||||||
|
.padding()
|
||||||
|
.glassEffect(.regular.tint(.blue), in: .rect(cornerRadius: 8))
|
||||||
|
|
||||||
VStack(alignment: .leading, spacing: 20) {
|
VStack(alignment: .leading, spacing: 20) {
|
||||||
Toggle("Enable Look Away Reminders", isOn: $enabled)
|
Toggle("Enable Look Away Reminders", isOn: $enabled)
|
||||||
@@ -39,7 +61,8 @@ struct LookAwaySetupView: View {
|
|||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
HStack {
|
HStack {
|
||||||
Slider(value: Binding(
|
Slider(
|
||||||
|
value: Binding(
|
||||||
get: { Double(intervalMinutes) },
|
get: { Double(intervalMinutes) },
|
||||||
set: { intervalMinutes = Int($0) }
|
set: { intervalMinutes = Int($0) }
|
||||||
), in: 5...60, step: 5)
|
), in: 5...60, step: 5)
|
||||||
@@ -54,7 +77,8 @@ struct LookAwaySetupView: View {
|
|||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
HStack {
|
HStack {
|
||||||
Slider(value: Binding(
|
Slider(
|
||||||
|
value: Binding(
|
||||||
get: { Double(countdownSeconds) },
|
get: { Double(countdownSeconds) },
|
||||||
set: { countdownSeconds = Int($0) }
|
set: { countdownSeconds = Int($0) }
|
||||||
), in: 10...30, step: 5)
|
), in: 10...30, step: 5)
|
||||||
@@ -69,7 +93,9 @@ struct LookAwaySetupView: View {
|
|||||||
.padding()
|
.padding()
|
||||||
.glassEffect(.regular, in: .rect(cornerRadius: 12))
|
.glassEffect(.regular, in: .rect(cornerRadius: 12))
|
||||||
|
|
||||||
Text("You will be reminded every \(intervalMinutes) minutes to look in the distance for \(countdownSeconds) seconds")
|
Text(
|
||||||
|
"You will be reminded every \(intervalMinutes) minutes to look in the distance for \(countdownSeconds) seconds"
|
||||||
|
)
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
@@ -79,32 +105,6 @@ struct LookAwaySetupView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct InfoBox: View {
|
|
||||||
let text: String
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
HStack(spacing: 12) {
|
|
||||||
Button(action: {
|
|
||||||
if let url = URL(string: "https://www.healthline.com/health/eye-health/20-20-20-rule") {
|
|
||||||
#if os(iOS)
|
|
||||||
UIApplication.shared.open(url)
|
|
||||||
#elseif os(macOS)
|
|
||||||
NSWorkspace.shared.open(url)
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}) {
|
|
||||||
Image(systemName: "info.circle")
|
|
||||||
.foregroundColor(.white)
|
|
||||||
}.buttonStyle(.plain)
|
|
||||||
Text(text)
|
|
||||||
.font(.headline)
|
|
||||||
.foregroundColor(.white)
|
|
||||||
}
|
|
||||||
.padding()
|
|
||||||
.glassEffect(.regular.tint(.blue), in: .rect(cornerRadius: 8))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#Preview("Look Away Setup View") {
|
#Preview("Look Away Setup View") {
|
||||||
LookAwaySetupView(
|
LookAwaySetupView(
|
||||||
enabled: .constant(true),
|
enabled: .constant(true),
|
||||||
@@ -113,7 +113,3 @@ struct InfoBox: View {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#Preview("Info Box") {
|
|
||||||
InfoBox(text: "This is an informational message that provides helpful context to the user.")
|
|
||||||
.padding()
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -24,6 +24,31 @@ struct PostureSetupView: View {
|
|||||||
.font(.title3)
|
.font(.title3)
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
|
// InfoBox with link functionality
|
||||||
|
HStack(spacing: 12) {
|
||||||
|
Button(action: {
|
||||||
|
if let url = URL(
|
||||||
|
string: "https://www.healthline.com/health/ergonomic-workspace")
|
||||||
|
{
|
||||||
|
#if os(iOS)
|
||||||
|
UIApplication.shared.open(url)
|
||||||
|
#elseif os(macOS)
|
||||||
|
NSWorkspace.shared.open(url)
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
Image(systemName: "info.circle")
|
||||||
|
.foregroundColor(.white)
|
||||||
|
}.buttonStyle(.plain)
|
||||||
|
Text(
|
||||||
|
"Regular posture checks help prevent back and neck pain from prolonged sitting"
|
||||||
|
)
|
||||||
|
.font(.headline)
|
||||||
|
.foregroundColor(.white)
|
||||||
|
}
|
||||||
|
.padding()
|
||||||
|
.glassEffect(.regular.tint(.blue), in: .rect(cornerRadius: 8))
|
||||||
|
|
||||||
VStack(alignment: .leading, spacing: 20) {
|
VStack(alignment: .leading, spacing: 20) {
|
||||||
Toggle("Enable Posture Reminders", isOn: $enabled)
|
Toggle("Enable Posture Reminders", isOn: $enabled)
|
||||||
.font(.headline)
|
.font(.headline)
|
||||||
@@ -35,7 +60,8 @@ struct PostureSetupView: View {
|
|||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
HStack {
|
HStack {
|
||||||
Slider(value: Binding(
|
Slider(
|
||||||
|
value: Binding(
|
||||||
get: { Double(intervalMinutes) },
|
get: { Double(intervalMinutes) },
|
||||||
set: { intervalMinutes = Int($0) }
|
set: { intervalMinutes = Int($0) }
|
||||||
), in: 15...60, step: 5)
|
), in: 15...60, step: 5)
|
||||||
@@ -50,7 +76,9 @@ struct PostureSetupView: View {
|
|||||||
.padding()
|
.padding()
|
||||||
.glassEffect(.regular, in: .rect(cornerRadius: 12))
|
.glassEffect(.regular, in: .rect(cornerRadius: 12))
|
||||||
|
|
||||||
InfoBox(text: "Regular posture checks help prevent back and neck pain from prolonged sitting")
|
Text(
|
||||||
|
"You will be subtly reminded every \(intervalMinutes) minutes to check your posture"
|
||||||
|
)
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user