aboutsummaryrefslogtreecommitdiff
path: root/Hotline/macOS/MessageBoardView.swift
diff options
context:
space:
mode:
authorDustin Mierau <dustin@mierau.me>2023-12-19 20:38:13 -0800
committerDustin Mierau <dustin@mierau.me>2023-12-19 20:38:13 -0800
commit4fd69c02a3e7b581bb9229865336c315153f3b18 (patch)
treee6e11d872424196f2b4033077902126ad5556e40 /Hotline/macOS/MessageBoardView.swift
parent5e87b5927cd931d46fb5f72fb035480a95969a9f (diff)
Beginnings of a UI for macOS as well as some visual changes to iOS client. :)
Diffstat (limited to 'Hotline/macOS/MessageBoardView.swift')
-rw-r--r--Hotline/macOS/MessageBoardView.swift55
1 files changed, 55 insertions, 0 deletions
diff --git a/Hotline/macOS/MessageBoardView.swift b/Hotline/macOS/MessageBoardView.swift
new file mode 100644
index 0000000..d72b122
--- /dev/null
+++ b/Hotline/macOS/MessageBoardView.swift
@@ -0,0 +1,55 @@
+import SwiftUI
+
+struct MessageBoardView: View {
+ @Environment(Hotline.self) private var model: Hotline
+
+ @State private var initialLoadComplete = false
+
+ var body: some View {
+ NavigationStack {
+ ScrollView {
+ LazyVStack(alignment: .leading) {
+ ForEach(model.messageBoard, id: \.self) {
+ Text($0)
+ .lineLimit(100)
+ .padding()
+ .textSelection(.enabled)
+ Divider()
+ }
+ }
+ Spacer()
+ }
+ .task {
+ if !model.messageBoardLoaded {
+ let _ = await model.getMessageBoard()
+// self.initialLoadComplete = true
+ print("INITIAL LOAD?")
+ }
+ }
+ .overlay {
+ if !model.messageBoardLoaded {
+ VStack {
+ ProgressView()
+ .controlSize(.large)
+ }
+ .frame(maxWidth: .infinity)
+ }
+ }
+ .background(Color(nsColor: .textBackgroundColor))
+ }
+ .toolbar {
+ ToolbarItem(placement:.primaryAction) {
+ Button {
+
+ } label: {
+ Image(systemName: "square.and.pencil")
+ }
+ }
+ }
+ }
+}
+
+#Preview {
+ MessageBoardView()
+ .environment(Hotline(trackerClient: HotlineTrackerClient(), client: HotlineClient()))
+}