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

remove double headers and texts

Marvin Polscheit 6 месяцев назад
Родитель
Сommit
87119bade0

+ 11 - 33
Trio/Sources/Modules/BasalProfileEditor/View/BasalProfileEditorRootView.swift

@@ -126,42 +126,20 @@ extension BasalProfileEditor {
                             VStack(alignment: .leading, spacing: 0) {
                                 // Chart visualization
                                 if !state.items.isEmpty {
-                                    VStack(alignment: .leading, spacing: 12) {
-                                        VStack(alignment: .leading, spacing: 8) {
-                                            HStack {
-                                                Image(systemName: "chart.xyaxis.line")
-                                                    .font(.title2)
-                                                    .foregroundStyle(.purple)
-                                                Text("Basal Rates")
-                                                    .font(.headline)
-                                                Spacer()
-                                            }
-
-                                            Text(
-                                                "Your basal profile represents the amount of background insulin you need throughout the day. This helps Trio calculate your insulin needs."
+                                    basalProfileChart
+                                        .frame(height: 180)
+                                        .padding()
+                                        .background(Color.chart.opacity(0.65))
+                                        .clipShape(
+                                            .rect(
+                                                topLeadingRadius: 10,
+                                                bottomLeadingRadius: 0,
+                                                bottomTrailingRadius: 0,
+                                                topTrailingRadius: 10
                                             )
-                                            .font(.caption)
-                                            .foregroundStyle(.secondary)
-                                        }
+                                        )
                                         .padding(.horizontal)
                                         .padding(.top)
-
-                                        basalProfileChart
-                                            .frame(height: 180)
-                                            .padding(.horizontal)
-                                            .padding(.bottom)
-                                    }
-                                    .background(Color.chart.opacity(0.65))
-                                    .clipShape(
-                                        .rect(
-                                            topLeadingRadius: 10,
-                                            bottomLeadingRadius: 0,
-                                            bottomTrailingRadius: 0,
-                                            topTrailingRadius: 10
-                                        )
-                                    )
-                                    .padding(.horizontal)
-                                    .padding(.top)
                                 }
 
                                 // Basal profile list

+ 11 - 82
Trio/Sources/Modules/CarbRatioEditor/View/CarbRatioEditorRootView.swift

@@ -72,42 +72,20 @@ extension CarbRatioEditor {
                             VStack(alignment: .leading, spacing: 0) {
                                 // Chart visualization
                                 if !state.items.isEmpty {
-                                    VStack(alignment: .leading, spacing: 12) {
-                                        VStack(alignment: .leading, spacing: 8) {
-                                            HStack {
-                                                Image(systemName: "fork.knife")
-                                                    .font(.title2)
-                                                    .foregroundStyle(.orange)
-                                                Text("Carb Ratios")
-                                                    .font(.headline)
-                                                Spacer()
-                                            }
-
-                                            Text(
-                                                "Your carb ratio tells how many grams of carbohydrates one unit of insulin will cover. This is essential for accurate meal bolus calculations."
+                                    carbRatioChart
+                                        .frame(height: 180)
+                                        .padding()
+                                        .background(Color.chart.opacity(0.65))
+                                        .clipShape(
+                                            .rect(
+                                                topLeadingRadius: 10,
+                                                bottomLeadingRadius: 0,
+                                                bottomTrailingRadius: 0,
+                                                topTrailingRadius: 10
                                             )
-                                            .font(.caption)
-                                            .foregroundStyle(.secondary)
-                                        }
+                                        )
                                         .padding(.horizontal)
                                         .padding(.top)
-
-                                        carbRatioChart
-                                            .frame(height: 180)
-                                            .padding(.horizontal)
-                                            .padding(.bottom)
-                                    }
-                                    .background(Color.chart.opacity(0.65))
-                                    .clipShape(
-                                        .rect(
-                                            topLeadingRadius: 10,
-                                            bottomLeadingRadius: 0,
-                                            bottomTrailingRadius: 0,
-                                            topTrailingRadius: 10
-                                        )
-                                    )
-                                    .padding(.horizontal)
-                                    .padding(.top)
                                 }
 
                                 // Carb ratio list
@@ -124,55 +102,6 @@ extension CarbRatioEditor {
                                     }
                                 )
                                 .padding(.horizontal)
-
-                                // Example calculation based on first carb ratio
-                                if !state.items.isEmpty {
-                                    Spacer(minLength: 20)
-
-                                    VStack(alignment: .leading, spacing: 8) {
-                                        Text("Example Calculation")
-                                            .font(.headline)
-                                            .padding(.horizontal)
-
-                                        VStack(alignment: .leading, spacing: 8) {
-                                            Text("For 45 g of carbs, you would need:")
-                                                .font(.subheadline)
-                                                .padding(.horizontal)
-
-                                            let insulinNeeded = 45 /
-                                                Double(truncating: state.rateValues[state.items.first!.rateIndex] as NSNumber)
-                                            Text(
-                                                "45 \(String(localized: "g", comment: "Gram abbreviation")) / \(formatter.string(from: state.rateValues[state.items.first!.rateIndex] as NSNumber) ?? "--") = \(String(format: "%.1f", insulinNeeded)) \(String(localized: "U", comment: "Insulin unit abbreviation"))"
-                                            )
-                                            .font(.system(.body, design: .monospaced))
-                                            .foregroundColor(.orange)
-                                            .padding()
-                                            .frame(maxWidth: .infinity, alignment: .center)
-                                            .background(Color.chart.opacity(0.65))
-                                            .cornerRadius(10)
-                                        }
-                                    }
-
-                                    Spacer(minLength: 20)
-
-                                    // Information about the carb ratio
-                                    VStack(alignment: .leading, spacing: 8) {
-                                        Text("What This Means")
-                                            .font(.headline)
-                                            .padding(.horizontal)
-
-                                        VStack(alignment: .leading, spacing: 4) {
-                                            Text("• A ratio of 10 g/U means 1 unit of insulin covers 10 g of carbs")
-                                            Text("• A lower number means you need more insulin for the same amount of carbs")
-                                            Text("• A higher number means you need less insulin for the same amount of carbs")
-                                            Text("• Different times of day may require different ratios")
-                                        }
-                                        .font(.caption)
-                                        .foregroundColor(.secondary)
-                                        .padding(.horizontal)
-                                    }
-                                    .id(bottomID)
-                                }
                             }
                         }
                     }

+ 11 - 89
Trio/Sources/Modules/ISFEditor/View/ISFEditorRootView.swift

@@ -76,42 +76,20 @@ extension ISFEditor {
                             VStack(alignment: .leading, spacing: 0) {
                                 // Chart visualization
                                 if !state.items.isEmpty {
-                                    VStack(alignment: .leading, spacing: 12) {
-                                        VStack(alignment: .leading, spacing: 8) {
-                                            HStack {
-                                                Image(systemName: "drop.fill")
-                                                    .font(.title2)
-                                                    .foregroundStyle(.cyan)
-                                                Text("Insulin Sensitivities")
-                                                    .font(.headline)
-                                                Spacer()
-                                            }
-
-                                            Text(
-                                                "Your insulin sensitivity factor (ISF) indicates how much one unit of insulin will lower your blood glucose. This helps calculate correction boluses."
+                                    isfChart
+                                        .frame(height: 180)
+                                        .padding()
+                                        .background(Color.chart.opacity(0.65))
+                                        .clipShape(
+                                            .rect(
+                                                topLeadingRadius: 10,
+                                                bottomLeadingRadius: 0,
+                                                bottomTrailingRadius: 0,
+                                                topTrailingRadius: 10
                                             )
-                                            .font(.caption)
-                                            .foregroundStyle(.secondary)
-                                        }
+                                        )
                                         .padding(.horizontal)
                                         .padding(.top)
-
-                                        isfChart
-                                            .frame(height: 180)
-                                            .padding(.horizontal)
-                                            .padding(.bottom)
-                                    }
-                                    .background(Color.chart.opacity(0.65))
-                                    .clipShape(
-                                        .rect(
-                                            topLeadingRadius: 10,
-                                            bottomLeadingRadius: 0,
-                                            bottomTrailingRadius: 0,
-                                            topTrailingRadius: 10
-                                        )
-                                    )
-                                    .padding(.horizontal)
-                                    .padding(.top)
                                 }
 
                                 // ISF list
@@ -128,62 +106,6 @@ extension ISFEditor {
                                     }
                                 )
                                 .padding(.horizontal)
-
-                                // Example calculation based on first ISF
-                                if !state.items.isEmpty {
-                                    Spacer(minLength: 20)
-
-                                    VStack(alignment: .leading, spacing: 8) {
-                                        Text("Example Calculation")
-                                            .font(.headline)
-                                            .padding(.horizontal)
-
-                                        VStack(alignment: .leading, spacing: 8) {
-                                            let aboveTarget = state.units == .mgdL ? Decimal(40) : 40.asMmolL
-                                            let firstIsfRate: Decimal = state.rateValues[state.items.first?.rateIndex ?? 0]
-                                            let isfValue = state.units == .mgdL ? firstIsfRate : firstIsfRate.asMmolL
-                                            let insulinNeeded = aboveTarget / isfValue
-
-                                            Text(
-                                                "If you are \(numberFormatter.string(from: aboveTarget as NSNumber) ?? "--") \(state.units.rawValue) above target:"
-                                            )
-                                            .font(.subheadline)
-                                            .padding(.horizontal)
-
-                                            Text(
-                                                "\(aboveTarget.description) \(state.units.rawValue) / \(isfValue.description) \(state.units.rawValue)/\(String(localized: "U", comment: "Insulin unit abbreviation")) = \(String(format: "%.1f", Double(insulinNeeded))) \(String(localized: "U", comment: "Insulin unit abbreviation"))"
-                                            )
-                                            .font(.system(.body, design: .monospaced))
-                                            .foregroundColor(.cyan)
-                                            .padding()
-                                            .frame(maxWidth: .infinity, alignment: .center)
-                                            .background(Color.chart.opacity(0.65))
-                                            .cornerRadius(10)
-                                        }
-                                    }
-
-                                    Spacer(minLength: 20)
-
-                                    // Information about ISF
-                                    VStack(alignment: .leading, spacing: 8) {
-                                        Text("What This Means")
-                                            .font(.headline)
-                                            .padding(.horizontal)
-
-                                        VStack(alignment: .leading, spacing: 4) {
-                                            let isfValue = "\(state.units == .mgdL ? Decimal(50) : 50.asMmolL)"
-                                            Text(
-                                                "• An ISF of \(isfValue) \(state.units.rawValue)/U means 1 U lowers your glucose by \(isfValue) \(state.units.rawValue)"
-                                            )
-                                            Text("• A lower number means you're less sensitive (more resistant) to insulin")
-                                            Text("• A higher number means you're more sensitive (less resistant) to insulin")
-                                        }
-                                        .font(.caption)
-                                        .foregroundColor(.secondary)
-                                        .padding(.horizontal)
-                                    }
-                                    .id(bottomID)
-                                }
                             }
                         }
                     }

+ 11 - 33
Trio/Sources/Modules/TargetsEditor/View/TargetsEditorRootView.swift

@@ -70,42 +70,20 @@ extension TargetsEditor {
                             VStack(alignment: .leading, spacing: 0) {
                                 // Chart visualization
                                 if !state.items.isEmpty {
-                                    VStack(alignment: .leading, spacing: 12) {
-                                        VStack(alignment: .leading, spacing: 8) {
-                                            HStack {
-                                                Image(systemName: "target")
-                                                    .font(.title2)
-                                                    .foregroundStyle(.green)
-                                                Text("Glucose Targets")
-                                                    .font(.headline)
-                                                Spacer()
-                                            }
-
-                                            Text(
-                                                "Your glucose target is the blood glucose level you aim to maintain. Trio will use this to calculate insulin doses and provide recommendations."
+                                    glucoseTargetChart
+                                        .frame(height: 180)
+                                        .padding()
+                                        .background(Color.chart.opacity(0.65))
+                                        .clipShape(
+                                            .rect(
+                                                topLeadingRadius: 10,
+                                                bottomLeadingRadius: 0,
+                                                bottomTrailingRadius: 0,
+                                                topTrailingRadius: 10
                                             )
-                                            .font(.caption)
-                                            .foregroundStyle(.secondary)
-                                        }
+                                        )
                                         .padding(.horizontal)
                                         .padding(.top)
-
-                                        glucoseTargetChart
-                                            .frame(height: 180)
-                                            .padding(.horizontal)
-                                            .padding(.bottom)
-                                    }
-                                    .background(Color.chart.opacity(0.65))
-                                    .clipShape(
-                                        .rect(
-                                            topLeadingRadius: 10,
-                                            bottomLeadingRadius: 0,
-                                            bottomTrailingRadius: 0,
-                                            topTrailingRadius: 10
-                                        )
-                                    )
-                                    .padding(.horizontal)
-                                    .padding(.top)
                                 }
 
                                 // Glucose target list