diff options
Diffstat (limited to 'Hotline/Views/MessageBoardView.swift')
| -rw-r--r-- | Hotline/Views/MessageBoardView.swift | 42 |
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()) +} |