From f87ae3b315e20ac31426782d7f40f8977a36e5b9 Mon Sep 17 00:00:00 2001 From: Dustin Mierau Date: Mon, 8 Jan 2024 15:18:00 -0800 Subject: Add Markdown display for news articles to support rich text, images, links, tables, etc. --- Hotline/macOS/NewsView.swift | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'Hotline/macOS') diff --git a/Hotline/macOS/NewsView.swift b/Hotline/macOS/NewsView.swift index 45bae68..daeb45b 100644 --- a/Hotline/macOS/NewsView.swift +++ b/Hotline/macOS/NewsView.swift @@ -1,5 +1,5 @@ import SwiftUI -import UniformTypeIdentifiers +import MarkdownUI struct NewsItemView: View { @Environment(Hotline.self) private var model: Hotline @@ -24,7 +24,7 @@ struct NewsItemView: View { }() var body: some View { - HStack { + HStack(alignment: .center, spacing: 6) { if news.type == .bundle || news.type == .category { Button { news.expanded.toggle() @@ -40,15 +40,14 @@ struct NewsItemView: View { .padding(.leading, 4) } else if news.type == .article { -// HStack(alignment: .center) { -// Text(Image(systemName: "quote.opening")) -// .font(.system(size: 12)) -// .opacity(0.5) -// .frame(alignment: .centerFirstTextBaseline) - -// Image(systemName: "quote.opening") -// } -// .frame(width: 14) + if news.parentID != nil { + Image(systemName: "arrowshape.turn.up.left.fill") + .resizable() + .renderingMode(.template) + .scaledToFit() + .frame(width: 10) + .foregroundStyle(.secondary) + } } Text(news.name) .fontWeight((news.type == .bundle || news.type == .category) ? .bold : .regular) @@ -203,7 +202,8 @@ struct NewsView: View { Divider() if let newsText = self.articleText { - Text(newsText) + Markdown(newsText) +// Text(newsText) .textSelection(.enabled) .lineSpacing(4) .padding(.top, 16) -- cgit