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

Quick bolus: apply UI review feedback

- Settings: group Bolus Calculator, Quick Bolus, Meal Settings under a single Treatments row
- Help button: use questionmark.circle to match other views
- Hint text: left-align instead of centered
- Sheet title: slightly larger font via .principal toolbar item
- Pill spacing: tighter VStack, more gap between pills, 1:2 vertical:horizontal padding ratio
- Unit label: match number font size, keep .secondary color
- Pills: max-width cap when only 1–2 suggestions are shown
- Both sheets: add presentation drag indicator
t1dude 1 неделя назад
Родитель
Сommit
ea1c7d4263

+ 1 - 0
Trio/Sources/Modules/Home/View/QuickBolus/QuickBolusInfoView.swift

@@ -30,5 +30,6 @@ struct QuickBolusInfoView: View {
             .padding(.top, 4)
         }
         .presentationDetents([.medium])
+        .presentationDragIndicator(.visible)
     }
 }

+ 19 - 9
Trio/Sources/Modules/Home/View/QuickBolus/QuickBolusView.swift

@@ -12,9 +12,9 @@ struct QuickBolusView: View {
 
     var body: some View {
         NavigationStack {
-            VStack(spacing: 20) {
+            VStack(spacing: 12) {
                 pillRow
-                    .padding(.top, 8)
+                    .padding(.top, 4)
 
                 Text(
                     "Your most-used bolus amounts at similar times on similar days. Tap one to pick it.",
@@ -22,11 +22,11 @@ struct QuickBolusView: View {
                 )
                 .font(.subheadline)
                 .foregroundStyle(.secondary)
-                .multilineTextAlignment(.center)
+                .multilineTextAlignment(.leading)
                 .padding(.horizontal)
             }
             .frame(maxWidth: .infinity)
-            .safeAreaInset(edge: .bottom, spacing: 0) {
+            .safeAreaInset(edge: .bottom, spacing: 10) {
                 SlideToConfirmView(
                     label: String(localized: "Slide to Enact Bolus", comment: "Slide to confirm label for quick bolus"),
                     isEnabled: selectedAmount != nil && !isEnacting
@@ -46,16 +46,21 @@ struct QuickBolusView: View {
                     }
                 }
                 .padding(.horizontal)
-                .padding(.vertical, 12)
+                .padding(.top, 6)
+                .padding(.bottom, 8)
             }
             .navigationTitle(String(localized: "Quick Bolus", comment: "Title of the quick bolus sheet"))
             .navigationBarTitleDisplayMode(.inline)
             .toolbar {
+                ToolbarItem(placement: .principal) {
+                    Text("Quick Bolus", comment: "Title of the quick bolus sheet")
+                        .font(.title3.bold())
+                }
                 ToolbarItem(placement: .topBarTrailing) {
                     Button {
                         showInfo = true
                     } label: {
-                        Image(systemName: "info.circle")
+                        Image(systemName: "questionmark.circle")
                     }
                 }
             }
@@ -75,6 +80,7 @@ struct QuickBolusView: View {
             }
         }
         .presentationDetents([.height(320)])
+        .presentationDragIndicator(.visible)
     }
 
     private var displayedSuggestions: [Decimal] {
@@ -82,11 +88,13 @@ struct QuickBolusView: View {
     }
 
     private var pillRow: some View {
-        HStack(spacing: 12) {
+        HStack(spacing: 16) {
             ForEach(displayedSuggestions, id: \.self) { amount in
                 bolusAmountPill(amount)
+                    .frame(maxWidth: displayedSuggestions.count < 3 ? 160 : .infinity)
             }
         }
+        .frame(maxWidth: .infinity)
         .padding(.horizontal)
     }
 
@@ -101,10 +109,12 @@ struct QuickBolusView: View {
                 Text(formatted)
                     .font(.title2.bold())
                 Text("U")
-                    .font(.callout)
+                    .font(.title2)
                     .foregroundStyle(isSelected ? .white.opacity(0.85) : .secondary)
             }
-            .frame(maxWidth: .infinity, minHeight: 64)
+            .padding(.vertical, 12)
+            .padding(.horizontal, 24)
+            .frame(maxWidth: .infinity)
             .background(isSelected ? Color.accentColor : Color(.secondarySystemFill))
             .foregroundStyle(isSelected ? .white : .primary)
             .clipShape(RoundedRectangle(cornerRadius: 18, style: .continuous))

+ 25 - 3
Trio/Sources/Modules/Settings/View/Subviews/FeatureSettingsView.swift

@@ -21,9 +21,7 @@ struct FeatureSettingsView: BaseView {
             Section(
                 header: Text("Trio Features"),
                 content: {
-                    Text("Bolus Calculator").navigationLink(to: .bolusCalculatorConfig, from: self)
-                    Text("Quick Bolus").navigationLink(to: .quickBolusConfig, from: self)
-                    Text("Meal Settings").navigationLink(to: .mealSettings, from: self)
+                    Text("Treatments").navigationLink(to: .treatmentsSettings, from: self)
                     Text("Shortcuts").navigationLink(to: .shortcutsConfig, from: self)
                     Text("Remote Control").navigationLink(to: .remoteControlConfig, from: self)
                 }
@@ -53,3 +51,27 @@ struct FeatureSettingsView: BaseView {
         .navigationBarTitleDisplayMode(.automatic)
     }
 }
+
+struct TreatmentsSettingsView: BaseView {
+    let resolver: Resolver
+
+    @ObservedObject var state: Settings.StateModel
+
+    @Environment(\.colorScheme) var colorScheme
+    @Environment(AppState.self) var appState
+
+    var body: some View {
+        Form {
+            Section {
+                Text("Bolus Calculator").navigationLink(to: .bolusCalculatorConfig, from: self)
+                Text("Quick Bolus").navigationLink(to: .quickBolusConfig, from: self)
+                Text("Meal Settings").navigationLink(to: .mealSettings, from: self)
+            }
+            .listRowBackground(Color.chart)
+        }
+        .scrollContentBackground(.hidden)
+        .background(appState.trioBackgroundColor(for: colorScheme))
+        .navigationTitle("Treatments")
+        .navigationBarTitleDisplayMode(.automatic)
+    }
+}

+ 3 - 0
Trio/Sources/Router/Screen.swift

@@ -51,6 +51,7 @@ enum Screen: Identifiable, Hashable {
     case unitsAndLimits
     case appDiagnostics
     case settingsExport
+    case treatmentsSettings
 
     var id: Int { String(reflecting: self).hashValue }
 }
@@ -168,6 +169,8 @@ extension Screen {
             AppDiagnostics.RootView(resolver: resolver)
         case .settingsExport:
             SettingsExport.RootView(resolver: resolver)
+        case .treatmentsSettings:
+            TreatmentsSettingsView(resolver: resolver, state: Settings.StateModel())
         }
     }