diff --git a/Shared/PostList/SearchablePostListFilteredView.swift b/Shared/PostList/SearchablePostListFilteredView.swift index 56d2c29..6f3e5b9 100644 --- a/Shared/PostList/SearchablePostListFilteredView.swift +++ b/Shared/PostList/SearchablePostListFilteredView.swift @@ -1,35 +1,47 @@ import SwiftUI @available(iOS 15, macOS 12.0, *) struct SearchablePostListFilteredView: View { @EnvironmentObject var model: WriteFreelyModel @State private var searchString = "" var collections: FetchedResults var fetchRequest: FetchRequest var onDelete: (WFAPost) -> Void var body: some View { if #available(iOS 16, macOS 13, *) { + /// TODO: Add back post search NavigationStack { List(fetchRequest.wrappedValue, id: \.self, selection: $model.navState.selectedPost) { post in NavigationLink( - "\(post.title.isEmpty ? "UNTITLED" : post.title)", - destination: PostEditorView(post: post) + destination: PostEditorView(post: post), + label: { + if model.navState.showAllPosts { + if let collection = collections.filter({ $0.alias == post.collectionAlias }).first { + PostCellView(post: post, collectionName: collection.title) + } else { + let collectionName = model.account.server == "https://write.as" ? "Anonymous" : "Drafts" + PostCellView(post: post, collectionName: collectionName) + } + } else { + PostCellView(post: post) + } + } ) } } } else { DeprecatedListView( searchString: $searchString, collections: collections, fetchRequest: fetchRequest, onDelete: onDelete ) } } func delete(_ post: WFAPost) { onDelete(post) } }