|
|
@@ -14,6 +14,7 @@ struct ProjectPanelView: View {
|
|
|
|
|
|
@Bindable var item: Project
|
|
|
@State private var empty = Category()
|
|
|
+ @State private var move = false
|
|
|
|
|
|
var body: some View {
|
|
|
let style = Date.FormatStyle(date: .numeric, time: .standard)
|
|
|
@@ -27,6 +28,8 @@ struct ProjectPanelView: View {
|
|
|
}
|
|
|
.help("New Task")
|
|
|
.padding(.trailing, 10)
|
|
|
+ Toggle("Move Tasks", isOn: $move)
|
|
|
+ .padding(.trailing, 10)
|
|
|
}
|
|
|
HStack {
|
|
|
if let grp = $allGroups.first(where: { $0.name.wrappedValue == item.category }) {
|
|
|
@@ -56,14 +59,18 @@ struct ProjectPanelView: View {
|
|
|
deleteItem(item: subtask.wrappedValue, from: task.wrappedValue)
|
|
|
}
|
|
|
}
|
|
|
- }.onMove(perform: { indices, index in
|
|
|
+ }
|
|
|
+ .onMove(perform: { indices, index in
|
|
|
withAnimation {
|
|
|
task.subtasks.wrappedValue.move(fromOffsets: indices, toOffset: index)
|
|
|
}
|
|
|
- })
|
|
|
- }.onMove(perform: { indices, index in
|
|
|
- item.tasks.move(fromOffsets: indices, toOffset: index)
|
|
|
- })
|
|
|
+ }).moveDisabled(!move)
|
|
|
+ }
|
|
|
+ .onMove(perform: { indices, index in
|
|
|
+ withAnimation {
|
|
|
+ item.tasks.move(fromOffsets: indices, toOffset: index)
|
|
|
+ }
|
|
|
+ }).moveDisabled(!move)
|
|
|
}
|
|
|
}
|
|
|
|