Add task priority (High/Medium/Low/None) with colored flag picker
Priority stored on TaskItem, shown as colored flag in add sheet toolbar and as a small flag indicator on each task row. Co-Authored-By: Kutesir <tqwyy79vzn@privaterelay.appleid.com>
This commit is contained in:
@@ -1015,6 +1015,13 @@ struct TaskRowView: View {
|
||||
|
||||
Spacer()
|
||||
|
||||
if task.priority != .none {
|
||||
Image(systemName: "flag.fill")
|
||||
.font(.system(size: 11, weight: .semibold))
|
||||
.foregroundColor(task.priority.color)
|
||||
.padding(.trailing, 4)
|
||||
}
|
||||
|
||||
TagChip(
|
||||
text: task.category.rawValue,
|
||||
color: task.taskColor.color(),
|
||||
@@ -1459,6 +1466,7 @@ struct AddTaskSheet: View {
|
||||
@State private var parsed = NLParsed()
|
||||
@State private var selectedQuadrant: Quadrant
|
||||
@State private var selectedCategory: TaskCategory = .reminder
|
||||
@State private var selectedPriority: Priority = .none
|
||||
@State private var showDatePicker = false
|
||||
|
||||
var prefilledDate: Date?
|
||||
@@ -1534,15 +1542,20 @@ struct AddTaskSheet: View {
|
||||
|
||||
// Priority
|
||||
Menu {
|
||||
ForEach(Quadrant.allCases) { q in
|
||||
Button { withAnimation(KisaniSpring.micro) { selectedQuadrant = q } } label: {
|
||||
Label(q.rawValue, systemImage: selectedQuadrant == q ? "checkmark" : "")
|
||||
ForEach(Priority.allCases) { p in
|
||||
Button { withAnimation(KisaniSpring.micro) { selectedPriority = p } } label: {
|
||||
Label {
|
||||
Text(p.label)
|
||||
} icon: {
|
||||
Image(systemName: p == .none ? "flag" : "flag.fill")
|
||||
.foregroundStyle(p.color)
|
||||
}
|
||||
}
|
||||
}
|
||||
} label: {
|
||||
Image(systemName: selectedQuadrant == .urgent ? "flag.fill" : "flag")
|
||||
Image(systemName: selectedPriority == .none ? "flag" : "flag.fill")
|
||||
.font(.system(size: 16))
|
||||
.foregroundColor(selectedQuadrant == .urgent ? AppColors.accent : AppColors.text3(cs))
|
||||
.foregroundColor(selectedPriority == .none ? AppColors.text3(cs) : selectedPriority.color)
|
||||
.frame(width: 42, height: 44)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
@@ -1618,7 +1631,8 @@ struct AddTaskSheet: View {
|
||||
taskVM.addTask(title: cleanTitle, dueDate: parsed.date, hasTime: parsed.hasTime,
|
||||
quadrant: selectedQuadrant, category: selectedCategory,
|
||||
isRecurring: parsed.isRecurring,
|
||||
endDate: parsed.endDate, isAllDay: parsed.isAllDay)
|
||||
endDate: parsed.endDate, isAllDay: parsed.isAllDay,
|
||||
priority: selectedPriority)
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user