Redesign onboarding with modern UI and subscription prompt
Complete overhaul of onboarding flow with 5 screens: 1. Welcome - Gradient intro with feature highlights 2. Time - Clean card-based time picker for reminders 3. Day - Tappable cards for today/yesterday selection 4. Style - Horizontal scrollable icon & color pickers 5. Subscription - Benefits list with free trial CTA Design improvements: - Beautiful gradient backgrounds on each screen - Consistent typography and visual hierarchy - White page indicators visible on all backgrounds - Haptic feedback on selections - "Maybe Later" option on subscription screen 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,82 +10,167 @@ import SwiftUI
|
||||
enum DayOptions: Int, CaseIterable, RawRepresentable, Codable {
|
||||
case Today
|
||||
case Previous
|
||||
|
||||
|
||||
var localizedValue: String {
|
||||
switch self {
|
||||
|
||||
case .Today:
|
||||
return String(localized: "onboarding_day_options_today")
|
||||
return String(localized: "onboarding_day_options_today")
|
||||
case .Previous:
|
||||
return String(localized: "onboarding_day_options_yesterday")
|
||||
return String(localized: "onboarding_day_options_yesterday")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct OnboardingDay: View {
|
||||
@ObservedObject var onboardingData: OnboardingData
|
||||
|
||||
var previewText: String {
|
||||
switch onboardingData.inputDay {
|
||||
case .Today:
|
||||
return String(localized: "onboarding_day_preview_text_today")
|
||||
case .Previous:
|
||||
return String(localized: "onboarding_day_preview_text_yesterday")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
GeometryReader { geometry in
|
||||
VStack {
|
||||
Spacer()
|
||||
Image("bad", bundle: .main)
|
||||
.foregroundColor(Color(UIColor.darkText))
|
||||
.opacity(0.04)
|
||||
.scaleEffect(1.2, anchor: .trailing)
|
||||
Spacer()
|
||||
}
|
||||
|
||||
ScrollView {
|
||||
VStack(alignment: .leading) {
|
||||
Text(String(localized: "onboarding_day_title"))
|
||||
.font(.title)
|
||||
.padding()
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.foregroundColor(.white)
|
||||
// Gradient background
|
||||
LinearGradient(
|
||||
colors: [Color(hex: "4facfe"), Color(hex: "00f2fe")],
|
||||
startPoint: .topLeading,
|
||||
endPoint: .bottomTrailing
|
||||
)
|
||||
.ignoresSafeArea()
|
||||
|
||||
|
||||
Picker(selection: $onboardingData.inputDay,
|
||||
label: Text("")) {
|
||||
ForEach(DayOptions.allCases, id: \.self) { day in
|
||||
Text(day.localizedValue)
|
||||
}
|
||||
}
|
||||
.labelsHidden()
|
||||
.frame(minWidth: 0, maxWidth: .infinity)
|
||||
.padding()
|
||||
.pickerStyle(SegmentedPickerStyle())
|
||||
.colorScheme(.dark)
|
||||
|
||||
Text(previewText)
|
||||
.font(.title3)
|
||||
.padding()
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.foregroundColor(.white)
|
||||
}
|
||||
VStack(spacing: 0) {
|
||||
Spacer()
|
||||
|
||||
// Icon
|
||||
ZStack {
|
||||
Circle()
|
||||
.fill(.white.opacity(0.15))
|
||||
.frame(width: 120, height: 120)
|
||||
|
||||
Image(systemName: "calendar")
|
||||
.font(.system(size: 44))
|
||||
.foregroundColor(.white)
|
||||
}
|
||||
.padding()
|
||||
.padding(.bottom, 32)
|
||||
|
||||
// Title
|
||||
Text("Which day should\nyou rate?")
|
||||
.font(.system(size: 28, weight: .bold, design: .rounded))
|
||||
.foregroundColor(.white)
|
||||
.multilineTextAlignment(.center)
|
||||
.padding(.bottom, 12)
|
||||
|
||||
// Subtitle
|
||||
Text("When you get your reminder, do you want to rate today or yesterday?")
|
||||
.font(.system(size: 16, weight: .medium))
|
||||
.foregroundColor(.white.opacity(0.85))
|
||||
.multilineTextAlignment(.center)
|
||||
.padding(.horizontal, 40)
|
||||
|
||||
Spacer()
|
||||
|
||||
// Options
|
||||
VStack(spacing: 14) {
|
||||
DayOptionCard(
|
||||
title: "Today",
|
||||
subtitle: "Rate the current day",
|
||||
example: "e.g. Tue reminder → Rate Tue",
|
||||
icon: "sun.max.fill",
|
||||
isSelected: onboardingData.inputDay == .Today,
|
||||
action: { onboardingData.inputDay = .Today }
|
||||
)
|
||||
|
||||
DayOptionCard(
|
||||
title: "Yesterday",
|
||||
subtitle: "Rate the previous day",
|
||||
example: "e.g. Tue reminder → Rate Mon",
|
||||
icon: "moon.fill",
|
||||
isSelected: onboardingData.inputDay == .Previous,
|
||||
action: { onboardingData.inputDay = .Previous }
|
||||
)
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
|
||||
Spacer()
|
||||
|
||||
// Tip
|
||||
HStack(spacing: 12) {
|
||||
Image(systemName: "lightbulb.fill")
|
||||
.font(.system(size: 18))
|
||||
.foregroundColor(.yellow)
|
||||
|
||||
Text("Tip: \"Yesterday\" works great for evening reminders")
|
||||
.font(.system(size: 14, weight: .medium))
|
||||
.foregroundColor(.white.opacity(0.9))
|
||||
}
|
||||
.padding(.horizontal, 30)
|
||||
.padding(.bottom, 80)
|
||||
}
|
||||
}
|
||||
.background(Color(hex: "ff9e0b"))
|
||||
}
|
||||
}
|
||||
|
||||
struct DayOptionCard: View {
|
||||
let title: String
|
||||
let subtitle: String
|
||||
let example: String
|
||||
let icon: String
|
||||
let isSelected: Bool
|
||||
let action: () -> Void
|
||||
|
||||
var body: some View {
|
||||
Button(action: action) {
|
||||
HStack(spacing: 14) {
|
||||
// Icon
|
||||
ZStack {
|
||||
Circle()
|
||||
.fill(isSelected ? Color.white : Color.white.opacity(0.2))
|
||||
.frame(width: 46, height: 46)
|
||||
|
||||
Image(systemName: icon)
|
||||
.font(.system(size: 20))
|
||||
.foregroundColor(isSelected ? Color(hex: "4facfe") : .white)
|
||||
}
|
||||
|
||||
// Text
|
||||
VStack(alignment: .leading, spacing: 3) {
|
||||
Text(title)
|
||||
.font(.system(size: 17, weight: .semibold))
|
||||
.foregroundColor(isSelected ? Color(hex: "4facfe") : .white)
|
||||
|
||||
Text(subtitle)
|
||||
.font(.system(size: 13))
|
||||
.foregroundColor(isSelected ? Color(hex: "4facfe").opacity(0.8) : .white.opacity(0.8))
|
||||
|
||||
Text(example)
|
||||
.font(.system(size: 11, weight: .medium))
|
||||
.foregroundColor(isSelected ? Color(hex: "4facfe").opacity(0.6) : .white.opacity(0.6))
|
||||
.lineLimit(1)
|
||||
.minimumScaleFactor(0.8)
|
||||
}
|
||||
|
||||
Spacer(minLength: 8)
|
||||
|
||||
// Checkmark
|
||||
if isSelected {
|
||||
Image(systemName: "checkmark.circle.fill")
|
||||
.font(.system(size: 22))
|
||||
.foregroundColor(Color(hex: "4facfe"))
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 16)
|
||||
.padding(.vertical, 18)
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 18)
|
||||
.fill(isSelected ? .white : .white.opacity(0.15))
|
||||
.shadow(color: isSelected ? .black.opacity(0.1) : .clear, radius: 10, y: 5)
|
||||
)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
}
|
||||
|
||||
struct OnboardingDay_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
Group{
|
||||
Group {
|
||||
OnboardingDay(onboardingData: OnboardingData())
|
||||
|
||||
|
||||
OnboardingDay(onboardingData: OnboardingData())
|
||||
.preferredColorScheme(.dark)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user