aboutsummaryrefslogtreecommitdiff
path: root/Hotline/Views/FilesView.swift
diff options
context:
space:
mode:
Diffstat (limited to 'Hotline/Views/FilesView.swift')
-rw-r--r--Hotline/Views/FilesView.swift32
1 files changed, 32 insertions, 0 deletions
diff --git a/Hotline/Views/FilesView.swift b/Hotline/Views/FilesView.swift
new file mode 100644
index 0000000..0e1bb91
--- /dev/null
+++ b/Hotline/Views/FilesView.swift
@@ -0,0 +1,32 @@
+import SwiftUI
+
+struct FilesView: View {
+ @Environment(HotlineClient.self) private var hotline
+
+ @State private var fetched = false
+
+ var body: some View {
+ ScrollView {
+ VStack(spacing: 0) {
+ List(hotline.userList) { u in
+ HStack(alignment: .firstTextBaseline) {
+ Text(u.name).bold().foregroundStyle(u.isAdmin ? Color.red : Color.black)
+ }
+ }
+ .padding()
+ }
+ }
+ .task {
+ if !fetched {
+ hotline.sendGetFileList() {
+ fetched = true
+ }
+ }
+ }
+ }
+}
+
+#Preview {
+ FilesView()
+ .environment(HotlineClient())
+}