LoopNightscoutRemoteView.swift 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // LoopNightscoutRemoteView.swift
  3. // LoopFollow
  4. //
  5. // Created by Jonas Björkert on 2025-01-14.
  6. // Copyright © 2025 Jon Fawcett. All rights reserved.
  7. //
  8. import SwiftUI
  9. struct LoopNightscoutRemoteView: View {
  10. @Environment(\.presentationMode) var presentationMode
  11. @ObservedObject var nsAdmin = ObservableUserDefaults.shared.nsWriteAuth
  12. var body: some View {
  13. NavigationView {
  14. if !nsAdmin.value {
  15. ErrorMessageView(
  16. message: "Please update your token to include the 'admin' role in order to do remote commands."
  17. )} else {
  18. VStack {
  19. let columns = [
  20. GridItem(.flexible(), spacing: 16),
  21. GridItem(.flexible(), spacing: 16)
  22. ]
  23. LazyVGrid(columns: columns, spacing: 16) {
  24. CommandButtonView(command: "Overrides", iconName: "slider.horizontal.3", destination: LoopOverrideView())
  25. }
  26. .padding(.horizontal)
  27. Spacer()
  28. }
  29. .navigationBarTitle("Loop Remote Control", displayMode: .inline)
  30. }
  31. }
  32. }
  33. }