Просмотр исходного кода

Update filter UI

Changed filter button to show filled icon and count when not all treatment types are selected. Updated event display logic for No Data to use filteredPumpEvents instead of pumpEventStored.
Mike Plante 6 месяцев назад
Родитель
Сommit
46c096702f
1 измененных файлов с 9 добавлено и 5 удалено
  1. 9 5
      Trio/Sources/Modules/DataTable/View/DataTableRootView.swift

+ 9 - 5
Trio/Sources/Modules/DataTable/View/DataTableRootView.swift

@@ -185,10 +185,14 @@ extension DataTable {
             }) {
             }) {
                 HStack {
                 HStack {
                     Text("Filter")
                     Text("Filter")
-                        .foregroundColor(Color.accentColor)
-                    Image(systemName: "line.3.horizontal.decrease.circle")
-                        .foregroundColor(Color.accentColor)
-                }
+                    Image(
+                        systemName: selectedTreatmentTypes.count == 6
+                            ? "line.3.horizontal.decrease.circle" : "line.3.horizontal.decrease.circle.fill"
+                    )
+                    if selectedTreatmentTypes.count < 6 {
+                        Text(verbatim: "(\(selectedTreatmentTypes.count)/6)")
+                    }
+                }.foregroundColor(Color.accentColor)
             }
             }
             .popover(isPresented: $showTreatmentTypeFilter, arrowEdge: .top) {
             .popover(isPresented: $showTreatmentTypeFilter, arrowEdge: .top) {
                 VStack(alignment: .leading, spacing: 20) {
                 VStack(alignment: .leading, spacing: 20) {
@@ -299,7 +303,7 @@ extension DataTable {
                     Spacer()
                     Spacer()
                     Text("Time").foregroundStyle(.secondary)
                     Text("Time").foregroundStyle(.secondary)
                 }
                 }
-                if !pumpEventStored.isEmpty {
+                if !filteredPumpEvents.isEmpty {
                     ForEach(filteredPumpEvents) { item in
                     ForEach(filteredPumpEvents) { item in
                         treatmentView(item)
                         treatmentView(item)
                     }
                     }