diff options
| author | Dustin Mierau <dustin@mierau.me> | 2023-12-06 13:52:20 -0800 |
|---|---|---|
| committer | Dustin Mierau <dustin@mierau.me> | 2023-12-06 13:52:20 -0800 |
| commit | c0068f11c51bb587c16dfacb73629b3c6fb67fc8 (patch) | |
| tree | 20753433f348b03bb590e0fe6a4cafbe56f4c859 /Hotline/Views/MessageBoardView.swift | |
| parent | 06a2166415bca7e5fe32eac505859bdd690ab8e0 (diff) | |
Further work on UI organization
Diffstat (limited to 'Hotline/Views/MessageBoardView.swift')
| -rw-r--r-- | Hotline/Views/MessageBoardView.swift | 72 |
1 files changed, 47 insertions, 25 deletions
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() - } + } } |