diff options
| author | Dustin Mierau <dustin@mierau.me> | 2023-12-19 20:38:13 -0800 |
|---|---|---|
| committer | Dustin Mierau <dustin@mierau.me> | 2023-12-19 20:38:13 -0800 |
| commit | 4fd69c02a3e7b581bb9229865336c315153f3b18 (patch) | |
| tree | e6e11d872424196f2b4033077902126ad5556e40 /Hotline/iOS/UsersView.swift | |
| parent | 5e87b5927cd931d46fb5f72fb035480a95969a9f (diff) | |
Beginnings of a UI for macOS as well as some visual changes to iOS client. :)
Diffstat (limited to 'Hotline/iOS/UsersView.swift')
| -rw-r--r-- | Hotline/iOS/UsersView.swift | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Hotline/iOS/UsersView.swift b/Hotline/iOS/UsersView.swift new file mode 100644 index 0000000..d1f3318 --- /dev/null +++ b/Hotline/iOS/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) + } + .scrollBounceBehavior(.basedOnSize) + .navigationBarTitleDisplayMode(.inline) + .toolbar { + ToolbarItem(placement: .principal) { + Text(model.serverTitle) + .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: HotlineClient())) +} |