From b1a176ba3da2c7cf815084f0f8109008fe763809 Mon Sep 17 00:00:00 2001 From: Dustin Mierau Date: Mon, 4 Dec 2023 14:31:12 -0800 Subject: Starting to get app views displaying data (roughly) --- Hotline/Views/FilesView.swift | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Hotline/Views/FilesView.swift (limited to 'Hotline/Views/FilesView.swift') 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()) +} -- cgit