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

Cleanup + Fix UI Styling for button row

Deniz Cengiz 6 месяцев назад
Родитель
Сommit
0aaf87bf24

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

@@ -221437,7 +221437,6 @@
       }
     },
     "Swipe to delete a single entry. Tap on it, to edit its time or rate." : {
-      "extractionState" : "stale",
       "localizations" : {
         "bg" : {
           "stringUnit" : {
@@ -221555,6 +221554,9 @@
         }
       }
     },
+    "Swipe to delete a single entry. Tap on it, to edit its time or value." : {
+
+    },
     "System Default" : {
       "localizations" : {
         "bg" : {

+ 55 - 39
Trio/Sources/Modules/BasalProfileEditor/View/BasalProfileEditorRootView.swift

@@ -118,6 +118,48 @@ extension BasalProfileEditor {
             }
         }
 
+        var fullScheduleWarning: some View {
+            VStack {
+                Text(
+                    "Basal profile covers 24 hours. You cannot add more rates. Please remove or adjust existing rates to make space."
+                ).bold()
+            }
+            .frame(maxWidth: .infinity, alignment: .leading)
+            .padding()
+            .background(Color.tabBar)
+            .clipShape(
+                .rect(
+                    topLeadingRadius: 10,
+                    bottomLeadingRadius: 10,
+                    bottomTrailingRadius: 10,
+                    topTrailingRadius: 10
+                )
+            )
+        }
+
+        var totalBasalRow: some View {
+            VStack(alignment: .leading, spacing: 0) {
+                HStack {
+                    Text("Total")
+                        .bold()
+
+                    Spacer()
+
+                    HStack {
+                        Text(rateFormatter.string(from: state.total as NSNumber) ?? "0")
+                        Text("U/day")
+                            .foregroundStyle(Color.secondary)
+                    }
+                    .id(refreshUI)
+                }
+            }
+            .padding()
+            .background(Color.chart.opacity(0.65))
+            .cornerRadius(10)
+            .padding(.horizontal)
+            .id(bottomID)
+        }
+
         var body: some View {
             ScrollViewReader { proxy in
                 VStack(spacing: 0) {
@@ -125,24 +167,8 @@ extension BasalProfileEditor {
                         LazyVStack {
                             VStack(alignment: .leading, spacing: 0) {
                                 if !state.canAdd {
-                                    VStack {
-                                        Text(
-                                            "Basal profile covers 24 hours. You cannot add more rates. Please remove or adjust existing rates to make space."
-                                        ).bold()
-                                    }
-                                    .frame(maxWidth: .infinity, alignment: .leading)
-                                    .padding()
-                                    .background(Color.tabBar)
-                                    .clipShape(
-                                        .rect(
-                                            topLeadingRadius: 10,
-                                            bottomLeadingRadius: 10,
-                                            bottomTrailingRadius: 10,
-                                            topTrailingRadius: 10
-                                        )
-                                    )
-                                    .padding(.horizontal)
-                                    .padding(.top)
+                                    fullScheduleWarning
+                                        .padding()
                                 }
 
                                 // Chart visualization
@@ -178,31 +204,21 @@ extension BasalProfileEditor {
                                 )
                                 .padding(.horizontal)
 
-                                // Total daily basal calculation
                                 if !state.items.isEmpty {
-                                    Spacer(minLength: 20)
-
-                                    VStack(alignment: .leading, spacing: 0) {
-                                        HStack {
-                                            Text("Total")
-                                                .bold()
+                                    totalBasalRow
+                                }
 
-                                            Spacer()
+                                HStack {
+                                    Image(systemName: "hand.draw.fill")
+                                        .padding(.leading)
 
-                                            HStack {
-                                                Text(rateFormatter.string(from: state.total as NSNumber) ?? "0")
-                                                Text("U/day")
-                                                    .foregroundStyle(Color.secondary)
-                                            }
-                                            .id(refreshUI)
-                                        }
-                                    }
-                                    .padding()
-                                    .background(Color.chart.opacity(0.65))
-                                    .cornerRadius(10)
-                                    .padding(.horizontal)
-                                    .id(bottomID)
+                                    Text("Swipe to delete a single entry. Tap on it, to edit its time or value.")
+                                        .padding(.trailing)
                                 }
+                                .font(.subheadline)
+                                .fontWeight(.light)
+                                .foregroundStyle(.secondary)
+                                .padding()
                             }
                         }
                     }

+ 12 - 0
Trio/Sources/Modules/CarbRatioEditor/View/CarbRatioEditorRootView.swift

@@ -102,6 +102,18 @@ extension CarbRatioEditor {
                                     }
                                 )
                                 .padding(.horizontal)
+
+                                HStack {
+                                    Image(systemName: "hand.draw.fill")
+                                        .padding(.leading)
+
+                                    Text("Swipe to delete a single entry. Tap on it, to edit its time or value.")
+                                        .padding(.trailing)
+                                }
+                                .font(.subheadline)
+                                .fontWeight(.light)
+                                .foregroundStyle(.secondary)
+                                .padding()
                             }
                         }
                     }

+ 12 - 0
Trio/Sources/Modules/ISFEditor/View/ISFEditorRootView.swift

@@ -106,6 +106,18 @@ extension ISFEditor {
                                     }
                                 )
                                 .padding(.horizontal)
+
+                                HStack {
+                                    Image(systemName: "hand.draw.fill")
+                                        .padding(.leading)
+
+                                    Text("Swipe to delete a single entry. Tap on it, to edit its time or rate.")
+                                        .padding(.trailing)
+                                }
+                                .font(.subheadline)
+                                .fontWeight(.light)
+                                .foregroundStyle(.secondary)
+                                .padding()
                             }
                         }
                     }

+ 19 - 2
Trio/Sources/Modules/Onboarding/View/TherapySettingEditorView.swift

@@ -16,6 +16,8 @@ struct TherapySettingEditorView: View {
             ScrollView {
                 HStack {
                     Text("Entries").bold()
+                        .padding([.top, .bottom], 10)
+                        .padding(.leading, 20)
                     Spacer()
                     Button {
                         // Prepare and add new entry
@@ -42,11 +44,13 @@ struct TherapySettingEditorView: View {
                             Image(systemName: "plus.circle.fill")
                             Text("Add")
                         }.foregroundColor(cannotAddMoreEntries ? .secondary : .accentColor)
+                            .padding([.top, .bottom], 10)
+                            .padding(.trailing, 20)
                     }
                     .disabled(cannotAddMoreEntries)
                 }
-                .listRowBackground(Color.chart.opacity(0.65))
-                .padding(.vertical, 10)
+                .background(Color.chart.opacity(0.65))
+                .padding(.bottom, -10)
 
                 List {
                     ForEach($items) { $item in
@@ -106,6 +110,19 @@ struct TherapySettingEditorView: View {
                         }
                     }
                     .listRowBackground(Color.chart.opacity(0.65))
+
+                    Rectangle().fill(Color.chart.opacity(0.65)).frame(height: 10)
+                        .clipShape(
+                            .rect(
+                                topLeadingRadius: 0,
+                                bottomLeadingRadius: 10,
+                                bottomTrailingRadius: 10,
+                                topTrailingRadius: 0
+                            )
+                        )
+                        .listRowBackground(Color.clear)
+                        .listRowInsets(EdgeInsets(top: -22, leading: 0, bottom: 0, trailing: 0))
+                        .listRowSeparator(.hidden)
                 }
                 .id(bottomID)
                 .listStyle(.plain)

+ 12 - 0
Trio/Sources/Modules/TargetsEditor/View/TargetsEditorRootView.swift

@@ -101,6 +101,18 @@ extension TargetsEditor {
                                 )
                                 .padding(.horizontal)
                                 .id(bottomID)
+
+                                HStack {
+                                    Image(systemName: "hand.draw.fill")
+                                        .padding(.leading)
+
+                                    Text("Swipe to delete a single entry. Tap on it, to edit its time or value.")
+                                        .padding(.trailing)
+                                }
+                                .font(.subheadline)
+                                .fontWeight(.light)
+                                .foregroundStyle(.secondary)
+                                .padding()
                             }
                         }
                     }