Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
9c57230e55
commit
576afad258
@ -78,7 +78,6 @@ struct HistoryDayDetailSheet: View {
|
||||
.presentationBackground(AppSurface.primary)
|
||||
.presentationDetents([.medium, .large])
|
||||
.presentationDragIndicator(.visible)
|
||||
.presentationSizing(.form)
|
||||
}
|
||||
|
||||
private var emptyState: some View {
|
||||
|
||||
@ -90,7 +90,7 @@ struct HistoryView: View {
|
||||
ritualPicker
|
||||
|
||||
// Month calendars - 2-column grid on iPad/landscape
|
||||
LazyVGrid(columns: monthColumns, alignment: .leading, spacing: Design.Spacing.large) {
|
||||
LazyVGrid(columns: monthColumns, alignment: .top, spacing: Design.Spacing.large) {
|
||||
ForEach(months, id: \.self) { month in
|
||||
HistoryMonthView(
|
||||
month: month,
|
||||
|
||||
@ -74,7 +74,6 @@ struct InsightDetailSheet: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.presentationSizing(.form)
|
||||
}
|
||||
|
||||
// MARK: - Header Section
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
//
|
||||
// ArcDetailSheet.swift
|
||||
// ArcDetailView.swift
|
||||
// Andromida
|
||||
//
|
||||
// A detailed view of a completed arc showing per-habit breakdown,
|
||||
@ -15,12 +15,12 @@ private struct ArcIdentifiableDate: Identifiable {
|
||||
let date: Date
|
||||
}
|
||||
|
||||
/// Sheet displaying detailed analytics for a completed arc.
|
||||
struct ArcDetailSheet: View {
|
||||
/// View displaying detailed analytics for a completed arc.
|
||||
/// Presented via NavigationLink push from RitualDetailView.
|
||||
struct ArcDetailView: View {
|
||||
@Bindable var store: RitualStore
|
||||
let arc: RitualArc
|
||||
let ritual: Ritual
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
@State private var selectedDateItem: ArcIdentifiableDate?
|
||||
|
||||
private let calendar = Calendar.current
|
||||
@ -61,42 +61,37 @@ struct ArcDetailSheet: View {
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
ScrollView {
|
||||
VStack(alignment: .leading, spacing: Design.Spacing.large) {
|
||||
// Header
|
||||
headerSection
|
||||
|
||||
// Stats overview
|
||||
statsSection
|
||||
|
||||
// Habit breakdown
|
||||
habitBreakdownSection
|
||||
|
||||
// Calendar history
|
||||
calendarSection
|
||||
}
|
||||
.padding(Design.Spacing.large)
|
||||
}
|
||||
.background(AppSurface.primary)
|
||||
.navigationTitle(String(localized: "Arc \(arc.arcNumber) Details"))
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .confirmationAction) {
|
||||
Button(String(localized: "Done")) {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
.sheet(item: $selectedDateItem) { item in
|
||||
HistoryDayDetailSheet(
|
||||
date: item.date,
|
||||
completions: arcHabitCompletions(for: item.date),
|
||||
store: store
|
||||
)
|
||||
ScrollView {
|
||||
VStack(alignment: .leading, spacing: Design.Spacing.large) {
|
||||
// Header
|
||||
headerSection
|
||||
|
||||
// Stats overview
|
||||
statsSection
|
||||
|
||||
// Habit breakdown
|
||||
habitBreakdownSection
|
||||
|
||||
// Calendar history
|
||||
calendarSection
|
||||
}
|
||||
.padding(Design.Spacing.large)
|
||||
.adaptiveContentWidth()
|
||||
}
|
||||
.background(LinearGradient(
|
||||
colors: [AppSurface.primary, AppSurface.secondary],
|
||||
startPoint: .topLeading,
|
||||
endPoint: .bottomTrailing
|
||||
))
|
||||
.navigationTitle(String(localized: "Arc \(arc.arcNumber) Details"))
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.sheet(item: $selectedDateItem) { item in
|
||||
HistoryDayDetailSheet(
|
||||
date: item.date,
|
||||
completions: arcHabitCompletions(for: item.date),
|
||||
store: store
|
||||
)
|
||||
}
|
||||
.presentationSizing(.form)
|
||||
}
|
||||
|
||||
/// Returns habit completions for a specific date within this arc
|
||||
@ -333,9 +328,11 @@ struct ArcDetailSheet: View {
|
||||
}
|
||||
|
||||
#Preview {
|
||||
ArcDetailSheet(
|
||||
store: RitualStore.preview,
|
||||
arc: RitualStore.preview.rituals.first!.latestArc!,
|
||||
ritual: RitualStore.preview.rituals.first!
|
||||
)
|
||||
NavigationStack {
|
||||
ArcDetailView(
|
||||
store: RitualStore.preview,
|
||||
arc: RitualStore.preview.rituals.first!.latestArc!,
|
||||
ritual: RitualStore.preview.rituals.first!
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -12,7 +12,6 @@ struct RitualDetailView: View {
|
||||
@State private var showingDeleteConfirmation = false
|
||||
@State private var showingEndArcConfirmation = false
|
||||
@State private var showingStartArcConfirmation = false
|
||||
@State private var selectedArcForDetail: RitualArc?
|
||||
|
||||
init(store: RitualStore, categoryStore: CategoryStore, ritual: Ritual) {
|
||||
self.store = store
|
||||
@ -142,9 +141,6 @@ struct RitualDetailView: View {
|
||||
.sheet(isPresented: $showingEditSheet) {
|
||||
RitualEditSheet(store: store, categoryStore: categoryStore, ritual: ritual)
|
||||
}
|
||||
.sheet(item: $selectedArcForDetail) { arc in
|
||||
ArcDetailSheet(store: store, arc: arc, ritual: ritual)
|
||||
}
|
||||
.alert(String(localized: "Delete Ritual?"), isPresented: $showingDeleteConfirmation) {
|
||||
Button(String(localized: "Cancel"), role: .cancel) {}
|
||||
Button(String(localized: "Delete"), role: .destructive) {
|
||||
@ -400,8 +396,8 @@ struct RitualDetailView: View {
|
||||
let possibleCheckIns = habits.count * arc.durationDays
|
||||
let completionRate = possibleCheckIns > 0 ? Int(Double(totalCheckIns) / Double(possibleCheckIns) * 100) : 0
|
||||
|
||||
return Button {
|
||||
selectedArcForDetail = arc
|
||||
return NavigationLink {
|
||||
ArcDetailView(store: store, arc: arc, ritual: ritual)
|
||||
} label: {
|
||||
HStack {
|
||||
VStack(alignment: .leading, spacing: Design.Spacing.xSmall) {
|
||||
|
||||
@ -58,7 +58,6 @@ struct ArcRenewalSheet: View {
|
||||
.sheet(isPresented: $showingEditSheet) {
|
||||
RitualEditSheet(store: store, categoryStore: categoryStore, ritual: ritual)
|
||||
}
|
||||
.presentationSizing(.form)
|
||||
}
|
||||
|
||||
private var celebrationHeader: some View {
|
||||
|
||||
@ -47,7 +47,6 @@ struct PresetLibrarySheet: View {
|
||||
}
|
||||
.presentationDetents([.large])
|
||||
.presentationDragIndicator(.visible)
|
||||
.presentationSizing(.form)
|
||||
}
|
||||
|
||||
// MARK: - Category Picker
|
||||
@ -197,7 +196,6 @@ struct PresetDetailSheet: View {
|
||||
}
|
||||
.presentationDetents([.medium, .large])
|
||||
.presentationDragIndicator(.visible)
|
||||
.presentationSizing(.form)
|
||||
}
|
||||
|
||||
private var headerSection: some View {
|
||||
|
||||
@ -93,7 +93,6 @@ struct RitualEditSheet: View {
|
||||
}
|
||||
.presentationDetents([.large])
|
||||
.presentationDragIndicator(.visible)
|
||||
.presentationSizing(.form)
|
||||
}
|
||||
|
||||
// MARK: - Form Sections
|
||||
@ -557,7 +556,6 @@ struct IconPickerSheet: View {
|
||||
}
|
||||
.presentationDetents([.medium, .large])
|
||||
.presentationDragIndicator(.visible)
|
||||
.presentationSizing(.form)
|
||||
}
|
||||
|
||||
private func iconButton(_ icon: String) -> some View {
|
||||
@ -674,7 +672,6 @@ struct HabitIconPickerSheet: View {
|
||||
}
|
||||
.presentationDetents([.medium, .large])
|
||||
.presentationDragIndicator(.visible)
|
||||
.presentationSizing(.form)
|
||||
}
|
||||
|
||||
private func iconButton(_ icon: String) -> some View {
|
||||
|
||||
@ -120,7 +120,6 @@ struct CategoryEditSheet: View {
|
||||
}
|
||||
}
|
||||
.presentationDetents([.medium])
|
||||
.presentationSizing(.form)
|
||||
}
|
||||
|
||||
private func loadCategory() {
|
||||
|
||||
@ -51,7 +51,7 @@ struct TodayView: View {
|
||||
}
|
||||
} else {
|
||||
// Use 2-column grid on iPad/landscape when multiple rituals
|
||||
LazyVGrid(columns: ritualColumns, alignment: .leading, spacing: Design.Spacing.large) {
|
||||
LazyVGrid(columns: ritualColumns, alignment: .top, spacing: Design.Spacing.large) {
|
||||
ForEach(todayRituals) { ritual in
|
||||
TodayRitualSectionView(
|
||||
focusTitle: ritual.title,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user