diff options
| author | Dustin Mierau <dustin@mierau.me> | 2023-12-11 23:32:28 -0800 |
|---|---|---|
| committer | Dustin Mierau <dustin@mierau.me> | 2023-12-11 23:32:28 -0800 |
| commit | 18c4b8643df09be4ce52a4b110ea21ac1ad053fc (patch) | |
| tree | 335d4f0a6b430b983b6f00567b91eb1ee6b16b4b /Hotline/Views/UsersView.swift | |
| parent | 84aaa9ef0a1be6986e38d7e4f58e07d3cb84979e (diff) | |
Move to new Hotline model for data observation and let client exist standalone.
Diffstat (limited to 'Hotline/Views/UsersView.swift')
| -rw-r--r-- | Hotline/Views/UsersView.swift | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Hotline/Views/UsersView.swift b/Hotline/Views/UsersView.swift new file mode 100644 index 0000000..0397ef7 --- /dev/null +++ b/Hotline/Views/UsersView.swift @@ -0,0 +1,41 @@ +import SwiftUI + +struct UsersView: View { + @Environment(Hotline.self) private var model: Hotline + + var body: some View { + NavigationStack { + List(model.users) { u in + Text("🤖 \(u.name)") + .fontWeight(.medium) + .lineLimit(1) + .truncationMode(.tail) + .foregroundStyle(u.status.contains(.admin) ? Color(hex: 0xE10000) : Color.accentColor) + .opacity(u.status.contains(.idle) ? 0.5 : 1.0) + } +// .listStyle(.grouped) + .navigationBarTitleDisplayMode(.inline) + .toolbar { + ToolbarItem(placement: .principal) { + Text(model.server?.name ?? "") + .font(.headline) + } + ToolbarItem(placement: .navigationBarLeading) { + Button { + model.disconnect() + } label: { + Text(Image(systemName: "xmark.circle.fill")) + .symbolRenderingMode(.hierarchical) + .font(.title2) + .foregroundColor(.secondary) + } + } + } + } + } +} + +#Preview { + ChatView() + .environment(Hotline(trackerClient: HotlineTrackerClient(), client: HotlineNewClient())) +} |