diff options
| author | Dustin Mierau <dustin@mierau.me> | 2023-12-04 14:31:12 -0800 |
|---|---|---|
| committer | Dustin Mierau <dustin@mierau.me> | 2023-12-04 14:31:12 -0800 |
| commit | b1a176ba3da2c7cf815084f0f8109008fe763809 (patch) | |
| tree | 5bbf52900d5dab9091216cc0f1e5dc84ad69cc9f /Hotline/Views/FilesView.swift | |
| parent | 471546236b8991f61d26c0e3aa8ee48b83b983af (diff) | |
Starting to get app views displaying data (roughly)
Diffstat (limited to 'Hotline/Views/FilesView.swift')
| -rw-r--r-- | Hotline/Views/FilesView.swift | 32 |
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()) +} |