浏览代码

refactor: improve names in ProjectPanel

Sam Jaffe 2 周之前
父节点
当前提交
8cbf58c442
共有 1 个文件被更改,包括 11 次插入10 次删除
  1. 11 10
      Todos/View/ProjectPanelView.swift

+ 11 - 10
Todos/View/ProjectPanelView.swift

@@ -14,9 +14,10 @@ struct ProjectPanelView: View {
   @Bindable var item: Project
 
   @State private var showDialogue = false
-  @State private var move = false
+  @State private var moveGuestureEnabled = false
+
   @State private var taskFilter = ""
-  @State private var statuses = StatusList()
+  @State private var statusFilter = StatusList()
 
   var body: some View {
     HStack {
@@ -30,7 +31,7 @@ struct ProjectPanelView: View {
       }
       .help("New Task")
       .padding(.trailing, 10)
-      if move {
+      if moveGuestureEnabled {
         Label("", systemImage: "arrow.up.arrow.down")
           .foregroundStyle(.red)
           .font(.title2)
@@ -42,11 +43,11 @@ struct ProjectPanelView: View {
           .font(.title2)
           .help("Only showing text matching '\(taskFilter)'")
       }
-      if !statuses.all {
+      if !statusFilter.all {
         Label("", systemImage: "exclamationmark.magnifyingglass")
           .foregroundStyle(.blue)
           .font(.title2)
-          .help(statuses.description)
+          .help(statusFilter.description)
       }
       Button {
         showDialogue = !showDialogue
@@ -65,13 +66,13 @@ struct ProjectPanelView: View {
             .font(.title)
           HStack {
             Label("", systemImage: "arrow.up.arrow.down")
-            Toggle("Move Tasks", isOn: $move)
+            Toggle("Move Tasks", isOn: $moveGuestureEnabled)
           }
           HStack {
             Label("", systemImage: "text.magnifyingglass")
             TextField("Filter Tasks", text: $taskFilter)
           }
-          StatusChecklist(statuses: $statuses)
+          StatusChecklist(statuses: $statusFilter)
         }
       }
       Text("")
@@ -96,10 +97,10 @@ struct ProjectPanelView: View {
             }
         }
         .onMove(perform: { moveItem(task.wrappedValue, $0, $1) })
-        .moveDisabled(!move)
+        .moveDisabled(!moveGuestureEnabled)
       }
       .onMove(perform: { moveItem(item, $0, $1) })
-      .moveDisabled(!move)
+      .moveDisabled(!moveGuestureEnabled)
     }
   }
 
@@ -107,7 +108,7 @@ struct ProjectPanelView: View {
     return items.sorted(by: T.less).filter({
       let value = $0.wrappedValue
       return value.name.isEmpty ||
-        (statuses.test(value.status) &&
+        (statusFilter.test(value.status) &&
          (taskFilter.isEmpty || value.containsText(taskFilter)))
     })
   }