aboutsummaryrefslogtreecommitdiff
path: root/Hotline/macOS
diff options
context:
space:
mode:
authorDustin Mierau <dustin@mierau.me>2024-06-30 17:46:30 -0700
committerDustin Mierau <dustin@mierau.me>2024-06-30 17:46:30 -0700
commit038df124a9c9d0ec7e7f3a7387669d5273a5bf49 (patch)
tree47f9c39c14a4b48e83be1c42885d92bd88384d47 /Hotline/macOS
parent3c352f194c7d14cc8a1ee23ec8fb7b834132d9a0 (diff)
A pass on icons. Sleeker toolbar window. Fix Accounts and News menu item disable states. Don't request banner from older servers. Cleanup News list display.
Diffstat (limited to 'Hotline/macOS')
-rw-r--r--Hotline/macOS/FilesView.swift2
-rw-r--r--Hotline/macOS/HotlinePanelView.swift110
-rw-r--r--Hotline/macOS/MessageBoardEditorView.swift10
-rw-r--r--Hotline/macOS/NewsEditorView.swift2
-rw-r--r--Hotline/macOS/NewsItemView.swift55
-rw-r--r--Hotline/macOS/NewsView.swift2
-rw-r--r--Hotline/macOS/ServerView.swift77
7 files changed, 150 insertions, 108 deletions
diff --git a/Hotline/macOS/FilesView.swift b/Hotline/macOS/FilesView.swift
index 7546f2a..2afa1a8 100644
--- a/Hotline/macOS/FilesView.swift
+++ b/Hotline/macOS/FilesView.swift
@@ -75,7 +75,7 @@ struct FileView: View {
.opacity(file.isUnavailable ? 0.5 : 1.0)
if file.isFolder && loading {
- ProgressView().controlSize(.small).padding([.leading, .trailing], 1)
+ ProgressView().controlSize(.small).padding([.leading, .trailing], 5)
}
Spacer()
if !file.isUnavailable {
diff --git a/Hotline/macOS/HotlinePanelView.swift b/Hotline/macOS/HotlinePanelView.swift
index 2d4c253..991946e 100644
--- a/Hotline/macOS/HotlinePanelView.swift
+++ b/Hotline/macOS/HotlinePanelView.swift
@@ -9,12 +9,15 @@ struct HotlinePanelView: View {
Image(nsImage: ApplicationState.shared.activeServerBanner ?? NSImage(named: "Default Banner")!)
.interpolation(.high)
.resizable()
- .scaledToFit()
+ .scaledToFill()
.frame(width: 468, height: 60)
- .clipShape(RoundedRectangle(cornerRadius: 6.0))
- .padding([.top, .leading, .trailing], 4)
+ .frame(minWidth: 468, maxWidth: 468, minHeight: 60, maxHeight: 60)
+ .clipped()
+ .background(.black)
+// .clipShape(RoundedRectangle(cornerRadius: 6.0))
+// .padding([.top, .leading, .trailing], 4)
- HStack(spacing: 16) {
+ HStack(spacing: 10) {
Button {
if NSEvent.modifierFlags.contains(.option) {
openWindow(id: "server")
@@ -24,25 +27,24 @@ struct HotlinePanelView: View {
}
}
label: {
- Image(systemName: "globe.americas.fill")
+ Image("Section Servers")
.resizable()
.scaledToFit()
}
.buttonStyle(.plain)
- .frame(width: 18, height: 18)
+ .frame(width: 20, height: 20)
.help("Hotline Servers")
Button {
ApplicationState.shared.activeServerState?.selection = .chat
}
label: {
- Image(systemName: "bubble.fill")
+ Image("Section Chat")
.resizable()
.scaledToFit()
}
.buttonStyle(.plain)
- .frame(width: 18, height: 18)
- .opacity(ApplicationState.shared.activeServerState == nil ? 0.5 : 1.0)
+ .frame(width: 20, height: 20)
.disabled(ApplicationState.shared.activeServerState == nil)
.help("Public Chat")
@@ -50,72 +52,88 @@ struct HotlinePanelView: View {
ApplicationState.shared.activeServerState?.selection = .board
}
label: {
- Image(systemName: "pin.fill")
+ Image("Section Board")
.resizable()
.scaledToFit()
}
.buttonStyle(.plain)
- .frame(width: 18, height: 18)
- .opacity(ApplicationState.shared.activeServerState == nil ? 0.5 : 1.0)
+ .frame(width: 20, height: 20)
.disabled(ApplicationState.shared.activeServerState == nil)
.help("Message Board")
- Button {
- ApplicationState.shared.activeServerState?.selection = .news
- }
- label: {
- Image(systemName: "newspaper.fill")
- .resizable()
- .scaledToFit()
+ if let activeHotline = ApplicationState.shared.activeHotline,
+ activeHotline.serverVersion >= 151 {
+ Button {
+ ApplicationState.shared.activeServerState?.selection = .news
+ }
+ label: {
+ Image("Section News")
+ .resizable()
+ .scaledToFit()
+ }
+ .buttonStyle(.plain)
+ .frame(width: 20, height: 20)
+ .disabled(ApplicationState.shared.activeServerState == nil)
+ .help("News")
}
- .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 = .files
}
label: {
- Image(systemName: "folder.fill")
+ Image("Section Files")
.resizable()
.scaledToFit()
}
.buttonStyle(.plain)
- .frame(width: 18, height: 18)
- .opacity(ApplicationState.shared.activeServerState == nil ? 0.5 : 1.0)
+ .frame(width: 20, height: 20)
.disabled(ApplicationState.shared.activeServerState == nil)
.help("Files")
- Button {
- ApplicationState.shared.activeServerState?.selection = .accounts
- }
- label: {
- Image(systemName: "person.2.fill")
- .resizable()
- .scaledToFit()
- }
- .buttonStyle(.plain)
- .frame(width: 18, height: 18)
- .opacity(ApplicationState.shared.activeServerState == nil ? 0.5 : 1.0)
- .disabled(ApplicationState.shared.activeServerState == nil || ApplicationState.shared.activeHotline?.access?.contains(.canOpenUsers) == false)
- .help("Accounts")
-
Spacer()
+ if ApplicationState.shared.activeHotline?.access?.contains(.canOpenUsers) == true {
+ Button {
+ ApplicationState.shared.activeServerState?.selection = .accounts
+ }
+ label: {
+ Image("Section Users")
+ .resizable()
+ .scaledToFit()
+ }
+ .buttonStyle(.plain)
+ .frame(width: 20, height: 20)
+ .disabled(ApplicationState.shared.activeServerState == nil)
+ .help("Accounts")
+ }
+
SettingsLink(label: {
- Image(systemName: "gearshape.fill")
+ Image("Section Settings")
.resizable()
.scaledToFit()
})
.buttonStyle(.plain)
- .frame(width: 18, height: 18)
+ .frame(width: 20, height: 20)
.help("Settings")
}
- .padding(.top, 16)
- .padding(.bottom, 16)
- .padding([.leading, .trailing], 16)
+ .padding(.top, 12)
+ .padding(.bottom, 12)
+ .padding([.leading, .trailing], 12)
+
+// GroupBox {
+// HStack(spacing: 0) {
+// Text("Not Connected")
+// .font(.system(size: 10.0))
+// .lineLimit(1)
+// .truncationMode(.tail)
+// .opacity(0.5)
+// .padding(.vertical, 0.0)
+// .padding(.horizontal, 4.0)
+//
+// Spacer()
+// }
+// }
+// .padding([.leading, .bottom, .trailing], 4.0)
}
// .frame(width: 468)
// .background(colorScheme == .dark ? .black : .white)
diff --git a/Hotline/macOS/MessageBoardEditorView.swift b/Hotline/macOS/MessageBoardEditorView.swift
index 1b49f4e..029616f 100644
--- a/Hotline/macOS/MessageBoardEditorView.swift
+++ b/Hotline/macOS/MessageBoardEditorView.swift
@@ -48,11 +48,11 @@ struct MessageBoardEditorView: View {
Spacer()
- Image("Message Board Post")
- .resizable()
- .scaledToFit()
- .frame(width: 16, height: 16)
- .padding(.trailing, 6)
+// Image("Message Board Post")
+// .resizable()
+// .scaledToFit()
+// .frame(width: 16, height: 16)
+// .padding(.trailing, 6)
Text("New Post")
.fontWeight(.semibold)
diff --git a/Hotline/macOS/NewsEditorView.swift b/Hotline/macOS/NewsEditorView.swift
index a6f72ec..f69c846 100644
--- a/Hotline/macOS/NewsEditorView.swift
+++ b/Hotline/macOS/NewsEditorView.swift
@@ -88,7 +88,7 @@ struct NewsEditorView: View {
}
.buttonStyle(.plain)
.frame(width: 22, height: 22)
- .help("Post to Newsgroup")
+ .help("Post News")
.disabled(title.isEmpty || text.isEmpty)
}
}
diff --git a/Hotline/macOS/NewsItemView.swift b/Hotline/macOS/NewsItemView.swift
index 5cd9ce4..9614663 100644
--- a/Hotline/macOS/NewsItemView.swift
+++ b/Hotline/macOS/NewsItemView.swift
@@ -79,29 +79,40 @@ struct NewsItemView: View {
Spacer()
- if news.type == .bundle || news.type == .category {
- ZStack {
-// Text("^[\(news.count) \(news.type == .bundle ? "Category" : "Post")](inflect: true)")
- Text("\(news.count)")
- .foregroundStyle(.clear)
-// .font(.caption)
- .lineLimit(1)
- .padding([.leading, .trailing], 8)
- .padding([.top, .bottom], 2)
- .background(.secondary)
- .clipShape(Capsule())
-
- Text("\(news.count)")
- .foregroundStyle(.white)
-// .font(.caption)
- .lineLimit(1)
- .padding([.leading, .trailing], 8)
- .padding([.top, .bottom], 2)
- .blendMode(.destinationOut)
- }
- .drawingGroup(opaque: false)
+ if news.type == .category && news.count > 0 {
+ Text("^[\(news.count) Post](inflect: true)")
+ .lineLimit(1)
+ .foregroundStyle(.secondary)
+ .padding(.trailing, 8)
}
- if news.type == .article && news.articleUsername != nil {
+// if news.type == .bundle {
+// Text("\(news.count)")
+// .lineLimit(1)
+// .foregroundStyle(.tertiary)
+// .padding(.trailing, 8)
+
+// ZStack {
+// Text("^[\(news.count) \(news.type == .bundle ? "Category" : "Post")](inflect: true)")
+// Text("\(news.count)")
+// .foregroundStyle(.clear)
+//// .font(.caption)
+// .lineLimit(1)
+// .padding([.leading, .trailing], 8)
+// .padding([.top, .bottom], 2)
+// .background(.secondary)
+// .clipShape(Capsule())
+//
+// Text("\(news.count)")
+// .foregroundStyle(.white)
+//// .font(.caption)
+// .lineLimit(1)
+// .padding([.leading, .trailing], 8)
+// .padding([.top, .bottom], 2)
+// .blendMode(.destinationOut)
+// }
+// .drawingGroup(opaque: false)
+// }
+ else if news.type == .article && news.articleUsername != nil {
if let d = news.articleDate {
Text(NewsItemView.relativeDateFormatter.localizedString(for: d, relativeTo: Date.now))
.lineLimit(1)
diff --git a/Hotline/macOS/NewsView.swift b/Hotline/macOS/NewsView.swift
index 4469585..e4f4d21 100644
--- a/Hotline/macOS/NewsView.swift
+++ b/Hotline/macOS/NewsView.swift
@@ -138,7 +138,7 @@ struct NewsView: View {
} label: {
Image(systemName: "arrow.clockwise")
}
- .help("Reload Newsgroup")
+ .help("Reload News")
.disabled(loading)
}
}
diff --git a/Hotline/macOS/ServerView.swift b/Hotline/macOS/ServerView.swift
index 7349d95..5e3678f 100644
--- a/Hotline/macOS/ServerView.swift
+++ b/Hotline/macOS/ServerView.swift
@@ -58,28 +58,35 @@ struct ServerMenuItem: Identifiable, Hashable {
}
struct ListItemView: View {
- let icon: String
+ @Environment(\.controlActiveState) private var controlActiveState
+
+ let icon: String?
let title: String
let unread: Bool
var body: some View {
- HStack {
- Image(systemName: icon)
+ HStack(spacing: 5) {
+ if let i = icon {
+ Image(i)
.resizable()
+ // .renderingMode(.template)
.scaledToFit()
- .frame(width: 16, height: 16)
- .padding(.leading, 4)
- Text(title)
- .lineLimit(1)
- .truncationMode(.tail)
- Spacer()
- if unread {
- Circle()
- .frame(width: 6, height: 6)
- .padding(EdgeInsets(top: 0, leading: 8, bottom: 0, trailing: 2))
- .opacity(0.5)
- }
+ .frame(width: 20, height: 20)
+// .padding(.leading, 2)
+ .opacity(controlActiveState == .inactive ? 0.5 : 1.0)
}
+
+ Text(title)
+ .lineLimit(1)
+ .truncationMode(.tail)
+ Spacer()
+ if unread {
+ Circle()
+ .frame(width: 6, height: 6)
+ .padding(EdgeInsets(top: 0, leading: 8, bottom: 0, trailing: 2))
+ .opacity(0.5)
+ }
+ }
}
}
@@ -148,17 +155,17 @@ struct ServerView: View {
@Binding var server: Server
static var menuItems: [ServerMenuItem] = [
- ServerMenuItem(type: .chat, name: "Chat", image: "bubble"),
- ServerMenuItem(type: .board, name: "Board", image: "pin"),
- ServerMenuItem(type: .news, name: "News", image: "newspaper"),
- ServerMenuItem(type: .files, name: "Files", image: "folder"),
- ServerMenuItem(type: .accounts, name: "Accounts", image: "person.2"),
+ ServerMenuItem(type: .chat, name: "Chat", image: "Section Chat"),
+ ServerMenuItem(type: .board, name: "Board", image: "Section Board"),
+ ServerMenuItem(type: .news, name: "News", image: "Section News"),
+ ServerMenuItem(type: .files, name: "Files", image: "Section Files"),
+ ServerMenuItem(type: .accounts, name: "Accounts", image: "Section Users"),
]
static var classicMenuItems: [ServerMenuItem] = [
- ServerMenuItem(type: .chat, name: "Chat", image: "bubble"),
- ServerMenuItem(type: .board, name: "Board", image: "pin"),
- ServerMenuItem(type: .files, name: "Files", image: "folder"),
+ ServerMenuItem(type: .chat, name: "Chat", image: "Section Chat"),
+ ServerMenuItem(type: .board, name: "Board", image: "Section Board"),
+ ServerMenuItem(type: .files, name: "Files", image: "Section Files"),
]
enum FocusFields {
@@ -211,7 +218,7 @@ struct ServerView: View {
.resizable()
.scaledToFit()
- .frame(width: 24)
+ .frame(width: 28)
.opacity(controlActiveState == .inactive ? 0.4 : 1.0)
}
}
@@ -377,10 +384,14 @@ struct ServerView: View {
}
if model.transfers.count > 0 {
+ Divider()
+
self.transfersSection
}
if model.users.count > 0 {
+ Divider()
+
self.usersSection
}
}
@@ -397,26 +408,28 @@ struct ServerView: View {
}
var transfersSection: some View {
- Section("Transfers") {
+// Section("Transfers") {
ForEach(model.transfers) { transfer in
TransferItemView(transfer: transfer)
}
- }
+// }
}
var usersSection: some View {
- Section("\(model.users.count) Online") {
+// Section("\(model.users.count) Online") {
ForEach(model.users) { user in
- HStack {
+ HStack(spacing: 5) {
if let iconImage = Hotline.getClassicIcon(Int(user.iconID)) {
Image(nsImage: iconImage)
.frame(width: 16, height: 16)
- .padding(.leading, 4)
+ .padding(.leading, 2)
+ .padding(.trailing, 2)
}
else {
Image("User")
.frame(width: 16, height: 16)
- .padding(.leading, 4)
+ .padding(.leading, 2)
+ .padding(.trailing, 2)
}
Text(user.name)
@@ -435,7 +448,7 @@ struct ServerView: View {
.opacity(controlActiveState == .inactive ? 0.5 : 1.0)
.tag(ServerNavigationType.user(userID: user.id))
}
- }
+// }
}
var serverView: some View {
@@ -453,7 +466,7 @@ struct ServerView: View {
case .news:
NewsView()
.navigationTitle(model.serverTitle)
- .navigationSubtitle("Newsgroup")
+ .navigationSubtitle("News")
.navigationSplitViewColumnWidth(min: 250, ideal: 500)
case .board:
MessageBoardView()