Fixed swipe actions and more widgets
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
@@ -49,7 +48,8 @@ struct SessionDetailView: View {
|
||||
|
||||
AttemptsSection(
|
||||
attemptsWithProblems: attemptsWithProblems,
|
||||
attemptToDelete: $attemptToDelete)
|
||||
attemptToDelete: $attemptToDelete,
|
||||
editingAttempt: $editingAttempt)
|
||||
} else {
|
||||
Text("Session not found")
|
||||
.foregroundColor(.secondary)
|
||||
@@ -345,8 +345,8 @@ struct StatItem: View {
|
||||
struct AttemptsSection: View {
|
||||
let attemptsWithProblems: [(Attempt, Problem)]
|
||||
@Binding var attemptToDelete: Attempt?
|
||||
@Binding var editingAttempt: Attempt?
|
||||
@EnvironmentObject var dataManager: ClimbingDataManager
|
||||
@State private var editingAttempt: Attempt?
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 16) {
|
||||
@@ -376,13 +376,13 @@ struct AttemptsSection: View {
|
||||
.fill(.regularMaterial)
|
||||
)
|
||||
} else {
|
||||
LazyVStack(spacing: 12) {
|
||||
List {
|
||||
ForEach(attemptsWithProblems.indices, id: \.self) { index in
|
||||
let (attempt, problem) = attemptsWithProblems[index]
|
||||
AttemptCard(attempt: attempt, problem: problem)
|
||||
.background(.regularMaterial)
|
||||
.cornerRadius(12)
|
||||
.shadow(radius: 2)
|
||||
.listRowBackground(Color.clear)
|
||||
.listRowSeparator(.hidden)
|
||||
.listRowInsets(EdgeInsets(top: 6, leading: 0, bottom: 6, trailing: 0))
|
||||
.swipeActions(edge: .trailing, allowsFullSwipe: true) {
|
||||
Button(role: .destructive) {
|
||||
// Add haptic feedback for delete action
|
||||
@@ -409,11 +409,12 @@ struct AttemptsSection: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.listStyle(.plain)
|
||||
.scrollDisabled(true)
|
||||
.frame(height: CGFloat(attemptsWithProblems.count) * 120)
|
||||
}
|
||||
}
|
||||
.sheet(item: $editingAttempt) { attempt in
|
||||
EditAttemptView(attempt: attempt)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,6 +461,9 @@ struct AttemptCard: View {
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
.background(.regularMaterial)
|
||||
.cornerRadius(12)
|
||||
.shadow(radius: 2)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user