| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- import SwiftUI
- extension Home {
- struct RootView: BaseView {
- @EnvironmentObject var viewModel: ViewModel<Provider>
- var body: some View {
- GeometryReader { geo in
- VStack {
- Group {
- Text("Header")
- }
- ScrollView(.vertical, showsIndicators: false) {
- GlucoseChartView(glucose: $viewModel.glucose, suggestion: $viewModel.suggestion).frame(height: 150)
- if let reason = viewModel.suggestion?.reason {
- Text(reason).font(.caption).padding()
- }
- Button(action: viewModel.runLoop) {
- Text("Run loop now").buttonBackground().padding()
- }.foregroundColor(.white)
- }
- ZStack {
- Rectangle().fill(Color.gray.opacity(0.2)).frame(height: 50 + geo.safeAreaInsets.bottom)
- HStack {
- Button { viewModel.showModal(for: .addCarbs) }
- label: {
- Image(systemName: "circlebadge.2.fill")
- }.foregroundColor(.green)
- Spacer()
- Button { viewModel.showModal(for: .addTempTarget) }
- label: {
- Image(systemName: "target")
- }.foregroundColor(.green)
- Spacer()
- Button { viewModel.showModal(for: .bolus) }
- label: {
- Image(systemName: "drop.fill")
- }.foregroundColor(.orange)
- Spacer()
- Button { viewModel.showModal(for: .manualTempBasal) }
- label: {
- Image(systemName: "circle.bottomhalf.fill")
- }.foregroundColor(.blue)
- Spacer()
- Button { viewModel.showModal(for: .settings) }
- label: {
- Image(systemName: "gearshape")
- }.foregroundColor(.gray)
- }
- .padding(.horizontal, 24)
- .padding(.bottom, geo.safeAreaInsets.bottom)
- }
- }
- .edgesIgnoringSafeArea(.bottom)
- }
- .navigationTitle("Home")
- .navigationBarHidden(true)
- }
- }
- }
|