NightscoutImportResultView.swift 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import SwiftUI
  2. struct NightscoutImportResultView: View {
  3. @ObservedObject var state: NightscoutConfig.StateModel
  4. @State private var shouldDisplayHint: Bool = false
  5. @State var hintDetent = PresentationDetent.large
  6. @State var selectedVerboseHint: String?
  7. @State var hintLabel: String?
  8. @State private var decimalPlaceholder: Decimal = 0.0
  9. @State private var booleanPlaceholder: Bool = false
  10. @Environment(\.colorScheme) var colorScheme
  11. var color: LinearGradient {
  12. colorScheme == .dark ? LinearGradient(
  13. gradient: Gradient(colors: [
  14. Color.bgDarkBlue,
  15. Color.bgDarkerDarkBlue
  16. ]),
  17. startPoint: .top,
  18. endPoint: .bottom
  19. )
  20. :
  21. LinearGradient(
  22. gradient: Gradient(colors: [Color.gray.opacity(0.1)]),
  23. startPoint: .top,
  24. endPoint: .bottom
  25. )
  26. }
  27. var body: some View {
  28. NavigationStack {
  29. VStack(alignment: .leading, spacing: 10) {
  30. Text(
  31. "Trio has successfully imported your default Nightscout profile and applied it as therapy settings. This has replaced your previous therapy settings."
  32. )
  33. Text("Please review the following settings")
  34. Navigation
  35. // Text("• Basal Rates")
  36. // Text("• Insulin Sensitivities")
  37. // Text("• Carb Ratios")
  38. // Text("• Glucose Targets")
  39. // Text("• Duration of Insulin Action (DIA)")
  40. Spacer()
  41. Button {
  42. Task {
  43. await state.importSettings()
  44. }
  45. } label: {
  46. Text("Start Import")
  47. .font(.title3)
  48. .frame(maxWidth: .infinity, alignment: .center)
  49. }
  50. .buttonStyle(.borderedProminent)
  51. .disabled(state.url.isEmpty || state.connecting || state.backfilling)
  52. Spacer()
  53. }.padding()
  54. .toolbar(content: {
  55. ToolbarItem(placement: .topBarLeading) {
  56. Button(action: { state.isProfileImportPresented = false }, label: {
  57. Text("Cancel")
  58. })
  59. }
  60. })
  61. .navigationTitle("Nightscout Import")
  62. .navigationBarTitleDisplayMode(.automatic)
  63. .scrollContentBackground(.hidden).background(color)
  64. }
  65. }
  66. }