diff options
Diffstat (limited to 'Hotline')
| -rw-r--r-- | Hotline/Assets.xcassets/News Bundle.imageset/News Bundle.png | bin | 307 -> 290 bytes | |||
| -rw-r--r-- | Hotline/Assets.xcassets/News Bundle.imageset/News Bundle@2x.png | bin | 471 -> 437 bytes | |||
| -rw-r--r-- | Hotline/Assets.xcassets/News Bundle.imageset/News Bundle@3x.png | bin | 646 -> 596 bytes | |||
| -rw-r--r-- | Hotline/Assets.xcassets/News Category.imageset/News Category.png | bin | 355 -> 326 bytes | |||
| -rw-r--r-- | Hotline/Assets.xcassets/News Category.imageset/News Category@2x.png | bin | 647 -> 534 bytes | |||
| -rw-r--r-- | Hotline/Assets.xcassets/News Category.imageset/News Category@3x.png | bin | 993 -> 719 bytes | |||
| -rw-r--r-- | Hotline/Shared/FileIconView.swift | 16 | ||||
| -rw-r--r-- | Hotline/macOS/FilesView.swift | 3 | ||||
| -rw-r--r-- | Hotline/macOS/NewsView.swift | 53 |
9 files changed, 54 insertions, 18 deletions
diff --git a/Hotline/Assets.xcassets/News Bundle.imageset/News Bundle.png b/Hotline/Assets.xcassets/News Bundle.imageset/News Bundle.png Binary files differindex 83e97ed..ea6fe08 100644 --- a/Hotline/Assets.xcassets/News Bundle.imageset/News Bundle.png +++ b/Hotline/Assets.xcassets/News Bundle.imageset/News Bundle.png diff --git a/Hotline/Assets.xcassets/News Bundle.imageset/News Bundle@2x.png b/Hotline/Assets.xcassets/News Bundle.imageset/News Bundle@2x.png Binary files differindex 114f547..8271cc3 100644 --- a/Hotline/Assets.xcassets/News Bundle.imageset/News Bundle@2x.png +++ b/Hotline/Assets.xcassets/News Bundle.imageset/News Bundle@2x.png diff --git a/Hotline/Assets.xcassets/News Bundle.imageset/News Bundle@3x.png b/Hotline/Assets.xcassets/News Bundle.imageset/News Bundle@3x.png Binary files differindex db8bb27..b018b6d 100644 --- a/Hotline/Assets.xcassets/News Bundle.imageset/News Bundle@3x.png +++ b/Hotline/Assets.xcassets/News Bundle.imageset/News Bundle@3x.png diff --git a/Hotline/Assets.xcassets/News Category.imageset/News Category.png b/Hotline/Assets.xcassets/News Category.imageset/News Category.png Binary files differindex 2667489..cc8554b 100644 --- a/Hotline/Assets.xcassets/News Category.imageset/News Category.png +++ b/Hotline/Assets.xcassets/News Category.imageset/News Category.png diff --git a/Hotline/Assets.xcassets/News Category.imageset/News Category@2x.png b/Hotline/Assets.xcassets/News Category.imageset/News Category@2x.png Binary files differindex c92ca23..28053fd 100644 --- a/Hotline/Assets.xcassets/News Category.imageset/News Category@2x.png +++ b/Hotline/Assets.xcassets/News Category.imageset/News Category@2x.png diff --git a/Hotline/Assets.xcassets/News Category.imageset/News Category@3x.png b/Hotline/Assets.xcassets/News Category.imageset/News Category@3x.png Binary files differindex e64c7e6..0c968bb 100644 --- a/Hotline/Assets.xcassets/News Category.imageset/News Category@3x.png +++ b/Hotline/Assets.xcassets/News Category.imageset/News Category@3x.png diff --git a/Hotline/Shared/FileIconView.swift b/Hotline/Shared/FileIconView.swift index 7336cf3..ffc9051 100644 --- a/Hotline/Shared/FileIconView.swift +++ b/Hotline/Shared/FileIconView.swift @@ -1,6 +1,22 @@ import SwiftUI import UniformTypeIdentifiers +struct FolderIconView: View { + private func folderIcon() -> Image { +#if os(iOS) + return Image(systemName: "folder.fill") +#elseif os(macOS) + return Image(nsImage: NSWorkspace.shared.icon(for: UTType.folder)) +#endif + } + + var body: some View { + folderIcon() + .resizable() + .scaledToFit() + } +} + struct FileIconView: View { let filename: String diff --git a/Hotline/macOS/FilesView.swift b/Hotline/macOS/FilesView.swift index f698b5d..133e1fd 100644 --- a/Hotline/macOS/FilesView.swift +++ b/Hotline/macOS/FilesView.swift @@ -38,7 +38,8 @@ struct FileView: View { Image(systemName: "questionmark.app.fill").opacity(0.5) } else if file.isFolder { - Image(systemName: "folder.fill") + FolderIconView() + .frame(width: 16, height: 16) } else { FileIconView(filename: file.name) diff --git a/Hotline/macOS/NewsView.swift b/Hotline/macOS/NewsView.swift index 201d3e2..f440cb2 100644 --- a/Hotline/macOS/NewsView.swift +++ b/Hotline/macOS/NewsView.swift @@ -56,7 +56,7 @@ struct NewsView: View { ) .fraction(splitFraction) .constraints(minPFraction: 0.1, minSFraction: 0.3) - .hide(splitHidden) +// .hide(splitHidden) .styling(color: colorScheme == .dark ? .black : Splitter.defaultColor, inset: 0, visibleThickness: 0.5, invisibleThickness: 5, hideSplitter: true) .frame(maxWidth: .infinity, maxHeight: .infinity) .background(Color(nsColor: .textBackgroundColor)) @@ -68,11 +68,11 @@ struct NewsView: View { } } } -// .sheet(isPresented: $editorOpen) { -// print("Sheet dismissed!") -// } content: { -// NewsEditorView() -// } + .sheet(isPresented: $editorOpen) { + print("Sheet dismissed!") + } content: { + NewsEditorView() + } .toolbar { ToolbarItem(placement: .primaryAction) { Button { @@ -84,13 +84,14 @@ struct NewsView: View { ToolbarItem(placement: .primaryAction) { Button { -// if let selection = selection { -// editorOpen = true -//// openWindow(id: "news-editor", value: NewsArticle(parentID: nil, path: selection.path, title: "", body: "")) -// } + if selection?.type == .category || selection?.type == .article { + editorOpen = true +// openWindow(id: "news-editor", value: NewsArticle(parentID: nil, path: selection.path, title: "", body: "")) + } } label: { Image(systemName: "square.and.pencil") } + .disabled(selection?.type != .category && selection?.type != .article) } ToolbarItem(placement: .primaryAction) { @@ -99,6 +100,7 @@ struct NewsView: View { } label: { Image(systemName: "arrowshape.turn.up.left") } + .disabled(selection?.type != .article) } } } @@ -180,8 +182,8 @@ struct NewsView: View { var articleViewer: some View { ScrollView { - if let selection = selection { - VStack(alignment: .leading, spacing: 0) { + VStack(alignment: .leading, spacing: 0) { + if let selection = selection, selection.type == .article { if let poster = selection.articleUsername, let postDate = selection.articleDate { HStack(alignment: .firstTextBaseline) { Text(poster) @@ -215,9 +217,27 @@ struct NewsView: View { .padding(.top, 16) } } - .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .leading) - .padding() + else { + HStack(alignment: .center) { + Spacer() + HStack(alignment: .center, spacing: 8) { +// Image(systemName: "doc.append") +// .resizable() +// .scaledToFit() +// .foregroundStyle(.tertiary) +// .frame(width: 16, height: 16) + Text("Select a news post to read") + .foregroundStyle(.tertiary) + .font(.system(size: 13)) + } + Spacer() + } + .padding() + .padding(.top, 48) + } } + .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .leading) + .padding() } .frame(maxWidth: .infinity, maxHeight: .infinity) .transition(.move(edge: .bottom)) @@ -294,10 +314,9 @@ struct NewsItemView: View { Spacer() if news.type == .bundle || news.type == .category { ZStack { - Text("^[\(news.count) \(news.type == .bundle ? "Category" : "Post")](inflect: true)") .foregroundStyle(.clear) - .font(.caption) + .font(.caption2) .lineLimit(1) .padding([.leading, .trailing], 8) .padding([.top, .bottom], 2) @@ -306,7 +325,7 @@ struct NewsItemView: View { Text("^[\(news.count) \(news.type == .bundle ? "Category" : "Post")](inflect: true)") .foregroundStyle(.white) - .font(.caption) + .font(.caption2) .lineLimit(1) .padding([.leading, .trailing], 8) .padding([.top, .bottom], 2) |