aboutsummaryrefslogtreecommitdiff
path: root/Hotline/macOS/HotlinePanelView.swift
diff options
context:
space:
mode:
authorDustin Mierau <dustin@mierau.me>2024-05-01 21:22:18 -0700
committerDustin Mierau <dustin@mierau.me>2024-05-01 21:32:15 -0700
commit60a3f2d29dfff945f59787f5a7786c6e78ba7bb9 (patch)
treee3d0aa6ae541790ea700353b0ac01fe8b4950f9f /Hotline/macOS/HotlinePanelView.swift
parentb9529a0d255ad41c62a4e3b93a47ebb5bb82a565 (diff)
New Hotline toolbar window for banner.
Diffstat (limited to 'Hotline/macOS/HotlinePanelView.swift')
-rw-r--r--Hotline/macOS/HotlinePanelView.swift116
1 files changed, 116 insertions, 0 deletions
diff --git a/Hotline/macOS/HotlinePanelView.swift b/Hotline/macOS/HotlinePanelView.swift
new file mode 100644
index 0000000..36204a7
--- /dev/null
+++ b/Hotline/macOS/HotlinePanelView.swift
@@ -0,0 +1,116 @@
+import SwiftUI
+
+struct HotlinePanelView: View {
+ @Environment(\.openWindow) var openWindow
+ @Environment(\.colorScheme) var colorScheme
+
+ @FocusedValue(\.activeHotlineModel) private var activeHotline: Hotline?
+ @FocusedValue(\.activeServerState) private var activeServerState: ServerState?
+
+ var body: some View {
+ VStack {
+ Image(nsImage: ApplicationState.shared.activeServerBanner ?? NSImage(named: "Default Banner")!)
+ .interpolation(.high)
+ .resizable()
+ .scaledToFit()
+ .frame(width: 468, height: 60)
+ .clipShape(RoundedRectangle(cornerRadius: 6.0))
+ .padding([.top, .leading, .trailing], 4)
+
+ HStack(spacing: 16) {
+ Button {
+ openWindow(id: "servers")
+ }
+ label: {
+ Image(systemName: "globe.americas.fill")
+ .resizable()
+ .scaledToFit()
+ }
+ .buttonStyle(.plain)
+ .frame(width: 18, height: 18)
+ .help("Hotline Servers")
+
+ Button {
+ ApplicationState.shared.activeServerState?.selection = .chat
+ }
+ label: {
+ Image(systemName: "bubble.fill")
+ .resizable()
+ .scaledToFit()
+ }
+ .buttonStyle(.plain)
+ .frame(width: 18, height: 18)
+ .opacity(ApplicationState.shared.activeServerState == nil ? 0.5 : 1.0)
+ .disabled(ApplicationState.shared.activeServerState == nil)
+ .help("Public Chat")
+
+ Button {
+ ApplicationState.shared.activeServerState?.selection = .news
+ }
+ label: {
+ Image(systemName: "newspaper.fill")
+ .resizable()
+ .scaledToFit()
+ }
+ .buttonStyle(.plain)
+ .frame(width: 18, height: 18)
+ .opacity(ApplicationState.shared.activeServerState == nil ? 0.5 : 1.0)
+ .disabled(ApplicationState.shared.activeServerState == nil)
+ .help("News")
+
+ Button {
+ ApplicationState.shared.activeServerState?.selection = .board
+ }
+ label: {
+ Image(systemName: "pin.fill")
+ .resizable()
+ .scaledToFit()
+ }
+ .buttonStyle(.plain)
+ .frame(width: 18, height: 18)
+ .opacity(ApplicationState.shared.activeServerState == nil ? 0.5 : 1.0)
+ .disabled(ApplicationState.shared.activeServerState == nil)
+ .help("Message Board")
+
+ Button {
+ ApplicationState.shared.activeServerState?.selection = .files
+ }
+ label: {
+ Image(systemName: "folder.fill")
+ .resizable()
+ .scaledToFit()
+ }
+ .buttonStyle(.plain)
+ .frame(width: 18, height: 18)
+ .opacity(ApplicationState.shared.activeServerState == nil ? 0.5 : 1.0)
+ .disabled(ApplicationState.shared.activeServerState == nil)
+ .help("Files")
+
+ Spacer()
+
+ SettingsLink(label: {
+ Image(systemName: "gearshape.fill")
+ .resizable()
+ .scaledToFit()
+ })
+ .buttonStyle(.plain)
+ .frame(width: 18, height: 18)
+ .help("Settings")
+ }
+ .padding(.top, 8)
+ .padding(.bottom, 16)
+ .padding([.leading, .trailing], 16)
+ }
+// .frame(width: 468)
+// .background(colorScheme == .dark ? .black : .white)
+ .background(
+ VisualEffectView(material: .headerView, blendingMode: .behindWindow)
+ .cornerRadius(10.0)
+ )
+ }
+}
+
+#Preview {
+ HotlinePanelView()
+ .environment(Hotline(trackerClient: HotlineTrackerClient(), client: HotlineClient()))
+}