From c0068f11c51bb587c16dfacb73629b3c6fb67fc8 Mon Sep 17 00:00:00 2001 From: Dustin Mierau Date: Wed, 6 Dec 2023 13:52:20 -0800 Subject: Further work on UI organization --- Hotline/Views/MessageBoardView.swift | 72 +++++++++++++++++++++++------------- 1 file changed, 47 insertions(+), 25 deletions(-) (limited to 'Hotline/Views/MessageBoardView.swift') diff --git a/Hotline/Views/MessageBoardView.swift b/Hotline/Views/MessageBoardView.swift index 8b1a30c..35b4282 100644 --- a/Hotline/Views/MessageBoardView.swift +++ b/Hotline/Views/MessageBoardView.swift @@ -8,36 +8,58 @@ struct MessageBoardView: View { var body: some View { // @Bindable var config = appState - - ScrollView { - LazyVStack(alignment: .leading) { - ForEach(hotline.messageBoardMessages, id: \.self) { - Text($0) - .lineLimit(100) - .padding() - Divider() + NavigationStack { + ScrollView { + LazyVStack(alignment: .leading) { + ForEach(hotline.messageBoardMessages, id: \.self) { + Text($0) + .lineLimit(100) + .padding() + .textSelection(.enabled) + Divider() + } } + Spacer() } - } -// List(hotline.messageBoardMessages, id: \.self) { -// Text($0) -// .lineLimit(100) -// .padding() -// Divider() -// .listRowSeparator(.hidden) -// .listRowInsets(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0)) -// } -// .listStyle(.plain) - .task { - if !fetched { - hotline.sendGetNews() { - fetched = true + .task { + if !fetched { + hotline.sendGetMessageBoard() { + fetched = true + } + } + } + .refreshable { + hotline.sendGetMessageBoard() + } + .navigationBarTitleDisplayMode(.inline) + .toolbar { + ToolbarItem(placement: .principal) { + Text(hotline.server?.name ?? "") + .font(.headline) + } + ToolbarItem(placement: .navigationBarLeading) { + Button { + hotline.disconnect() + } label: { + Image(systemName: "xmark.circle.fill") + .symbolRenderingMode(.hierarchical) + .foregroundColor(.secondary) + } + + } + ToolbarItem(placement: .navigationBarTrailing) { + Button { + + } label: { + Image(systemName: "square.and.pencil") +// .symbolRenderingMode(.hierarchical) +// .foregroundColor(.secondary) + } + } } } - .refreshable { - hotline.sendGetNews() - } + } } -- cgit