aboutsummaryrefslogtreecommitdiff
path: root/Hotline/Views/ServerView.swift
blob: 0dafbce5eb625d7c8cb827dc57d5c3f7b1220c9e (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import SwiftUI

struct ServerView: View {
  @Environment(HotlineState.self) private var appState
  @Environment(HotlineClient.self) private var hotline
  @Environment(HotlineTrackerClient.self) private var tracker
    
  var body: some View {
    @Bindable var config = appState
    
    TabView {
      NavigationView {
        ChatView()
          .navigationTitle(hotline.server?.name ?? "Hotline")
          .navigationBarTitleDisplayMode(.inline)
          .navigationBarItems(
            leading: Button(action: {
              appState.presentTracker()
            }) {
              Image(systemName: "globe.americas.fill") // Hamburger icon or similar
                .imageScale(.large)
            }
          )
//          .toolbarBackground(.visible, for: .navigationBar)
//          .toolbarBackground(.red, for: .navigationBar)
      }
      .tabItem {
        Image(systemName: "message")
      }
      
      NavigationView {
        UserListView()
          .navigationTitle("User List")
          .navigationBarTitleDisplayMode(.inline)
      }
      .tabItem {
        Image(systemName: "person.fill")
      }
      
      Text("News")
        .tabItem {
          Image(systemName: "newspaper")
        }
      
      NavigationView {
        MessageBoardView()
          .navigationTitle("Message Board")
          .navigationBarTitleDisplayMode(.inline)
      }
      .tabItem {
        Image(systemName: "pin")
      }
      
      NavigationView {
        FilesView()
          .navigationTitle("Files")
          .navigationBarTitleDisplayMode(.inline)
      }
      .tabItem {
        Image(systemName: "folder")
      }
    }
//      .sheet(isPresented: Binding(get: { hotline.connectionStatus != .loggedIn }, set: { _ in })) {
//        TrackerView()
//      }
  }
}

#Preview {
  ServerView()
    .environment(HotlineClient())
    .environment(HotlineTrackerClient(tracker: HotlineTracker("hltracker.com")))
}