Sfoglia il codice sorgente

small improvements to triangle in glucose bubble

polscm32 2 anni fa
parent
commit
71b471ac0c

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

@@ -164,9 +164,11 @@ struct Triangle: Shape {
     func path(in rect: CGRect) -> Path {
         var path = Path()
 
+        let cornerRadius: CGFloat = 8
+
         path.move(to: CGPoint(x: rect.midX, y: rect.minY))
-        path.addLine(to: CGPoint(x: rect.maxX, y: rect.maxY))
-        path.addLine(to: CGPoint(x: rect.minX, y: rect.maxY))
+        path.addLine(to: CGPoint(x: rect.maxX, y: rect.maxY - cornerRadius))
+        path.addQuadCurve(to: CGPoint(x: rect.minX, y: rect.maxY - cornerRadius), control: CGPoint(x: rect.midX, y: rect.maxY))
         path.closeSubpath()
 
         return path
@@ -177,7 +179,7 @@ struct TrendShape: View {
     let color: Color
 
     var body: some View {
-        HStack(alignment: .center, spacing: -4) {
+        HStack(alignment: .center, spacing: -5) {
             CircleShape(color: color)
             TriangleShape(color: color)
         }

+ 44 - 44
FreeAPS/Sources/Modules/Home/View/HomeRootView.swift

@@ -454,50 +454,50 @@ extension Home {
             .padding(.vertical, 1)
         }
 
-        @ViewBuilder private func profiles(_: GeometryProxy) -> some View {
-            let colour: Color = colorScheme == .dark ? .black : .white
-            let colourRectangle: Color = colorScheme == .dark ? .gray.opacity(0.1) : .white
-
-            ZStack {
-                Rectangle()
-//                    .fill(Color.gray.opacity(0.3))
-                    .fill(colourRectangle)
-                    .frame(maxHeight: 40)
-                    .cornerRadius(15)
-                    .padding([.leading, .trailing], 10)
-                let cancel = fetchedPercent.first?.enabled ?? false
-                HStack(spacing: cancel ? 25 : 15) {
-                    Text(selectedProfile().name).foregroundColor(.secondary)
-                    if cancel, selectedProfile().isOn {
-                        Button { showCancelAlert.toggle() }
-                        label: {
-                            Image(systemName: "xmark")
-                                .foregroundStyle(.secondary)
-                        }
-                    }
-                    Button { state.showModal(for: .overrideProfilesConfig) }
-                    label: {
-                        Image(systemName: "person.3.sequence.fill")
-                            .symbolRenderingMode(.palette)
-                            .foregroundStyle(
-                                !(fetchedPercent.first?.enabled ?? false) ? .green : .cyan,
-                                !(fetchedPercent.first?.enabled ?? false) ? .cyan : .green,
-                                .purple
-                            )
-                    }
-                }
-            }
-            .alert(
-                "Return to Normal?", isPresented: $showCancelAlert,
-                actions: {
-                    Button("No", role: .cancel) {}
-                    Button("Yes", role: .destructive) {
-                        state.cancelProfile()
-                    }
-                }, message: { Text("This will change settings back to your normal profile.") }
-            )
-            Rectangle().fill(colour).frame(maxHeight: 1)
-        }
+//        @ViewBuilder private func profiles(_: GeometryProxy) -> some View {
+//            let colour: Color = colorScheme == .dark ? .black : .white
+//            let colourRectangle: Color = colorScheme == .dark ? .gray.opacity(0.1) : .white
+//
+//            ZStack {
+//                Rectangle()
+        ////                    .fill(Color.gray.opacity(0.3))
+//                    .fill(colourRectangle)
+//                    .frame(maxHeight: 40)
+//                    .cornerRadius(15)
+//                    .padding([.leading, .trailing], 10)
+//                let cancel = fetchedPercent.first?.enabled ?? false
+//                HStack(spacing: cancel ? 25 : 15) {
+//                    Text(selectedProfile().name).foregroundColor(.secondary)
+//                    if cancel, selectedProfile().isOn {
+//                        Button { showCancelAlert.toggle() }
+//                        label: {
+//                            Image(systemName: "xmark")
+//                                .foregroundStyle(.secondary)
+//                        }
+//                    }
+//                    Button { state.showModal(for: .overrideProfilesConfig) }
+//                    label: {
+//                        Image(systemName: "person.3.sequence.fill")
+//                            .symbolRenderingMode(.palette)
+//                            .foregroundStyle(
+//                                !(fetchedPercent.first?.enabled ?? false) ? .green : .cyan,
+//                                !(fetchedPercent.first?.enabled ?? false) ? .cyan : .green,
+//                                .purple
+//                            )
+//                    }
+//                }
+//            }
+//            .alert(
+//                "Return to Normal?", isPresented: $showCancelAlert,
+//                actions: {
+//                    Button("No", role: .cancel) {}
+//                    Button("Yes", role: .destructive) {
+//                        state.cancelProfile()
+//                    }
+//                }, message: { Text("This will change settings back to your normal profile.") }
+//            )
+//            Rectangle().fill(colour).frame(maxHeight: 1)
+//        }
 
         private func selectedProfile() -> (name: String, isOn: Bool) {
             var profileString = ""