|
@@ -13,15 +13,25 @@ struct TaskView: View {
|
|
|
@AppStorage(UserDefaultsKeys.Category) var allGroups = CodableArray<Category>()
|
|
@AppStorage(UserDefaultsKeys.Category) var allGroups = CodableArray<Category>()
|
|
|
@Binding var task: Task
|
|
@Binding var task: Task
|
|
|
|
|
|
|
|
|
|
+ @State private var showDialogue: Bool = false
|
|
|
@State private var hideTags: Bool = false
|
|
@State private var hideTags: Bool = false
|
|
|
@State private var hideNotes: Bool = false
|
|
@State private var hideNotes: Bool = false
|
|
|
@State private var empty = Category()
|
|
@State private var empty = Category()
|
|
|
|
|
+ let unset: Priority? = nil
|
|
|
|
|
|
|
|
@FocusState private var isFocused: Bool
|
|
@FocusState private var isFocused: Bool
|
|
|
|
|
|
|
|
var body: some View {
|
|
var body: some View {
|
|
|
VStack {
|
|
VStack {
|
|
|
HStack {
|
|
HStack {
|
|
|
|
|
+ if let priority = task.priority {
|
|
|
|
|
+ Image(systemName: priority.label)
|
|
|
|
|
+ .foregroundStyle(priority.style)
|
|
|
|
|
+ .bold()
|
|
|
|
|
+ .frame(width: 20)
|
|
|
|
|
+ .padding(.trailing, -10)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
StatusPicker(status: $task.status)
|
|
StatusPicker(status: $task.status)
|
|
|
.onChange(of: task.status) {
|
|
.onChange(of: task.status) {
|
|
|
if task.status.isStrong {
|
|
if task.status.isStrong {
|
|
@@ -42,22 +52,40 @@ struct TaskView: View {
|
|
|
Image(systemName: "plus")
|
|
Image(systemName: "plus")
|
|
|
.help("Add a Subtask")
|
|
.help("Add a Subtask")
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if isFocused || !(hideTags || task.tags.isEmpty) {
|
|
|
|
|
- HStack {
|
|
|
|
|
- TagBarView(task: $task)
|
|
|
|
|
- .font(.footnote)
|
|
|
|
|
- .padding(.leading, 30)
|
|
|
|
|
- if isFocused {
|
|
|
|
|
- Picker("", selection: $task.category) {
|
|
|
|
|
|
|
+ Button {
|
|
|
|
|
+ showDialogue = !showDialogue
|
|
|
|
|
+ } label: {
|
|
|
|
|
+ Label("", systemImage: "ellipsis.circle")
|
|
|
|
|
+ .foregroundStyle(.gray)
|
|
|
|
|
+ .font(.title2)
|
|
|
|
|
+ }
|
|
|
|
|
+ .buttonStyle(.borderless)
|
|
|
|
|
+ .popover(isPresented: $showDialogue) {
|
|
|
|
|
+ List{
|
|
|
|
|
+ Picker("Task Category", selection: $task.category) {
|
|
|
Text(empty.name).tag("")
|
|
Text(empty.name).tag("")
|
|
|
ForEach(allGroups) { group in
|
|
ForEach(allGroups) { group in
|
|
|
Text(group.name)
|
|
Text(group.name)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
.fixedSize(horizontal: true, vertical: false)
|
|
.fixedSize(horizontal: true, vertical: false)
|
|
|
|
|
+
|
|
|
|
|
+ Picker("Priority", selection: $task.priority) {
|
|
|
|
|
+ Text("").tag(unset)
|
|
|
|
|
+ ForEach(Priority.allCases) { unit in
|
|
|
|
|
+ Text(unit.id).tag(unit)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
+ Text("")
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if isFocused || !(hideTags || task.tags.isEmpty) {
|
|
|
|
|
+ HStack {
|
|
|
|
|
+ TagBarView(task: $task)
|
|
|
|
|
+ .font(.footnote)
|
|
|
|
|
+ .padding(.leading, 30)
|
|
|
VisibilityTapper(hideToggle: $hideTags)
|
|
VisibilityTapper(hideToggle: $hideTags)
|
|
|
}.focused($isFocused)
|
|
}.focused($isFocused)
|
|
|
}
|
|
}
|