blob: cae1d0cc79615484f47171bf3b2dcae9987d3c43 (
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
|
import SwiftUI
struct UserListView: View {
@Environment(HotlineClient.self) private var hotline
var body: some View {
NavigationStack {
VStack(spacing: 0) {
List(hotline.userList) { u in
HStack(alignment: .firstTextBaseline) {
Text(u.name).bold().foregroundStyle(u.isAdmin ? Color.red : Color.black).opacity(u.isIdle ? 0.5 : 1.0)
}
}
.listStyle(.plain)
.padding()
}
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .principal) {
Text(hotline.server?.name ?? "")
.font(.headline)
}
ToolbarItem(placement: .navigationBarLeading) {
Button {
hotline.disconnect()
} label: {
Image(systemName: "xmark.circle.fill")
.symbolRenderingMode(.hierarchical)
.foregroundColor(.secondary)
}
}
}
}
}
}
#Preview {
ChatView()
.environment(HotlineClient())
}
|