Преглед на файлове

Handle nested List in ScrollView height semi-dynamically

Deniz Cengiz преди 1 година
родител
ревизия
0796d04055

+ 3 - 6
Trio/Sources/Localizations/Main/Localizable.xcstrings

@@ -5420,6 +5420,9 @@
         }
         }
       }
       }
     },
     },
+    "%.2f" : {
+
+    },
     "%.2f U of %.2f U" : {
     "%.2f U of %.2f U" : {
       "comment" : "Format for showing delivered and active bolus amounts, 'x U of y U' on watch",
       "comment" : "Format for showing delivered and active bolus amounts, 'x U of y U' on watch",
       "localizations" : {
       "localizations" : {
@@ -5527,9 +5530,6 @@
         }
         }
       }
       }
     },
     },
-    "%.2f U/day" : {
-
-    },
     "%@" : {
     "%@" : {
       "comment" : "Info message\nunits",
       "comment" : "Info message\nunits",
       "localizations" : {
       "localizations" : {
@@ -180288,9 +180288,6 @@
         }
         }
       }
       }
     },
     },
-    "Total Daily Basal" : {
-
-    },
     "Total Daily Dose" : {
     "Total Daily Dose" : {
 
 
     },
     },

+ 15 - 27
Trio/Sources/Modules/Onboarding/View/OnboardingSteps/BasalProfileStepView.swift

@@ -51,42 +51,30 @@ struct BasalProfileStepView: View {
                     items: $therapyItems,
                     items: $therapyItems,
                     unit: String(localized: "U/hr"),
                     unit: String(localized: "U/hr"),
                     valueOptions: state.basalProfileRateValues
                     valueOptions: state.basalProfileRateValues
-                ).scaledToFit()
+                )
+
+                Spacer(minLength: 20)
 
 
                 // Total daily basal calculation
                 // Total daily basal calculation
                 if !state.basalProfileItems.isEmpty {
                 if !state.basalProfileItems.isEmpty {
-                    VStack(alignment: .leading, spacing: 8) {
+                    VStack(alignment: .leading, spacing: 0) {
                         HStack {
                         HStack {
-                            Text("Total Daily Basal")
-                                .font(.headline)
-                                .padding(.horizontal)
+                            Text("Total")
+                                .bold()
 
 
                             Spacer()
                             Spacer()
 
 
-                            Text("\(calculateTotalDailyBasal(), specifier: "%.2f") U/day")
-                                .font(.headline)
-                                .padding(.horizontal)
-                                .id(refreshUI) // Erzwingt die Aktualisierung des Totals
+                            HStack {
+                                Text("\(calculateTotalDailyBasal(), specifier: "%.2f")")
+                                Text("U/hr")
+                                    .foregroundStyle(Color.secondary)
+                            }
+                            .id(refreshUI) // Erzwingt die Aktualisierung des Totals
                         }
                         }
                     }
                     }
-                    .padding(.top)
-
-                    // Information about basal rates
-//                    VStack(alignment: .leading, spacing: 8) {
-//                        Text("What This Means")
-//                            .font(.headline)
-//                            .padding(.horizontal)
-//
-//                        VStack(alignment: .leading, spacing: 4) {
-//                            Text("• The basal profile provides background insulin throughout the day")
-//                            Text("• Rates should be adjusted based on your body's varying insulin needs")
-//                            Text("• Morning hours may require more insulin due to 'dawn phenomenon'")
-//                            Text("• Lower rates are typically needed during sleep or periods of activity")
-//                        }
-//                        .font(.caption)
-//                        .foregroundColor(.secondary)
-//                        .padding(.horizontal)
-//                    }
+                    .padding()
+                    .background(Color.chart.opacity(0.45))
+                    .cornerRadius(10)
                 }
                 }
             }
             }
         }
         }

+ 1 - 1
Trio/Sources/Modules/Onboarding/View/OnboardingSteps/CarbRatioStepView.swift

@@ -51,7 +51,7 @@ struct CarbRatioStepView: View {
                     items: $therapyItems,
                     items: $therapyItems,
                     unit: String(localized: "g/U"),
                     unit: String(localized: "g/U"),
                     valueOptions: state.carbRatioRateValues
                     valueOptions: state.carbRatioRateValues
-                ).scaledToFit()
+                )
 
 
                 // Example calculation based on first carb ratio
                 // Example calculation based on first carb ratio
                 if !state.carbRatioItems.isEmpty {
                 if !state.carbRatioItems.isEmpty {

+ 1 - 1
Trio/Sources/Modules/Onboarding/View/OnboardingSteps/GlucoseTargetStepView.swift

@@ -60,7 +60,7 @@ struct GlucoseTargetStepView: View {
                     items: $therapyItems,
                     items: $therapyItems,
                     unit: state.units.rawValue,
                     unit: state.units.rawValue,
                     valueOptions: state.targetRateValues
                     valueOptions: state.targetRateValues
-                ).scaledToFit()
+                )
             }
             }
         }
         }
         .onAppear {
         .onAppear {

+ 1 - 1
Trio/Sources/Modules/Onboarding/View/OnboardingSteps/InsulinSensitivityStepView.swift

@@ -51,7 +51,7 @@ struct InsulinSensitivityStepView: View {
                     items: $therapyItems,
                     items: $therapyItems,
                     unit: String(localized: "\(state.units.rawValue)/U"),
                     unit: String(localized: "\(state.units.rawValue)/U"),
                     valueOptions: state.isfRateValues
                     valueOptions: state.isfRateValues
-                ).scaledToFit()
+                )
 
 
                 // Example calculation based on first ISF
                 // Example calculation based on first ISF
                 if !state.isfItems.isEmpty {
                 if !state.isfItems.isEmpty {

+ 3 - 0
Trio/Sources/Modules/Onboarding/View/OnboardingView+Util.swift

@@ -141,7 +141,10 @@ struct TimeValueEditorView: View {
                 .listRowSeparator(.hidden)
                 .listRowSeparator(.hidden)
         }
         }
         .listStyle(.plain)
         .listStyle(.plain)
+        .scrollDisabled(true)
         .scrollContentBackground(.hidden)
         .scrollContentBackground(.hidden)
+        .frame(height: 55 + CGFloat(items.count) * 45 + (items.contains(where: { $0.id == selectedItemID }) ? 230 : 0))
+        // 55 for header row, item counts x 45 for every entry row + 230 for a visible picker row
     }
     }
 
 
     private var timeFormatter: DateFormatter {
     private var timeFormatter: DateFormatter {