- Completion animations: play user-selected animation on task card after completing, with DataManager guard to prevent race condition during animation playback. Works in both AllTasksView and ResidenceDetailView. Animation preference persisted via @AppStorage and configurable from Settings. - Subscription: add trial fields (trialStart, trialEnd, trialActive) and subscriptionSource to model, cross-platform purchase guard, trial banner in upgrade prompt, and platform-aware subscription management in profile. - Analytics: disable PostHog SDK debug logging and remove console print statements to reduce debug console noise. - Documents: remove redundant nested do-catch blocks in ViewModel wrapper. - Widgets: add debounced timeline reloads and thread-safe file I/O queue. - Onboarding: fix animation leak on disappear, remove unused state vars. - Remove unused files (ContentView, StateFlowExtensions, CustomView). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
91 lines
3.5 KiB
Swift
91 lines
3.5 KiB
Swift
import SwiftUI
|
|
import ComposeApp
|
|
|
|
/// Dynamic task column view that adapts based on the column configuration
|
|
struct DynamicTaskColumnView: View {
|
|
let column: TaskColumn
|
|
let onEditTask: (TaskResponse) -> Void
|
|
let onCancelTask: (TaskResponse) -> Void
|
|
let onUncancelTask: (Int32) -> Void
|
|
let onMarkInProgress: (Int32) -> Void
|
|
let onCompleteTask: (TaskResponse) -> Void
|
|
let onArchiveTask: (TaskResponse) -> Void
|
|
let onUnarchiveTask: (Int32) -> Void
|
|
|
|
// Completion animation state (passed from parent)
|
|
var animatingTaskId: Int32? = nil
|
|
var animationPhase: AnimationPhase = .idle
|
|
var animationType: TaskAnimationType = .none
|
|
|
|
// Get icon from API response, with fallback
|
|
private var columnIcon: String {
|
|
column.icons["ios"] ?? "list.bullet"
|
|
}
|
|
|
|
private var columnColor: Color {
|
|
Color(hex: column.color) ?? Color.appTextPrimary
|
|
}
|
|
|
|
var body: some View {
|
|
VStack(spacing: 0) {
|
|
ScrollView {
|
|
VStack(spacing: 16) {
|
|
// Header
|
|
HStack(spacing: 8) {
|
|
Image(systemName: columnIcon)
|
|
.font(.headline)
|
|
.foregroundColor(columnColor)
|
|
|
|
Text(column.displayName)
|
|
.font(.headline)
|
|
.foregroundColor(columnColor)
|
|
|
|
Spacer()
|
|
|
|
Text("\(column.count)")
|
|
.font(.system(size: 12, weight: .semibold))
|
|
.foregroundColor(Color.appTextOnPrimary)
|
|
.padding(.horizontal, 10)
|
|
.padding(.vertical, 5)
|
|
.background(columnColor)
|
|
.clipShape(Capsule())
|
|
}
|
|
|
|
if column.tasks.isEmpty {
|
|
VStack(spacing: 8) {
|
|
Image(systemName: columnIcon)
|
|
.font(.system(size: 40))
|
|
.foregroundColor(columnColor.opacity(0.3))
|
|
|
|
Text(L10n.Tasks.noTasks)
|
|
.font(.caption)
|
|
.foregroundColor(Color.appTextSecondary)
|
|
}
|
|
.frame(maxWidth: .infinity)
|
|
.padding(.top, 40)
|
|
} else {
|
|
ForEach(column.tasks, id: \.id) { task in
|
|
DynamicTaskCard(
|
|
task: task,
|
|
buttonTypes: column.buttonTypes,
|
|
onEdit: { onEditTask(task) },
|
|
onCancel: { onCancelTask(task) },
|
|
onUncancel: { onUncancelTask(task.id) },
|
|
onMarkInProgress: { onMarkInProgress(task.id) },
|
|
onComplete: { onCompleteTask(task) },
|
|
onArchive: { onArchiveTask(task) },
|
|
onUnarchive: { onUnarchiveTask(task.id) }
|
|
)
|
|
.taskAnimation(
|
|
type: animationType,
|
|
phase: animatingTaskId == task.id ? animationPhase : .idle
|
|
)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.accessibilityIdentifier("Task.Column.\(column.name)")
|
|
}
|
|
}
|