|
|
@@ -390,112 +390,6 @@ extension Home {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// @ViewBuilder private func bottomPanel(_: GeometryProxy) -> some View {
|
|
|
-// let colorIcon: Color = (colorScheme == .dark ? Color.white : Color.black).opacity(0.9)
|
|
|
-//
|
|
|
-// ZStack {
|
|
|
-// Rectangle()
|
|
|
-// .fill(Color("Chart"))
|
|
|
-// .frame(height: UIScreen.main.bounds.height / 13)
|
|
|
-// .cornerRadius(15)
|
|
|
-// .shadow(
|
|
|
-// color: colorScheme == .dark ? Color(red: 0.02745098039, green: 0.1098039216, blue: 0.1411764706) : Color
|
|
|
-// .black.opacity(0.33),
|
|
|
-// radius: 3
|
|
|
-// )
|
|
|
-// .padding([.leading, .trailing], 10)
|
|
|
-//
|
|
|
-// HStack {
|
|
|
-// Button {
|
|
|
-// state.showModal(for: .dataTable)
|
|
|
-// }
|
|
|
-// label: {
|
|
|
-// if #available(iOS 17.0, *) {
|
|
|
-// Image(systemName: "book.pages")
|
|
|
-// .font(.system(size: 24))
|
|
|
-// .foregroundColor(colorIcon)
|
|
|
-// .padding(8)
|
|
|
-// } else {
|
|
|
-// Image(systemName: "book")
|
|
|
-// .font(.system(size: 24))
|
|
|
-// .foregroundColor(colorIcon)
|
|
|
-// .padding(8)
|
|
|
-// }
|
|
|
-// }
|
|
|
-// .foregroundColor(colorIcon)
|
|
|
-// .buttonStyle(.borderless)
|
|
|
-// Spacer()
|
|
|
-// Button { state.showModal(for: .addCarbs(editMode: false, override: false)) }
|
|
|
-// label: {
|
|
|
-// ZStack(alignment: Alignment(horizontal: .trailing, vertical: .bottom)) {
|
|
|
-// Image(systemName: "fork.knife")
|
|
|
-// .font(.system(size: 24))
|
|
|
-// .foregroundColor(colorIcon)
|
|
|
-// .padding(8)
|
|
|
-// if let carbsReq = state.carbsRequired {
|
|
|
-// Text(numberFormatter.string(from: carbsReq as NSNumber)!)
|
|
|
-// .font(.caption)
|
|
|
-// .foregroundColor(.white)
|
|
|
-// .padding(4)
|
|
|
-// .background(Capsule().fill(Color.red))
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }.buttonStyle(.borderless)
|
|
|
-// Spacer()
|
|
|
-// Button {
|
|
|
-// state.showModal(for: .bolus(
|
|
|
-// waitForSuggestion: true,
|
|
|
-// fetch: false
|
|
|
-// ))
|
|
|
-// }
|
|
|
-// label: {
|
|
|
-// Image(systemName: "syringe.fill")
|
|
|
-// .font(.system(size: 24))
|
|
|
-// .foregroundColor(colorIcon)
|
|
|
-// .padding(8)
|
|
|
-// }
|
|
|
-// .foregroundColor(colorIcon)
|
|
|
-// .buttonStyle(.borderless)
|
|
|
-// Spacer()
|
|
|
-// if state.allowManualTemp {
|
|
|
-// Button { state.showModal(for: .manualTempBasal) }
|
|
|
-// label: {
|
|
|
-// Image("bolus1")
|
|
|
-// .renderingMode(.template)
|
|
|
-// .resizable()
|
|
|
-// .frame(width: 24, height: 24)
|
|
|
-// .padding(8)
|
|
|
-// }
|
|
|
-// .foregroundColor(colorIcon)
|
|
|
-// .buttonStyle(.borderless)
|
|
|
-// Spacer()
|
|
|
-// }
|
|
|
-// let isOverrideActive = fetchedPercent.first?.enabled ?? false
|
|
|
-// Button {
|
|
|
-// state.showModal(for: .overrideProfilesConfig)
|
|
|
-// } label: {
|
|
|
-// Image(systemName: (state.isTempTargetActive || isOverrideActive) ? "person.fill" : "person")
|
|
|
-// .font(.system(size: 26))
|
|
|
-// .padding(8)
|
|
|
-// }
|
|
|
-// .foregroundColor((state.isTempTargetActive || isOverrideActive) ? Color.purple : colorIcon)
|
|
|
-// .buttonStyle(.borderless)
|
|
|
-// Spacer()
|
|
|
-// Button {
|
|
|
-// state.showModal(for: .settings)
|
|
|
-// } label: {
|
|
|
-// Image(systemName: "gear")
|
|
|
-// .font(.system(size: 26))
|
|
|
-// .padding(8)
|
|
|
-// }
|
|
|
-// .foregroundColor(colorIcon)
|
|
|
-// .buttonStyle(.borderless)
|
|
|
-// }
|
|
|
-// .padding(.horizontal, 24)
|
|
|
-// .padding(.bottom, 16)
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
@ViewBuilder func bolusProgressBar(_ progress: Decimal) -> some View {
|
|
|
GeometryReader { geo in
|
|
|
Rectangle()
|
|
|
@@ -564,7 +458,7 @@ extension Home {
|
|
|
Color.black.opacity(0.33),
|
|
|
radius: 3
|
|
|
)
|
|
|
- .frame(height: 62, alignment: .center)
|
|
|
+ .frame(height: UIScreen.main.bounds.height / 25, alignment: .center)
|
|
|
.padding(.horizontal, 10)
|
|
|
.offset(y: -90)
|
|
|
}
|
|
|
@@ -679,45 +573,55 @@ extension Home {
|
|
|
"Chart"
|
|
|
) : .white
|
|
|
|
|
|
- if let overrideString = overrideString {
|
|
|
- ZStack {
|
|
|
- /// rectangle as background
|
|
|
- RoundedRectangle(cornerRadius: 15)
|
|
|
- .fill(colourChart)
|
|
|
- .clipShape(RoundedRectangle(cornerRadius: 15))
|
|
|
- .frame(height: UIScreen.main.bounds.height / 20)
|
|
|
- .shadow(
|
|
|
- color: colorScheme == .dark ? Color(red: 0.02745098039, green: 0.1098039216, blue: 0.1411764706) :
|
|
|
- Color.black.opacity(0.33),
|
|
|
- radius: 3
|
|
|
- )
|
|
|
- HStack {
|
|
|
- /// actual profile view
|
|
|
- Image(systemName: "person.fill")
|
|
|
- .font(.system(size: 20))
|
|
|
- .foregroundStyle(Color.purple)
|
|
|
- Spacer()
|
|
|
+ ZStack {
|
|
|
+ /// rectangle as background
|
|
|
+ RoundedRectangle(cornerRadius: 15)
|
|
|
+ .fill(Color.insulin.opacity(0.1))
|
|
|
+ .clipShape(RoundedRectangle(cornerRadius: 15))
|
|
|
+ .frame(height: UIScreen.main.bounds.height / 25)
|
|
|
+ .shadow(
|
|
|
+ color: colorScheme == .dark ? Color(red: 0.02745098039, green: 0.1098039216, blue: 0.1411764706) :
|
|
|
+ Color.black.opacity(0.33),
|
|
|
+ radius: 3
|
|
|
+ )
|
|
|
+ HStack {
|
|
|
+ /// actual profile view
|
|
|
+ Image(systemName: "person")
|
|
|
+ .font(.system(size: 20))
|
|
|
+ Spacer()
|
|
|
+
|
|
|
+ if let overrideString = overrideString {
|
|
|
Text(overrideString)
|
|
|
.font(.system(size: 18))
|
|
|
Spacer()
|
|
|
Image(systemName: "xmark.app")
|
|
|
.font(.system(size: 20))
|
|
|
- }.padding(.horizontal, 10)
|
|
|
- .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.") }
|
|
|
- )
|
|
|
- .padding(.trailing, 8)
|
|
|
- .onTapGesture {
|
|
|
- showCancelAlert = true
|
|
|
+ } else {
|
|
|
+ if tempTargetString == nil {
|
|
|
+ Text("100 %")
|
|
|
+ .font(.system(size: 18))
|
|
|
+ Spacer()
|
|
|
+ /// to ensure the same position....
|
|
|
+ Image(systemName: "xmark.app")
|
|
|
+ .font(.system(size: 20))
|
|
|
+ .foregroundStyle(Color.clear)
|
|
|
}
|
|
|
- }.padding(.horizontal, 10).padding(.bottom, 10)
|
|
|
- }
|
|
|
+ }
|
|
|
+ }.padding(.horizontal, 10)
|
|
|
+ .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.") }
|
|
|
+ )
|
|
|
+ .padding(.trailing, 8)
|
|
|
+ .onTapGesture {
|
|
|
+ showCancelAlert = true
|
|
|
+ }
|
|
|
+ }.padding(.horizontal, 10).padding(.bottom, 10)
|
|
|
|
|
|
/// just show temp target if no profile is already active
|
|
|
if overrideString == nil, let tempTargetString = tempTargetString {
|
|
|
@@ -853,7 +757,7 @@ extension Home {
|
|
|
|
|
|
@ViewBuilder func mainView() -> some View {
|
|
|
GeometryReader { geo in
|
|
|
- ZStack(alignment: .trailing) {
|
|
|
+ ZStack(alignment: .bottom) {
|
|
|
VStack(spacing: 0) {
|
|
|
Spacer()
|
|
|
|
|
|
@@ -884,15 +788,9 @@ extension Home {
|
|
|
}.padding(.trailing, 20).padding(.bottom, 110)
|
|
|
}
|
|
|
|
|
|
- }.padding(.top, 40)
|
|
|
-
|
|
|
- Spacer()
|
|
|
-
|
|
|
- mealPanel(geo)
|
|
|
+ }.padding(.top, 10)
|
|
|
|
|
|
- Spacer()
|
|
|
-
|
|
|
- profileView(geo)
|
|
|
+ mealPanel(geo).padding(.top, 30).padding(.bottom, 20)
|
|
|
|
|
|
RoundedRectangle(cornerRadius: 15)
|
|
|
.fill(Color("Chart"))
|
|
|
@@ -904,17 +802,17 @@ extension Home {
|
|
|
radius: 3
|
|
|
)
|
|
|
.padding(.horizontal, 10)
|
|
|
- .frame(maxHeight: UIScreen.main.bounds.height / 2.1)
|
|
|
-
|
|
|
- Spacer()
|
|
|
+ .frame(maxHeight: UIScreen.main.bounds.height / 2.2)
|
|
|
|
|
|
- timeInterval.padding(.bottom, 70)
|
|
|
+ timeInterval.padding(.top, 20).padding(.bottom, 90)
|
|
|
|
|
|
Spacer()
|
|
|
+ }
|
|
|
|
|
|
- if let progress = state.bolusProgress {
|
|
|
- bolusProgressView(geo, progress)
|
|
|
- }
|
|
|
+ if let progress = state.bolusProgress {
|
|
|
+ bolusProgressView(geo, progress).padding(.bottom, 20)
|
|
|
+ } else {
|
|
|
+ profileView(geo).padding(.bottom, 80)
|
|
|
}
|
|
|
}
|
|
|
.background(color)
|