|
|
@@ -749,61 +749,109 @@ extension Home {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @ViewBuilder func menuElements(action: @escaping () -> Void, systemName: String, title: String) -> some View {
|
|
|
+ @ViewBuilder func menuSymbols(action: @escaping () -> Void, systemName: String) -> some View {
|
|
|
Button(
|
|
|
action: action,
|
|
|
label: {
|
|
|
HStack {
|
|
|
Image(systemName: systemName)
|
|
|
.font(.system(size: 21))
|
|
|
+ .foregroundStyle(colorScheme == .dark ? .white : .black)
|
|
|
+ }.padding(.top, 1)
|
|
|
+ }
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ @ViewBuilder func menuElements(action: @escaping () -> Void, title: String) -> some View {
|
|
|
+ Button(
|
|
|
+ action: action,
|
|
|
+ label: {
|
|
|
+ HStack {
|
|
|
Text(title)
|
|
|
.font(.system(size: 19))
|
|
|
+ .foregroundStyle(colorScheme == .dark ? .white : .black)
|
|
|
+ Spacer()
|
|
|
+ Image(systemName: "arrow.right")
|
|
|
+ .font(.system(size: 21))
|
|
|
+ .foregroundStyle(colorScheme == .dark ? .white : .black)
|
|
|
}.padding(.top, 1)
|
|
|
}
|
|
|
)
|
|
|
}
|
|
|
|
|
|
@ViewBuilder func sideMenuView() -> some View {
|
|
|
- VStack(alignment: .leading, spacing: 25) {
|
|
|
- HStack {
|
|
|
- Button {
|
|
|
- isMenuPresented.toggle()
|
|
|
- } label: {
|
|
|
- Image(systemName: "xmark.app")
|
|
|
+ VStack(alignment: .leading) {
|
|
|
+ Button {
|
|
|
+ isMenuPresented.toggle()
|
|
|
+ } label: {
|
|
|
+ HStack {
|
|
|
+ Image(systemName: "arrow.left")
|
|
|
.font(.system(size: 30))
|
|
|
+ .foregroundStyle(colorScheme == .dark ? .white : .black)
|
|
|
+ Text("Menu")
|
|
|
+ .font(.system(size: 30)).fontWeight(.bold)
|
|
|
+ .foregroundStyle(colorScheme == .dark ? .white : .black)
|
|
|
}
|
|
|
- }.padding(.horizontal, 1).padding(.top, 60)
|
|
|
- Text("Menu")
|
|
|
- .font(.system(size: 30)).fontWeight(.bold).padding(.top, 20)
|
|
|
+ }
|
|
|
+ .padding(.top, 60)
|
|
|
|
|
|
- menuElements(action: { state.showModal(for: .statistics) }, systemName: "chart.bar", title: "Statistics")
|
|
|
- .padding(.top, 20)
|
|
|
+ HStack(spacing: 15) {
|
|
|
+ VStack(alignment: .leading, spacing: 25, content: {
|
|
|
+ menuSymbols(action: { state.showModal(for: .statistics) }, systemName: "chart.bar.xaxis")
|
|
|
+ .padding(.top, 20)
|
|
|
|
|
|
- menuElements(action: {
|
|
|
- if state.pumpDisplayState != nil {
|
|
|
- state.setupPump = true
|
|
|
- }
|
|
|
- }, systemName: "cross.vial.fill", title: "Pump Settings")
|
|
|
+ menuSymbols(action: {
|
|
|
+ if state.pumpDisplayState != nil {
|
|
|
+ state.setupPump = true
|
|
|
+ }
|
|
|
+ }, systemName: "cross.vial.fill")
|
|
|
|
|
|
- menuElements(action: {
|
|
|
- if state.alarm == nil {
|
|
|
- state.openCGM()
|
|
|
- } else {
|
|
|
- state.showModal(for: .snooze)
|
|
|
- }
|
|
|
- }, systemName: "textformat.123", title: "CGM")
|
|
|
+ menuSymbols(action: {
|
|
|
+ if state.alarm == nil {
|
|
|
+ state.openCGM()
|
|
|
+ } else {
|
|
|
+ state.showModal(for: .snooze)
|
|
|
+ }
|
|
|
+ }, systemName: "sensor.tag.radiowaves.forward.fill")
|
|
|
|
|
|
- menuElements(action: { state.showModal(for: .addTempTarget) }, systemName: "target", title: "Temp targets")
|
|
|
+ menuSymbols(action: { state.showModal(for: .addTempTarget) }, systemName: "target")
|
|
|
|
|
|
- menuElements(action: { state.showModal(for: .settings) }, systemName: "gear", title: "Settings")
|
|
|
+ menuSymbols(action: { state.showModal(for: .settings) }, systemName: "gear")
|
|
|
|
|
|
- Spacer()
|
|
|
- }.padding(.trailing, 70)
|
|
|
- .frame(width: UIScreen.main.bounds.width / 1.2, height: UIScreen.main.bounds.height - 20)
|
|
|
- .overlay {
|
|
|
- RoundedRectangle(cornerRadius: 8).stroke(Color.primary.opacity(0.2), lineWidth: 2).shadow(radius: 3)
|
|
|
- .ignoresSafeArea(edges: .all)
|
|
|
+ Spacer()
|
|
|
+ })
|
|
|
+ VStack(alignment: .leading, spacing: 25, content: {
|
|
|
+ menuElements(action: { state.showModal(for: .statistics) }, title: "Statistics")
|
|
|
+ .padding(.top, 20)
|
|
|
+
|
|
|
+ menuElements(action: {
|
|
|
+ if state.pumpDisplayState != nil {
|
|
|
+ state.setupPump = true
|
|
|
+ }
|
|
|
+ }, title: "Pump Settings")
|
|
|
+
|
|
|
+ menuElements(action: {
|
|
|
+ if state.alarm == nil {
|
|
|
+ state.openCGM()
|
|
|
+ } else {
|
|
|
+ state.showModal(for: .snooze)
|
|
|
+ }
|
|
|
+ }, title: "CGM")
|
|
|
+
|
|
|
+ menuElements(action: { state.showModal(for: .addTempTarget) }, title: "Temp targets")
|
|
|
+
|
|
|
+ menuElements(action: { state.showModal(for: .settings) }, title: "Settings")
|
|
|
+
|
|
|
+ Spacer()
|
|
|
+ })
|
|
|
}
|
|
|
+ }
|
|
|
+ .padding(.horizontal, 25)
|
|
|
+ .frame(width: UIScreen.main.bounds.width / 1.2, height: UIScreen.main.bounds.height - 20)
|
|
|
+ .overlay {
|
|
|
+ RoundedRectangle(cornerRadius: 8).stroke(Color.primary.opacity(0.2), lineWidth: 2).shadow(radius: 3)
|
|
|
+ .ignoresSafeArea(edges: .all)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@ViewBuilder func mainView() -> some View {
|
|
|
@@ -876,6 +924,7 @@ extension Home {
|
|
|
// tabbar
|
|
|
}
|
|
|
.background(color)
|
|
|
+ .blur(radius: isMenuPresented ? 5 : 0)
|
|
|
.edgesIgnoringSafeArea(.all)
|
|
|
}
|
|
|
.onChange(of: state.hours) { _ in
|