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/MessageBoardView.swift | 42 ++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Hotline/Views/MessageBoardView.swift (limited to 'Hotline/Views/MessageBoardView.swift') diff --git a/Hotline/Views/MessageBoardView.swift b/Hotline/Views/MessageBoardView.swift new file mode 100644 index 0000000..e5f1521 --- /dev/null +++ b/Hotline/Views/MessageBoardView.swift @@ -0,0 +1,42 @@ +import SwiftUI + +struct MessageBoardView: View { + @Environment(HotlineState.self) private var appState + @Environment(HotlineClient.self) private var hotline + + @State private var fetched = false + + var body: some View { +// @Bindable var config = appState + + VStack(alignment: .leading) { + ScrollView { + VStack(alignment: .leading) { + Text(hotline.messageBoard) + .fontDesign(.monospaced) + .padding() + .dynamicTypeSize(.small) + .textSelection(.enabled) + } + } + } + .presentationDetents([.fraction(0.6)]) + .presentationDragIndicator(.visible) + .task { + if !fetched { + hotline.sendGetNews() { + fetched = true + } + } + } + .refreshable { + hotline.sendGetNews() + } + } +} + +#Preview { + MessageBoardView() + .environment(HotlineState()) + .environment(HotlineClient()) +} -- cgit