aboutsummaryrefslogtreecommitdiff
path: root/Hotline
diff options
context:
space:
mode:
authorDustin Mierau <dustin@mierau.me>2023-12-20 19:01:59 -0800
committerDustin Mierau <dustin@mierau.me>2023-12-20 19:01:59 -0800
commit3d26737cccd57fcbb5289874363f030ecef77573 (patch)
tree1c4ad64959aec1bddea8a8881d0515d507f56d62 /Hotline
parent101cbcacb671a1621af6ee2a49ac2021f9abe1c6 (diff)
Reverse sort order on news so most recent posts show at top in a category.
Diffstat (limited to 'Hotline')
-rw-r--r--Hotline/macOS/ChatView.swift15
-rw-r--r--Hotline/macOS/NewsView.swift16
2 files changed, 11 insertions, 20 deletions
diff --git a/Hotline/macOS/ChatView.swift b/Hotline/macOS/ChatView.swift
index 5e6faaf..294f13b 100644
--- a/Hotline/macOS/ChatView.swift
+++ b/Hotline/macOS/ChatView.swift
@@ -35,10 +35,11 @@ struct ChatView: View {
VStack(alignment: .leading) {
Text(msg.text)
.textSelection(.enabled)
- .padding()
+ .lineSpacing(4)
+ .padding(32)
.opacity(0.75)
}
- .frame(minWidth: 40, maxWidth: 400, alignment: .center)
+ .frame(minWidth: 150, maxWidth: 450, alignment: .center)
.background(VisualEffectView(material: .titlebar, blendingMode: .withinWindow).cornerRadius(24))
.padding()
}
@@ -63,10 +64,14 @@ struct ChatView: View {
HStack(alignment: .firstTextBaseline) {
if let username = msg.username {
Text("**\(username):** \(msg.text)")
+ .lineSpacing(4)
+ .multilineTextAlignment(.leading)
.textSelection(.enabled)
}
else {
Text(msg.text)
+ .lineSpacing(4)
+ .multilineTextAlignment(.leading)
.textSelection(.enabled)
}
Spacer()
@@ -82,9 +87,9 @@ struct ChatView: View {
.frame(maxWidth: .infinity, maxHeight: .infinity)
.defaultScrollAnchor(.bottom)
.onChange(of: model.chat.count) {
- withAnimation {
- reader.scrollTo(bottomID, anchor: .bottom)
- }
+// withAnimation {
+ reader.scrollTo(bottomID, anchor: .bottom)
+// }
print("SCROLLED TO BOTTOM")
}
.onAppear {
diff --git a/Hotline/macOS/NewsView.swift b/Hotline/macOS/NewsView.swift
index 15e9db4..33cc03e 100644
--- a/Hotline/macOS/NewsView.swift
+++ b/Hotline/macOS/NewsView.swift
@@ -87,25 +87,11 @@ struct NewsItemView: View {
}
if news.expanded {
- ForEach(news.children, id: \.self) { childNews in
+ ForEach(news.children.reversed(), id: \.self) { childNews in
NewsItemView(news: childNews, depth: self.depth + 1).tag(childNews.id)
}
}
}
-
-// static let byteFormatter = ByteCountFormatter()
-//
-// private func formattedFileSize(_ fileSize: UInt) -> String {
-// // let bcf = ByteCountFormatter()
-// FileView.byteFormatter.allowedUnits = [.useAll]
-// FileView.byteFormatter.countStyle = .file
-// return FileView.byteFormatter.string(fromByteCount: Int64(fileSize))
-// }
-//
-// private func fileIcon(name: String) -> Image {
-// let fileExtension = (name as NSString).pathExtension
-// return Image(nsImage: NSWorkspace.shared.icon(for: UTType(filenameExtension: fileExtension) ?? UTType.content))
-// }
}
struct NewsView: View {