Fixed swipe actions and more widgets
This commit is contained in:
@@ -30,7 +30,7 @@ struct ClimbingActivityWidget: Widget {
|
|||||||
}
|
}
|
||||||
DynamicIslandExpandedRegion(.bottom) {
|
DynamicIslandExpandedRegion(.bottom) {
|
||||||
HStack {
|
HStack {
|
||||||
Label("\(context.state.totalAttempts)", systemImage: "flame")
|
Label("\(context.state.totalAttempts)", systemImage: "hand.raised.fill")
|
||||||
Spacer()
|
Spacer()
|
||||||
Label("\(context.state.completedProblems)", systemImage: "checkmark.circle")
|
Label("\(context.state.completedProblems)", systemImage: "checkmark.circle")
|
||||||
Spacer()
|
Spacer()
|
||||||
@@ -71,8 +71,8 @@ struct LiveActivityView: View {
|
|||||||
.font(.caption)
|
.font(.caption)
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
HStack {
|
HStack {
|
||||||
Image(systemName: "flame.fill")
|
Image(systemName: "hand.raised.fill")
|
||||||
.foregroundColor(.orange)
|
.foregroundColor(.green)
|
||||||
Text("\(context.state.totalAttempts)")
|
Text("\(context.state.totalAttempts)")
|
||||||
.font(.title3)
|
.font(.title3)
|
||||||
.fontWeight(.semibold)
|
.fontWeight(.semibold)
|
||||||
|
|||||||
Binary file not shown.
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import Combine
|
import Combine
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
@@ -49,7 +48,8 @@ struct SessionDetailView: View {
|
|||||||
|
|
||||||
AttemptsSection(
|
AttemptsSection(
|
||||||
attemptsWithProblems: attemptsWithProblems,
|
attemptsWithProblems: attemptsWithProblems,
|
||||||
attemptToDelete: $attemptToDelete)
|
attemptToDelete: $attemptToDelete,
|
||||||
|
editingAttempt: $editingAttempt)
|
||||||
} else {
|
} else {
|
||||||
Text("Session not found")
|
Text("Session not found")
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
@@ -345,8 +345,8 @@ struct StatItem: View {
|
|||||||
struct AttemptsSection: View {
|
struct AttemptsSection: View {
|
||||||
let attemptsWithProblems: [(Attempt, Problem)]
|
let attemptsWithProblems: [(Attempt, Problem)]
|
||||||
@Binding var attemptToDelete: Attempt?
|
@Binding var attemptToDelete: Attempt?
|
||||||
|
@Binding var editingAttempt: Attempt?
|
||||||
@EnvironmentObject var dataManager: ClimbingDataManager
|
@EnvironmentObject var dataManager: ClimbingDataManager
|
||||||
@State private var editingAttempt: Attempt?
|
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(alignment: .leading, spacing: 16) {
|
VStack(alignment: .leading, spacing: 16) {
|
||||||
@@ -376,13 +376,13 @@ struct AttemptsSection: View {
|
|||||||
.fill(.regularMaterial)
|
.fill(.regularMaterial)
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
LazyVStack(spacing: 12) {
|
List {
|
||||||
ForEach(attemptsWithProblems.indices, id: \.self) { index in
|
ForEach(attemptsWithProblems.indices, id: \.self) { index in
|
||||||
let (attempt, problem) = attemptsWithProblems[index]
|
let (attempt, problem) = attemptsWithProblems[index]
|
||||||
AttemptCard(attempt: attempt, problem: problem)
|
AttemptCard(attempt: attempt, problem: problem)
|
||||||
.background(.regularMaterial)
|
.listRowBackground(Color.clear)
|
||||||
.cornerRadius(12)
|
.listRowSeparator(.hidden)
|
||||||
.shadow(radius: 2)
|
.listRowInsets(EdgeInsets(top: 6, leading: 0, bottom: 6, trailing: 0))
|
||||||
.swipeActions(edge: .trailing, allowsFullSwipe: true) {
|
.swipeActions(edge: .trailing, allowsFullSwipe: true) {
|
||||||
Button(role: .destructive) {
|
Button(role: .destructive) {
|
||||||
// Add haptic feedback for delete action
|
// 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()
|
.padding()
|
||||||
|
.background(.regularMaterial)
|
||||||
|
.cornerRadius(12)
|
||||||
|
.shadow(radius: 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -200,8 +200,8 @@ struct SmallWidgetView: View {
|
|||||||
// Main stats - weekly attempts and sessions
|
// Main stats - weekly attempts and sessions
|
||||||
VStack(spacing: 16) {
|
VStack(spacing: 16) {
|
||||||
HStack(spacing: 8) {
|
HStack(spacing: 8) {
|
||||||
Image(systemName: "flame.fill")
|
Image(systemName: "hand.raised.fill")
|
||||||
.foregroundColor(.orange)
|
.foregroundColor(.green)
|
||||||
.font(.title2)
|
.font(.title2)
|
||||||
Text("\(entry.weeklyAttempts)")
|
Text("\(entry.weeklyAttempts)")
|
||||||
.font(.title)
|
.font(.title)
|
||||||
@@ -255,8 +255,8 @@ struct MediumWidgetView: View {
|
|||||||
HStack(spacing: 40) {
|
HStack(spacing: 40) {
|
||||||
VStack(spacing: 8) {
|
VStack(spacing: 8) {
|
||||||
HStack(spacing: 8) {
|
HStack(spacing: 8) {
|
||||||
Image(systemName: "flame.fill")
|
Image(systemName: "hand.raised.fill")
|
||||||
.foregroundColor(.orange)
|
.foregroundColor(.green)
|
||||||
.font(.title2)
|
.font(.title2)
|
||||||
Text("\(entry.weeklyAttempts)")
|
Text("\(entry.weeklyAttempts)")
|
||||||
.font(.title)
|
.font(.title)
|
||||||
|
|||||||
@@ -54,8 +54,8 @@ struct SessionStatusLiveLiveActivity: Widget {
|
|||||||
.fontWeight(.bold)
|
.fontWeight(.bold)
|
||||||
.monospacedDigit()
|
.monospacedDigit()
|
||||||
HStack(spacing: 4) {
|
HStack(spacing: 4) {
|
||||||
Image(systemName: "flame.fill")
|
Image(systemName: "hand.raised.fill")
|
||||||
.foregroundColor(.orange)
|
.foregroundColor(.green)
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
Text("\(context.state.totalAttempts)")
|
Text("\(context.state.totalAttempts)")
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
@@ -129,8 +129,8 @@ struct LiveActivityView: View {
|
|||||||
HStack(spacing: 20) {
|
HStack(spacing: 20) {
|
||||||
VStack(alignment: .leading, spacing: 4) {
|
VStack(alignment: .leading, spacing: 4) {
|
||||||
HStack(spacing: 6) {
|
HStack(spacing: 6) {
|
||||||
Image(systemName: "flame.fill")
|
Image(systemName: "hand.raised.fill")
|
||||||
.foregroundColor(.orange)
|
.foregroundColor(.green)
|
||||||
.font(.title3)
|
.font(.title3)
|
||||||
Text("\(context.state.totalAttempts)")
|
Text("\(context.state.totalAttempts)")
|
||||||
.font(.title2)
|
.font(.title2)
|
||||||
|
|||||||
Reference in New Issue
Block a user