401 lines
20 KiB
Swift
401 lines
20 KiB
Swift
import Foundation
|
|
import SwiftUI
|
|
|
|
/// A template for a habit within a preset ritual
|
|
struct HabitPreset: Identifiable {
|
|
let id = UUID()
|
|
let title: String
|
|
let symbolName: String
|
|
}
|
|
|
|
/// A template ritual that users can add to their collection
|
|
struct RitualPreset: Identifiable {
|
|
let id = UUID()
|
|
let title: String
|
|
let theme: String
|
|
let notes: String
|
|
let durationDays: Int
|
|
let timeOfDay: TimeOfDay
|
|
let iconName: String
|
|
let category: String
|
|
let habits: [HabitPreset]
|
|
}
|
|
|
|
/// Categories for organizing presets in the preset library
|
|
enum PresetCategory: String, CaseIterable {
|
|
case health = "Health"
|
|
case productivity = "Productivity"
|
|
case mindfulness = "Mindfulness"
|
|
case selfCare = "Self-Care"
|
|
|
|
var displayName: String {
|
|
rawValue
|
|
}
|
|
|
|
var symbolName: String {
|
|
switch self {
|
|
case .health: return "heart.fill"
|
|
case .productivity: return "bolt.fill"
|
|
case .mindfulness: return "brain.head.profile"
|
|
case .selfCare: return "sparkles"
|
|
}
|
|
}
|
|
}
|
|
|
|
/// Library of preset rituals organized by category
|
|
enum RitualPresetLibrary {
|
|
|
|
static var allPresets: [RitualPreset] {
|
|
healthPresets + productivityPresets + mindfulnessPresets + selfCarePresets
|
|
}
|
|
|
|
static func presets(for category: PresetCategory) -> [RitualPreset] {
|
|
switch category {
|
|
case .health: return healthPresets
|
|
case .productivity: return productivityPresets
|
|
case .mindfulness: return mindfulnessPresets
|
|
case .selfCare: return selfCarePresets
|
|
}
|
|
}
|
|
|
|
// MARK: - Health Presets
|
|
|
|
static let healthPresets: [RitualPreset] = [
|
|
RitualPreset(
|
|
title: String(localized: "Morning Hydration"),
|
|
theme: String(localized: "Start your day refreshed"),
|
|
notes: String(localized: "Build the habit of hydrating first thing in the morning."),
|
|
durationDays: 28,
|
|
timeOfDay: .morning,
|
|
iconName: "drop.fill",
|
|
category: PresetCategory.health.rawValue,
|
|
habits: [
|
|
HabitPreset(title: String(localized: "Drink a glass of water"), symbolName: "drop.fill"),
|
|
HabitPreset(title: String(localized: "Take vitamins"), symbolName: "pill.fill"),
|
|
HabitPreset(title: String(localized: "Eat a healthy breakfast"), symbolName: "fork.knife")
|
|
]
|
|
),
|
|
RitualPreset(
|
|
title: String(localized: "Midday Movement"),
|
|
theme: String(localized: "Break up your day"),
|
|
notes: String(localized: "Combat sedentary habits with midday activity."),
|
|
durationDays: 28,
|
|
timeOfDay: .midday,
|
|
iconName: "figure.walk",
|
|
category: PresetCategory.health.rawValue,
|
|
habits: [
|
|
HabitPreset(title: String(localized: "Take a 10-minute walk"), symbolName: "figure.walk"),
|
|
HabitPreset(title: String(localized: "Stretch at your desk"), symbolName: "figure.flexibility"),
|
|
HabitPreset(title: String(localized: "Drink water"), symbolName: "drop.fill")
|
|
]
|
|
),
|
|
RitualPreset(
|
|
title: String(localized: "Afternoon Energy"),
|
|
theme: String(localized: "Beat the slump"),
|
|
notes: String(localized: "Combat the afternoon energy dip with healthy habits."),
|
|
durationDays: 28,
|
|
timeOfDay: .afternoon,
|
|
iconName: "bolt.fill",
|
|
category: PresetCategory.health.rawValue,
|
|
habits: [
|
|
HabitPreset(title: String(localized: "Drink water or green tea"), symbolName: "cup.and.saucer.fill"),
|
|
HabitPreset(title: String(localized: "Eat a healthy snack"), symbolName: "carrot.fill"),
|
|
HabitPreset(title: String(localized: "Step outside for fresh air"), symbolName: "sun.max.fill"),
|
|
HabitPreset(title: String(localized: "Quick stretching break"), symbolName: "figure.flexibility")
|
|
]
|
|
),
|
|
RitualPreset(
|
|
title: String(localized: "Evening Nutrition"),
|
|
theme: String(localized: "Nourish mindfully"),
|
|
notes: String(localized: "Build healthy evening eating habits."),
|
|
durationDays: 28,
|
|
timeOfDay: .evening,
|
|
iconName: "fork.knife",
|
|
category: PresetCategory.health.rawValue,
|
|
habits: [
|
|
HabitPreset(title: String(localized: "Eat dinner before 7pm"), symbolName: "clock.fill"),
|
|
HabitPreset(title: String(localized: "Include vegetables"), symbolName: "leaf.fill"),
|
|
HabitPreset(title: String(localized: "Avoid heavy foods"), symbolName: "hand.raised.fill"),
|
|
HabitPreset(title: String(localized: "Drink herbal tea"), symbolName: "cup.and.saucer.fill")
|
|
]
|
|
),
|
|
RitualPreset(
|
|
title: String(localized: "Sleep Preparation"),
|
|
theme: String(localized: "Rest better tonight"),
|
|
notes: String(localized: "Wind down with habits that promote quality sleep."),
|
|
durationDays: 28,
|
|
timeOfDay: .night,
|
|
iconName: "moon.zzz.fill",
|
|
category: PresetCategory.health.rawValue,
|
|
habits: [
|
|
HabitPreset(title: String(localized: "Dim the lights"), symbolName: "lightbulb.fill"),
|
|
HabitPreset(title: String(localized: "Set consistent bedtime"), symbolName: "bed.double.fill"),
|
|
HabitPreset(title: String(localized: "Keep room cool"), symbolName: "thermometer.snowflake"),
|
|
HabitPreset(title: String(localized: "No screens in bed"), symbolName: "iphone.slash")
|
|
]
|
|
)
|
|
]
|
|
|
|
// MARK: - Productivity Presets
|
|
|
|
static let productivityPresets: [RitualPreset] = [
|
|
RitualPreset(
|
|
title: String(localized: "Deep Work Prep"),
|
|
theme: String(localized: "Set up for focus"),
|
|
notes: String(localized: "Create the conditions for uninterrupted deep work."),
|
|
durationDays: 28,
|
|
timeOfDay: .morning,
|
|
iconName: "brain",
|
|
category: PresetCategory.productivity.rawValue,
|
|
habits: [
|
|
HabitPreset(title: String(localized: "Clear your desk"), symbolName: "tray.full.fill"),
|
|
HabitPreset(title: String(localized: "Set phone to Do Not Disturb"), symbolName: "bell.slash.fill"),
|
|
HabitPreset(title: String(localized: "Define your top 3 priorities"), symbolName: "list.number"),
|
|
HabitPreset(title: String(localized: "Close unnecessary tabs"), symbolName: "xmark.square.fill")
|
|
]
|
|
),
|
|
RitualPreset(
|
|
title: String(localized: "Midday Check-In"),
|
|
theme: String(localized: "Stay on track"),
|
|
notes: String(localized: "A quick midday review to maintain momentum."),
|
|
durationDays: 28,
|
|
timeOfDay: .midday,
|
|
iconName: "gauge.with.dots.needle.50percent",
|
|
category: PresetCategory.productivity.rawValue,
|
|
habits: [
|
|
HabitPreset(title: String(localized: "Review morning progress"), symbolName: "checkmark.square.fill"),
|
|
HabitPreset(title: String(localized: "Adjust afternoon priorities"), symbolName: "slider.horizontal.3"),
|
|
HabitPreset(title: String(localized: "Clear quick tasks"), symbolName: "bolt.fill")
|
|
]
|
|
),
|
|
RitualPreset(
|
|
title: String(localized: "Afternoon Deep Work"),
|
|
theme: String(localized: "Power through"),
|
|
notes: String(localized: "Set up for a focused afternoon work session."),
|
|
durationDays: 28,
|
|
timeOfDay: .afternoon,
|
|
iconName: "laptopcomputer",
|
|
category: PresetCategory.productivity.rawValue,
|
|
habits: [
|
|
HabitPreset(title: String(localized: "Close distracting apps"), symbolName: "xmark.app.fill"),
|
|
HabitPreset(title: String(localized: "Set a 90-minute timer"), symbolName: "timer"),
|
|
HabitPreset(title: String(localized: "Work on one important task"), symbolName: "target"),
|
|
HabitPreset(title: String(localized: "No meetings block"), symbolName: "calendar.badge.minus")
|
|
]
|
|
),
|
|
RitualPreset(
|
|
title: String(localized: "End-of-Day Review"),
|
|
theme: String(localized: "Close loops, plan ahead"),
|
|
notes: String(localized: "Review your day and set up tomorrow for success."),
|
|
durationDays: 28,
|
|
timeOfDay: .evening,
|
|
iconName: "checkmark.circle.fill",
|
|
category: PresetCategory.productivity.rawValue,
|
|
habits: [
|
|
HabitPreset(title: String(localized: "Review completed tasks"), symbolName: "checkmark.square.fill"),
|
|
HabitPreset(title: String(localized: "Clear your inbox"), symbolName: "envelope.fill"),
|
|
HabitPreset(title: String(localized: "Plan tomorrow's priorities"), symbolName: "calendar.badge.plus"),
|
|
HabitPreset(title: String(localized: "Tidy workspace"), symbolName: "sparkles")
|
|
]
|
|
),
|
|
RitualPreset(
|
|
title: String(localized: "Focus Reset"),
|
|
theme: String(localized: "Regain clarity"),
|
|
notes: String(localized: "When you feel scattered, use this to refocus."),
|
|
durationDays: 28,
|
|
timeOfDay: .anytime,
|
|
iconName: "target",
|
|
category: PresetCategory.productivity.rawValue,
|
|
habits: [
|
|
HabitPreset(title: String(localized: "Take 5 deep breaths"), symbolName: "wind"),
|
|
HabitPreset(title: String(localized: "Write down what's on your mind"), symbolName: "pencil.and.list.clipboard"),
|
|
HabitPreset(title: String(localized: "Choose ONE thing to focus on"), symbolName: "scope")
|
|
]
|
|
)
|
|
]
|
|
|
|
// MARK: - Mindfulness Presets
|
|
|
|
static let mindfulnessPresets: [RitualPreset] = [
|
|
RitualPreset(
|
|
title: String(localized: "Morning Meditation"),
|
|
theme: String(localized: "Start with stillness"),
|
|
notes: String(localized: "A calm mind sets the tone for a calm day."),
|
|
durationDays: 28,
|
|
timeOfDay: .morning,
|
|
iconName: "figure.mind.and.body",
|
|
category: PresetCategory.mindfulness.rawValue,
|
|
habits: [
|
|
HabitPreset(title: String(localized: "5-minute meditation"), symbolName: "figure.mind.and.body"),
|
|
HabitPreset(title: String(localized: "Set an intention for the day"), symbolName: "star.fill"),
|
|
HabitPreset(title: String(localized: "Practice gratitude"), symbolName: "heart.fill")
|
|
]
|
|
),
|
|
RitualPreset(
|
|
title: String(localized: "Mindful Lunch"),
|
|
theme: String(localized: "Pause and nourish"),
|
|
notes: String(localized: "Bring awareness to your midday meal."),
|
|
durationDays: 28,
|
|
timeOfDay: .midday,
|
|
iconName: "leaf.fill",
|
|
category: PresetCategory.mindfulness.rawValue,
|
|
habits: [
|
|
HabitPreset(title: String(localized: "Eat without screens"), symbolName: "iphone.slash"),
|
|
HabitPreset(title: String(localized: "Chew slowly and taste"), symbolName: "mouth.fill"),
|
|
HabitPreset(title: String(localized: "Notice hunger and fullness"), symbolName: "heart.fill")
|
|
]
|
|
),
|
|
RitualPreset(
|
|
title: String(localized: "Afternoon Reset"),
|
|
theme: String(localized: "Center yourself"),
|
|
notes: String(localized: "A brief afternoon pause to recenter."),
|
|
durationDays: 28,
|
|
timeOfDay: .afternoon,
|
|
iconName: "circle.dotted",
|
|
category: PresetCategory.mindfulness.rawValue,
|
|
habits: [
|
|
HabitPreset(title: String(localized: "2-minute breathing pause"), symbolName: "wind"),
|
|
HabitPreset(title: String(localized: "Notice your posture"), symbolName: "figure.stand"),
|
|
HabitPreset(title: String(localized: "Release tension"), symbolName: "arrow.down.circle.fill"),
|
|
HabitPreset(title: String(localized: "Set afternoon intention"), symbolName: "star.fill")
|
|
]
|
|
),
|
|
RitualPreset(
|
|
title: String(localized: "Gratitude Practice"),
|
|
theme: String(localized: "Find the good"),
|
|
notes: String(localized: "Shift your focus to what's going well."),
|
|
durationDays: 28,
|
|
timeOfDay: .evening,
|
|
iconName: "heart.text.square.fill",
|
|
category: PresetCategory.mindfulness.rawValue,
|
|
habits: [
|
|
HabitPreset(title: String(localized: "Write 3 things you're grateful for"), symbolName: "list.bullet.clipboard.fill"),
|
|
HabitPreset(title: String(localized: "Thank someone"), symbolName: "person.wave.2.fill"),
|
|
HabitPreset(title: String(localized: "Reflect on a positive moment"), symbolName: "sun.max.fill")
|
|
]
|
|
),
|
|
RitualPreset(
|
|
title: String(localized: "Night Reflection"),
|
|
theme: String(localized: "Process your day"),
|
|
notes: String(localized: "Close the day with awareness and intention."),
|
|
durationDays: 28,
|
|
timeOfDay: .night,
|
|
iconName: "moon.stars.fill",
|
|
category: PresetCategory.mindfulness.rawValue,
|
|
habits: [
|
|
HabitPreset(title: String(localized: "Journal for 5 minutes"), symbolName: "book.fill"),
|
|
HabitPreset(title: String(localized: "What went well today?"), symbolName: "hand.thumbsup.fill"),
|
|
HabitPreset(title: String(localized: "What could be better?"), symbolName: "lightbulb.fill"),
|
|
HabitPreset(title: String(localized: "Let go of the day"), symbolName: "leaf.fill")
|
|
]
|
|
),
|
|
RitualPreset(
|
|
title: String(localized: "Breathwork"),
|
|
theme: String(localized: "Calm your nervous system"),
|
|
notes: String(localized: "Use breath to reduce stress and increase focus."),
|
|
durationDays: 28,
|
|
timeOfDay: .anytime,
|
|
iconName: "wind",
|
|
category: PresetCategory.mindfulness.rawValue,
|
|
habits: [
|
|
HabitPreset(title: String(localized: "Box breathing (4-4-4-4)"), symbolName: "square"),
|
|
HabitPreset(title: String(localized: "Body scan for tension"), symbolName: "figure.stand"),
|
|
HabitPreset(title: String(localized: "Release shoulder tension"), symbolName: "arrow.down.circle.fill")
|
|
]
|
|
)
|
|
]
|
|
|
|
// MARK: - Self-Care Presets
|
|
|
|
static let selfCarePresets: [RitualPreset] = [
|
|
RitualPreset(
|
|
title: String(localized: "Morning Skincare"),
|
|
theme: String(localized: "Care for yourself"),
|
|
notes: String(localized: "A consistent skincare routine for healthy skin."),
|
|
durationDays: 28,
|
|
timeOfDay: .morning,
|
|
iconName: "drop.triangle.fill",
|
|
category: PresetCategory.selfCare.rawValue,
|
|
habits: [
|
|
HabitPreset(title: String(localized: "Cleanse face"), symbolName: "drop.fill"),
|
|
HabitPreset(title: String(localized: "Apply moisturizer"), symbolName: "humidity.fill"),
|
|
HabitPreset(title: String(localized: "Apply sunscreen"), symbolName: "sun.max.fill")
|
|
]
|
|
),
|
|
RitualPreset(
|
|
title: String(localized: "Midday Self-Check"),
|
|
theme: String(localized: "How are you feeling?"),
|
|
notes: String(localized: "A quick check-in with yourself."),
|
|
durationDays: 28,
|
|
timeOfDay: .midday,
|
|
iconName: "heart.circle.fill",
|
|
category: PresetCategory.selfCare.rawValue,
|
|
habits: [
|
|
HabitPreset(title: String(localized: "Rate your energy level"), symbolName: "battery.50percent"),
|
|
HabitPreset(title: String(localized: "Notice your mood"), symbolName: "face.smiling.fill"),
|
|
HabitPreset(title: String(localized: "Adjust if needed"), symbolName: "slider.horizontal.3")
|
|
]
|
|
),
|
|
RitualPreset(
|
|
title: String(localized: "Afternoon Break"),
|
|
theme: String(localized: "Pause and recharge"),
|
|
notes: String(localized: "Give yourself permission to rest."),
|
|
durationDays: 28,
|
|
timeOfDay: .afternoon,
|
|
iconName: "cup.and.saucer.fill",
|
|
category: PresetCategory.selfCare.rawValue,
|
|
habits: [
|
|
HabitPreset(title: String(localized: "Step away from work"), symbolName: "figure.walk"),
|
|
HabitPreset(title: String(localized: "Enjoy a beverage mindfully"), symbolName: "cup.and.saucer.fill"),
|
|
HabitPreset(title: String(localized: "Listen to calming music"), symbolName: "music.note"),
|
|
HabitPreset(title: String(localized: "Look out a window"), symbolName: "window.horizontal")
|
|
]
|
|
),
|
|
RitualPreset(
|
|
title: String(localized: "Evening Wind-Down"),
|
|
theme: String(localized: "Transition to rest"),
|
|
notes: String(localized: "Create a buffer between your day and sleep."),
|
|
durationDays: 28,
|
|
timeOfDay: .evening,
|
|
iconName: "moon.fill",
|
|
category: PresetCategory.selfCare.rawValue,
|
|
habits: [
|
|
HabitPreset(title: String(localized: "Change into comfortable clothes"), symbolName: "tshirt.fill"),
|
|
HabitPreset(title: String(localized: "Light a candle or dim lights"), symbolName: "flame.fill"),
|
|
HabitPreset(title: String(localized: "Gentle stretching"), symbolName: "figure.flexibility"),
|
|
HabitPreset(title: String(localized: "Herbal tea"), symbolName: "cup.and.saucer.fill")
|
|
]
|
|
),
|
|
RitualPreset(
|
|
title: String(localized: "Night Skincare"),
|
|
theme: String(localized: "Repair and restore"),
|
|
notes: String(localized: "Nighttime skincare for rejuvenation."),
|
|
durationDays: 28,
|
|
timeOfDay: .night,
|
|
iconName: "sparkles",
|
|
category: PresetCategory.selfCare.rawValue,
|
|
habits: [
|
|
HabitPreset(title: String(localized: "Remove makeup"), symbolName: "drop.fill"),
|
|
HabitPreset(title: String(localized: "Cleanse face"), symbolName: "bubbles.and.sparkles.fill"),
|
|
HabitPreset(title: String(localized: "Apply night cream"), symbolName: "moon.fill"),
|
|
HabitPreset(title: String(localized: "Eye cream"), symbolName: "eye.fill")
|
|
]
|
|
),
|
|
RitualPreset(
|
|
title: String(localized: "Weekly Reset"),
|
|
theme: String(localized: "Prepare for a fresh week"),
|
|
notes: String(localized: "Sunday ritual to start Monday strong."),
|
|
durationDays: 28,
|
|
timeOfDay: .anytime,
|
|
iconName: "arrow.counterclockwise.circle.fill",
|
|
category: PresetCategory.selfCare.rawValue,
|
|
habits: [
|
|
HabitPreset(title: String(localized: "Review last week"), symbolName: "calendar"),
|
|
HabitPreset(title: String(localized: "Plan the week ahead"), symbolName: "calendar.badge.plus"),
|
|
HabitPreset(title: String(localized: "Prepare clothes"), symbolName: "tshirt.fill"),
|
|
HabitPreset(title: String(localized: "Tidy your space"), symbolName: "sparkles")
|
|
]
|
|
)
|
|
]
|
|
}
|