aboutsummaryrefslogtreecommitdiff
path: root/Hotline/macOS
diff options
context:
space:
mode:
authorDustin Mierau <dustin@mierau.me>2025-10-25 15:26:05 -0700
committerDustin Mierau <dustin@mierau.me>2025-10-25 15:26:05 -0700
commit53686e30592fee566585e391738adee8b2ef2137 (patch)
tree7ee768ca3c84ac7dad7ea674fb637480e4b7184c /Hotline/macOS
parent65521893ac5f10ec035cd735747034c263e46d77 (diff)
Fixed some warnings. Add basic markdown formatting support to chat messages. Add some metadata support for chat log (though we're not using this yet).
Diffstat (limited to 'Hotline/macOS')
-rw-r--r--Hotline/macOS/ChatView.swift49
-rw-r--r--Hotline/macOS/FilesView.swift3
2 files changed, 7 insertions, 45 deletions
diff --git a/Hotline/macOS/ChatView.swift b/Hotline/macOS/ChatView.swift
index a45e7ed..2ad9816 100644
--- a/Hotline/macOS/ChatView.swift
+++ b/Hotline/macOS/ChatView.swift
@@ -69,58 +69,21 @@ struct ChatDisconnectedMessageView: View {
struct ChatMessageView: View {
let message: ChatMessage
-
+
var body: some View {
HStack(alignment: .firstTextBaseline) {
if let username = message.username {
- // if msg.text.isImageURL() {
- // HStack(alignment: .bottom) {
- // Text("**\(username):** ")
- //
- // let imageURL = URL(string: msg.text)!
- // AsyncImage(url: imageURL) { phase in
- // switch phase {
- // case .failure:
- // Text(LocalizedStringKey(msg.text.convertLinksToMarkdown()))
- // .lineSpacing(4)
- // .multilineTextAlignment(.leading)
- // .textSelection(.enabled)
- // .tint(Color("Link Color"))
- // case .success(let img):
- // Link(destination: imageURL) {
- // img
- // .resizable()
- // .scaledToFit()
- // .frame(maxWidth: 250, maxHeight: 150, alignment: .leading)
- // .onAppear {
- // reader.scrollTo(bottomID, anchor: .bottom)
- // }
- // }
- // default:
- // ProgressView().controlSize(.small)
- // }
- // }
- //
- // Spacer()
- // }
- // }
- // else {
- Text(LocalizedStringKey("**\(username):** \(message.text)".convertingLinksToMarkdown()))
- .lineSpacing(4)
- .multilineTextAlignment(.leading)
- .textSelection(.enabled)
- .tint(Color("Link Color"))
- // }
+ Text("\(username): ").fontWeight(.semibold) + Text(message.text.markdownToAttributedString())
}
else {
Text(message.text)
- .lineSpacing(4)
- .multilineTextAlignment(.leading)
- .textSelection(.enabled)
- .tint(Color("Link Color"))
}
Spacer()
}
+ .lineSpacing(4)
+ .multilineTextAlignment(.leading)
+ .textSelection(.enabled)
+ .tint(Color("Link Color"))
}
}
diff --git a/Hotline/macOS/FilesView.swift b/Hotline/macOS/FilesView.swift
index 00a4e1e..42232af 100644
--- a/Hotline/macOS/FilesView.swift
+++ b/Hotline/macOS/FilesView.swift
@@ -244,11 +244,10 @@ struct FilesView: View {
return "No files found in \(processed) \(folderWord)"
}
return "\(count) file\(count == 1 ? "" : "s") found in \(processed) \(folderWord)"
- case .cancelled(let processed):
+ case .cancelled(_):
if model.fileSearchResults.isEmpty {
return nil
}
- let folderWord = processed == 1 ? "folder" : "folders"
return "Search cancelled"
case .failed(let message):
return "Search failed: \(message)"