|
|
@@ -9,7 +9,9 @@ import SwiftUI
|
|
|
import SwiftData
|
|
|
|
|
|
struct ProjectPanelView: View {
|
|
|
+ @AppStorage(UserDefaultsKeys.Category) var allGroups = CodableArray<Category>()
|
|
|
@Bindable var item: Project
|
|
|
+ @State private var empty = Category()
|
|
|
|
|
|
var body: some View {
|
|
|
let style = Date.FormatStyle(date: .numeric, time: .standard)
|
|
|
@@ -24,7 +26,19 @@ struct ProjectPanelView: View {
|
|
|
.help("New Task")
|
|
|
.padding(.trailing, 10)
|
|
|
}
|
|
|
- Text("Created on \(item.timestamp, format: style)")
|
|
|
+ HStack {
|
|
|
+ if !item.category.isEmpty {
|
|
|
+ let grp = $allGroups.first(where: { $0.name.wrappedValue == item.category })
|
|
|
+ ColorPicker("", selection: grp!.color).disabled(true)
|
|
|
+ }
|
|
|
+ Picker("", selection: $item.category) {
|
|
|
+ Text(empty.name).tag("")
|
|
|
+ ForEach(allGroups) { group in
|
|
|
+ Text(group.name)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Text("Created on \(item.timestamp, format: style)")
|
|
|
+ }
|
|
|
List {
|
|
|
ForEach($item.tasks) { task in
|
|
|
TaskView(task: task)
|