From 4fd69c02a3e7b581bb9229865336c315153f3b18 Mon Sep 17 00:00:00 2001 From: Dustin Mierau Date: Tue, 19 Dec 2023 20:38:13 -0800 Subject: Beginnings of a UI for macOS as well as some visual changes to iOS client. :) --- Hotline/macOS/MessageBoardView.swift | 55 ++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 Hotline/macOS/MessageBoardView.swift (limited to 'Hotline/macOS/MessageBoardView.swift') 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())) +} -- cgit