fix: API field mapping, HealthKit entitlement, profile tab, forgot password
This commit is contained in:
@@ -7,9 +7,11 @@ struct AddTaskView: View {
|
||||
|
||||
@State private var title = ""
|
||||
@State private var description = ""
|
||||
@State private var priority: TaskPriority = .medium
|
||||
@State private var priority: Int = 2
|
||||
@State private var isLoading = false
|
||||
|
||||
private let priorities = [(1, "Низкий"), (2, "Средний"), (3, "Высокий"), (4, "Срочный")]
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
ZStack {
|
||||
@@ -20,7 +22,7 @@ struct AddTaskView: View {
|
||||
TextField("Описание (необязательно)", text: $description)
|
||||
.padding().background(Color.white.opacity(0.08)).cornerRadius(12).foregroundColor(.white)
|
||||
Picker("Приоритет", selection: $priority) {
|
||||
ForEach(TaskPriority.allCases, id: \.self) { p in Text(p.displayName).tag(p) }
|
||||
ForEach(priorities, id: \.0) { p in Text(p.1).tag(p.0) }
|
||||
}
|
||||
.pickerStyle(.segmented)
|
||||
Spacer()
|
||||
|
||||
@@ -5,25 +5,20 @@ struct TaskRowView: View {
|
||||
let onComplete: () async -> Void
|
||||
|
||||
var priorityColor: Color {
|
||||
switch task.priority {
|
||||
case .urgent: return Color(hex: "ff0000")
|
||||
case .high: return Color(hex: "ff4757")
|
||||
case .medium: return Color(hex: "ffa502")
|
||||
default: return Color(hex: "8888aa")
|
||||
}
|
||||
Color(hex: task.priorityColor)
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 12) {
|
||||
Button(action: { Task { await onComplete() } }) {
|
||||
Image(systemName: task.done ? "checkmark.circle.fill" : "circle")
|
||||
Image(systemName: task.completed ? "checkmark.circle.fill" : "circle")
|
||||
.font(.title3)
|
||||
.foregroundColor(task.done ? Color(hex: "00d4aa") : Color(hex: "8888aa"))
|
||||
.foregroundColor(task.completed ? Color(hex: "00d4aa") : Color(hex: "8888aa"))
|
||||
}
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
Text(task.title)
|
||||
.foregroundColor(task.done ? Color(hex: "8888aa") : .white)
|
||||
.strikethrough(task.done)
|
||||
.foregroundColor(task.completed ? Color(hex: "8888aa") : .white)
|
||||
.strikethrough(task.completed)
|
||||
.font(.callout)
|
||||
if let desc = task.description, !desc.isEmpty {
|
||||
Text(desc).font(.caption).foregroundColor(Color(hex: "8888aa")).lineLimit(1)
|
||||
@@ -33,7 +28,7 @@ struct TaskRowView: View {
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
if let priority = task.priority, priority != .low {
|
||||
if let priority = task.priority, priority > 1 {
|
||||
Circle().fill(priorityColor).frame(width: 8, height: 8)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ struct TasksView: View {
|
||||
|
||||
var filteredTasks: [PulseTask] {
|
||||
switch filter {
|
||||
case .pending: return tasks.filter { !$0.done }
|
||||
case .completed: return tasks.filter { $0.done }
|
||||
case .pending: return tasks.filter { !$0.completed }
|
||||
case .completed: return tasks.filter { $0.completed }
|
||||
case .all: return tasks
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user