Переглянути джерело

refactor: separate Project settings/filter popovers

Sam Jaffe 2 тижнів тому
батько
коміт
ed5e5173c3
1 змінених файлів з 20 додано та 7 видалено
  1. 20 7
      Todos/View/ProjectPanelView.swift

+ 20 - 7
Todos/View/ProjectPanelView.swift

@@ -13,7 +13,8 @@ struct ProjectPanelView: View {
 
   @Bindable var item: Project
 
-  @State private var showDialogue = false
+  @State private var showSettingsDialogue = false
+  @State private var showFilterDialogue = false
   @State private var moveEnabled = false
 
   @State private var taskFilter = ""
@@ -37,37 +38,49 @@ struct ProjectPanelView: View {
           .font(.title2)
           .help("Re-ordering mode is enabled, text fields will be unresponsive")
       }
+
       if !taskFilter.isEmpty {
         Label("", systemImage: "text.magnifyingglass")
           .foregroundStyle(.blue)
           .font(.title2)
           .help("Only showing text matching '\(taskFilter)'")
       }
+
       if !statusFilter.all {
         Label("", systemImage: "exclamationmark.magnifyingglass")
           .foregroundStyle(.blue)
           .font(.title2)
           .help(statusFilter.description)
       }
+
       Button {
-        showDialogue = !showDialogue
+        showSettingsDialogue = !showSettingsDialogue
       } label: {
         Label("", systemImage: "ellipsis.circle")
           .foregroundStyle(.gray)
           .font(.title)
       }
       .buttonStyle(.borderless)
-      .popover(isPresented: $showDialogue) {
+      .popover(isPresented: $showSettingsDialogue) {
         List {
-          Label("Settings", systemImage: "gearshape")
-            .font(.title)
           CategoryPicker(category: $item.category)
-          Label("Filters", systemImage: "magnifyingglass")
-            .font(.title)
           HStack {
             Label("", systemImage: "arrow.up.arrow.down")
             Toggle("Move Tasks", isOn: $moveEnabled)
           }
+        }
+      }
+
+      Button {
+        showFilterDialogue = !showFilterDialogue
+      } label: {
+        Label("", systemImage: "magnifyingglass")
+          .foregroundStyle(.gray)
+          .font(.title)
+      }
+      .buttonStyle(.borderless)
+      .popover(isPresented: $showFilterDialogue) {
+        List {
           HStack {
             Label("", systemImage: "text.magnifyingglass")
             TextField("Filter Tasks", text: $taskFilter)