Browse Source

Merge pull request #5 from dnzxy/UI

Various additions and fixes
polscm32 2 năm trước cách đây
mục cha
commit
db4fc3259e

+ 1 - 1
FreeAPS/Sources/Modules/Home/View/Chart/MainChartView.swift

@@ -273,7 +273,7 @@ struct MainChartView: View {
         .scaleEffect(x: 1, y: -1)
         .scaleEffect(x: 1, y: -1)
         .frame(width: fullGlucoseWidth(viewWidth: fullSize.width) + additionalWidth(viewWidth: fullSize.width))
         .frame(width: fullGlucoseWidth(viewWidth: fullSize.width) + additionalWidth(viewWidth: fullSize.width))
         .frame(maxHeight: Config.basalHeight)
         .frame(maxHeight: Config.basalHeight)
-        .background(Color.secondary.opacity(0.1))
+        .background(colorScheme == .dark ? Color.black.opacity(0.8) : Color.clear)
         .onChange(of: tempBasals) { _ in
         .onChange(of: tempBasals) { _ in
             calculateBasalPoints(fullSize: fullSize)
             calculateBasalPoints(fullSize: fullSize)
         }
         }

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

@@ -17,7 +17,7 @@ struct CurrentGlucoseView: View {
         Color(red: 0.263, green: 0.733, blue: 0.914),
         Color(red: 0.263, green: 0.733, blue: 0.914),
         Color(red: 0.263, green: 0.733, blue: 0.914),
         Color(red: 0.263, green: 0.733, blue: 0.914),
         Color(red: 0.729, green: 0.337, blue: 1)
         Color(red: 0.729, green: 0.337, blue: 1)
-    ], center: .center, startAngle: .degrees(-45), endAngle: .degrees(135))
+    ], center: .center, startAngle: .degrees(-55), endAngle: .degrees(145))
 
 
     @Environment(\.colorScheme) var colorScheme
     @Environment(\.colorScheme) var colorScheme
 
 

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

@@ -21,13 +21,13 @@ struct LoopView: View {
         return formatter
         return formatter
     }
     }
 
 
-    private let rect = CGRect(x: 0, y: 0, width: 35, height: 35)
+    private let rect = CGRect(x: 0, y: 0, width: 24, height: 24)
     var body: some View {
     var body: some View {
         VStack(alignment: .center) {
         VStack(alignment: .center) {
             ZStack {
             ZStack {
                 Circle()
                 Circle()
-                    .strokeBorder(color, lineWidth: 5)
-                    .frame(width: rect.width, height: rect.height, alignment: .bottom)
+                    .strokeBorder(color, lineWidth: 4)
+                    .frame(width: rect.width, height: rect.height, alignment: .center)
                     .mask(mask(in: rect).fill(style: FillStyle(eoFill: true)))
                     .mask(mask(in: rect).fill(style: FillStyle(eoFill: true)))
                 if isLooping {
                 if isLooping {
                     ProgressView()
                     ProgressView()

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

@@ -108,13 +108,13 @@ struct PumpView: View {
 
 
     // DEFINETELY SOMETHING FOR OUR TIMEZONE EXPERT.....
     // DEFINETELY SOMETHING FOR OUR TIMEZONE EXPERT.....
 
 
-    func calculateTINS() -> String {
+    private func calculateTINS() -> String {
         let date = Date()
         let date = Date()
         let calendar = Calendar.current
         let calendar = Calendar.current
         let offset = screenHours
         let offset = screenHours
 
 
         var offsetComponents = DateComponents()
         var offsetComponents = DateComponents()
-//        offsetComponents.hour = -offset.rawValue
+        //        offsetComponents.hour = -offset.rawValue
         offsetComponents.hour = -Int(offset)
         offsetComponents.hour = -Int(offset)
 
 
         let startTime = calendar.date(byAdding: offsetComponents, to: date)!
         let startTime = calendar.date(byAdding: offsetComponents, to: date)!

+ 39 - 13
FreeAPS/Sources/Modules/Home/View/HomeRootView.swift

@@ -368,6 +368,8 @@ extension Home {
         var legendPanel: some View {
         var legendPanel: some View {
             ZStack {
             ZStack {
                 HStack(alignment: .center) {
                 HStack(alignment: .center) {
+                    Spacer()
+
                     Group {
                     Group {
                         Circle().fill(Color.loopGreen).frame(width: 8, height: 8)
                         Circle().fill(Color.loopGreen).frame(width: 8, height: 8)
                         Text("BG")
                         Text("BG")
@@ -385,6 +387,13 @@ extension Home {
                         Text("ZT")
                         Text("ZT")
                             .font(.system(size: 12, weight: .bold)).foregroundColor(.zt)
                             .font(.system(size: 12, weight: .bold)).foregroundColor(.zt)
                     }
                     }
+
+                    Spacer()
+
+                    loopView.padding(.top, 16)
+
+                    Spacer()
+
                     Group {
                     Group {
                         Circle().fill(Color.loopYellow).frame(width: 8, height: 8)
                         Circle().fill(Color.loopYellow).frame(width: 8, height: 8)
                             .padding(.leading, 8)
                             .padding(.leading, 8)
@@ -406,9 +415,9 @@ extension Home {
                         )
                         )
                         .font(.system(size: 12, weight: .bold)).foregroundColor(.secondary)
                         .font(.system(size: 12, weight: .bold)).foregroundColor(.secondary)
                     }
                     }
+                    Spacer()
                 }
                 }
                 .frame(maxWidth: .infinity)
                 .frame(maxWidth: .infinity)
-                .padding([.bottom], 20)
             }
             }
         }
         }
 
 
@@ -424,9 +433,28 @@ extension Home {
                         try? moc.save()
                         try? moc.save()
                         state.hours = button.hours
                         state.hours = button.hours
                     }
                     }
-                    .foregroundStyle(button.active ? .primary : .secondary)
+                    .foregroundStyle(button.active ? (colorScheme == .dark ? Color.white : Color.black).opacity(0.9) : .secondary)
                     .frame(maxHeight: 30).padding(.horizontal, 8)
                     .frame(maxHeight: 30).padding(.horizontal, 8)
-                    .background(button.active ? Color(.systemGray5) : .clear, in: .capsule(style: .circular))
+                    .background(
+                        button.active ?
+                            // RGB(30, 60, 95)
+                            (
+                                colorScheme == .dark ? Color(red: 0.1176470588, green: 0.2352941176, blue: 0.3725490196) :
+                                    Color.white
+                            ) :
+                            Color
+                            .clear
+                    )
+                    .shadow(
+                        color: colorScheme == .dark ? Color(
+                            red: 0.02745098039,
+                            green: 0.1098039216,
+                            blue: 0.1411764706
+                        ) : Color
+                            .black.opacity(0.33),
+                        radius: 3
+                    )
+                    .cornerRadius(20)
                 }
                 }
             }
             }
             .font(buttonFont)
             .font(buttonFont)
@@ -660,15 +688,15 @@ extension Home {
                 VStack(spacing: 0) {
                 VStack(spacing: 0) {
                     Spacer()
                     Spacer()
 
 
-                    ZStack {
-                        glucoseView
+//                    ZStack {
+                    glucoseView.padding(.top, 75)
 
 
-                        loopView
-                            /// circles width is 110, loops width is 35 -> (110/2) - (35/2) = 55 - 17.5 = 37.5
-                            .offset(x: UIScreen.main.bounds.width * 0.43, y: -37.5)
-                            .padding(.trailing, 10)
-                    }
-                    .padding(.top, 75)
+//                        loopView
+//                            /// circles width is 110, loops width is 35 -> (110/2) - (35/2) = 55 - 17.5 = 37.5
+//                            .offset(x: UIScreen.main.bounds.width * 0.43, y: -37.5)
+//                            .padding(.trailing, 10)
+//                    }
+//                    .padding(.top, 75)
 
 
                     Spacer()
                     Spacer()
 
 
@@ -697,8 +725,6 @@ extension Home {
 
 
                     timeInterval
                     timeInterval
 
 
-                    Spacer()
-
                     legendPanel
                     legendPanel
 
 
                     Spacer()
                     Spacer()