aboutsummaryrefslogtreecommitdiff
path: root/Hotline/Views/MessageBoardView.swift
diff options
context:
space:
mode:
authorDustin Mierau <dustin@mierau.me>2023-12-04 14:31:12 -0800
committerDustin Mierau <dustin@mierau.me>2023-12-04 14:31:12 -0800
commitb1a176ba3da2c7cf815084f0f8109008fe763809 (patch)
tree5bbf52900d5dab9091216cc0f1e5dc84ad69cc9f /Hotline/Views/MessageBoardView.swift
parent471546236b8991f61d26c0e3aa8ee48b83b983af (diff)
Starting to get app views displaying data (roughly)
Diffstat (limited to 'Hotline/Views/MessageBoardView.swift')
-rw-r--r--Hotline/Views/MessageBoardView.swift42
1 files changed, 42 insertions, 0 deletions
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())
+}