import SwiftUI struct PostListItem: View { @Environment(AppModel.self) private var model let post: Post var repostedBy: Post.Author? var accessibilityIdentifierPrefix = "" let openPost: (String) -> Void let openProfile: (String) -> Void let openComposer: (String?, String?) -> Void var body: some View { VStack(alignment: .leading, spacing: 10) { if let repostedBy { RepostAttributionRow(postID: post.id, author: repostedBy) { openProfile(repostedBy.id) } } ReplyContextPosts( post: post, posts: model.replyContext(for: post), openPost: openPost, openProfile: openProfile, openComposer: openComposer ) PostRow( post: post, openPost: { openPost(post.id) }, openProfile: { openProfile(post.author.id) }, openActor: openProfile, openQuotedPost: openPost, openComposer: openComposer, accessibilityIdentifierPrefix: accessibilityIdentifierPrefix ) } .modifier(ContentListRowStyle(openPost: model.canShowTimelineContent(post) ? { openPost(post.id) } : nil)) } } #if DEBUG #Preview("Post list items") { PreviewHost { _ in ScrollView { VStack(spacing: 0) { PostListItem( post: PreviewContent.post, openPost: { _ in }, openProfile: { _ in }, openComposer: { _, _ in }) PostListItem( post: PreviewContent.post, repostedBy: PreviewContent.author, openPost: { _ in }, openProfile: { _ in }, openComposer: { _, _ in }) } } } } #endif