瀏覽代碼

some layout fixes

Ivan Valkou 5 年之前
父節點
當前提交
bc5674ffaa

+ 6 - 2
FreeAPS/Sources/Modules/Home/View/Header/CurrentGlucoseView.swift

@@ -8,7 +8,11 @@ struct CurrentGlucoseView: View {
     private var glucoseFormatter: NumberFormatter {
         let formatter = NumberFormatter()
         formatter.numberStyle = .decimal
-        formatter.maximumFractionDigits = 1
+        formatter.maximumFractionDigits = 0
+        if units == .mgdL {
+            formatter.minimumFractionDigits = 1
+            formatter.maximumFractionDigits = 1
+        }
         return formatter
     }
 
@@ -52,7 +56,7 @@ struct CurrentGlucoseView: View {
                 ).font(.caption)
                 Text("\(units.rawValue)").font(.caption2)
             }
-        }.frame(minWidth: 120)
+        }
     }
 
     var image: Image {

+ 1 - 1
FreeAPS/Sources/Modules/Home/View/Header/LoopView.swift

@@ -37,7 +37,7 @@ struct LoopView: View {
             if isLooping {
                 Text("looping").font(.caption2)
             } else if actualSuggestion?.timestamp != nil {
-                Text("\(Int((timerDate.timeIntervalSince(lastLoopDate) - Config.lag) / 60) + 1) min").font(.caption)
+                Text("\(Int((timerDate.timeIntervalSince(lastLoopDate) - Config.lag) / 60) + 1) min ago").font(.caption)
             } else {
                 Text("--").font(.caption)
             }

+ 9 - 6
FreeAPS/Sources/Modules/Home/View/HomeRootView.swift

@@ -26,14 +26,14 @@ extension Home {
                         Text((numberFormatter.string(from: (viewModel.suggestion?.cob ?? 0) as NSNumber) ?? "0") + " g")
                             .font(.caption2)
                     }
-                }
+                }.frame(minWidth: 0, maxWidth: .infinity)
                 Spacer()
                 CurrentGlucoseView(
                     recentGlucose: $viewModel.recentGlucose,
                     delta: $viewModel.glucoseDelta,
                     units: viewModel.units
-                )
-                .padding(.horizontal)
+                ).frame(minWidth: 0, maxWidth: .infinity)
+                Spacer()
                 LoopView(
                     suggestion: $viewModel.suggestion,
                     enactedSuggestion: $viewModel.enactedSuggestion,
@@ -45,7 +45,7 @@ extension Home {
                     isStatusPopupPresented = true
                 }.onLongPressGesture {
                     viewModel.runLoop()
-                }
+                }.frame(minWidth: 0, maxWidth: .infinity)
             }.frame(maxWidth: .infinity)
         }
 
@@ -53,7 +53,7 @@ extension Home {
             viewModel.setFilteredGlucoseHours(hours: 24)
             return GeometryReader { geo in
                 VStack {
-                    header.padding().frame(maxHeight: 70)
+                    header.padding(.vertical).frame(maxHeight: 70)
                     MainChartView(
                         glucose: $viewModel.glucose,
                         suggestion: $viewModel.suggestion,
@@ -98,7 +98,10 @@ extension Home {
                             if viewModel.allowManualTemp {
                                 Button { viewModel.showModal(for: .manualTempBasal) }
                                 label: {
-                                    Image(systemName: "circle.bottomhalf.fill")
+                                    Image("bolus1")
+                                        .renderingMode(.template)
+                                        .resizable()
+                                        .frame(width: 24, height: 24)
                                 }.foregroundColor(.blue)
                                 Spacer()
                             }