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