Fixed swipe actions and more widgets

This commit is contained in:
2025-09-15 23:34:33 -06:00
parent b53dfb1aa5
commit 70976bc47a
5 changed files with 25 additions and 21 deletions

View File

@@ -30,7 +30,7 @@ struct ClimbingActivityWidget: Widget {
}
DynamicIslandExpandedRegion(.bottom) {
HStack {
Label("\(context.state.totalAttempts)", systemImage: "flame")
Label("\(context.state.totalAttempts)", systemImage: "hand.raised.fill")
Spacer()
Label("\(context.state.completedProblems)", systemImage: "checkmark.circle")
Spacer()
@@ -71,8 +71,8 @@ struct LiveActivityView: View {
.font(.caption)
.foregroundColor(.secondary)
HStack {
Image(systemName: "flame.fill")
.foregroundColor(.orange)
Image(systemName: "hand.raised.fill")
.foregroundColor(.green)
Text("\(context.state.totalAttempts)")
.font(.title3)
.fontWeight(.semibold)

View File

@@ -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)
}
}

View File

@@ -200,8 +200,8 @@ struct SmallWidgetView: View {
// Main stats - weekly attempts and sessions
VStack(spacing: 16) {
HStack(spacing: 8) {
Image(systemName: "flame.fill")
.foregroundColor(.orange)
Image(systemName: "hand.raised.fill")
.foregroundColor(.green)
.font(.title2)
Text("\(entry.weeklyAttempts)")
.font(.title)
@@ -255,8 +255,8 @@ struct MediumWidgetView: View {
HStack(spacing: 40) {
VStack(spacing: 8) {
HStack(spacing: 8) {
Image(systemName: "flame.fill")
.foregroundColor(.orange)
Image(systemName: "hand.raised.fill")
.foregroundColor(.green)
.font(.title2)
Text("\(entry.weeklyAttempts)")
.font(.title)

View File

@@ -54,8 +54,8 @@ struct SessionStatusLiveLiveActivity: Widget {
.fontWeight(.bold)
.monospacedDigit()
HStack(spacing: 4) {
Image(systemName: "flame.fill")
.foregroundColor(.orange)
Image(systemName: "hand.raised.fill")
.foregroundColor(.green)
.font(.caption)
Text("\(context.state.totalAttempts)")
.font(.caption)
@@ -129,8 +129,8 @@ struct LiveActivityView: View {
HStack(spacing: 20) {
VStack(alignment: .leading, spacing: 4) {
HStack(spacing: 6) {
Image(systemName: "flame.fill")
.foregroundColor(.orange)
Image(systemName: "hand.raised.fill")
.foregroundColor(.green)
.font(.title3)
Text("\(context.state.totalAttempts)")
.font(.title2)