summaryrefslogtreecommitdiff
path: root/Jel/Views/ContentView.swift
blob: 91d5c7c46b6d16457a9bdbf9aa3c857b2f7e4a75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
//  ContentView.swift
//  Jel
//
//  Created by zerocool on 12/11/23.
//

import SwiftUI
import PulseUI

struct ContentView: View {
  @ObservedObject var authState: AuthStateController
  
  @State var showingConsoleSheet: Bool = false
  var body: some View {
    VStack {
      Button {
        showingConsoleSheet.toggle()
      } label: {
        Label("Console", systemImage: "network")
      }
      .sheet(isPresented: $showingConsoleSheet) {
        ConsoleSheetView(showingConsoleSheet: $showingConsoleSheet)
      }
      
      if !authState.loggedIn {
        SignInView(authState: authState)
      } else {
        Text("Logged in")
        Button("Log out") {
          authState.loggedIn = false
          authState.save()
        }
      }
    }
    .padding()
  }
}

#Preview {
  ContentView(authState: AuthStateController())
}