2022-11-21 08:31:32 +00:00
|
|
|
import SwiftUI
|
2022-11-29 08:28:17 +00:00
|
|
|
import Models
|
2022-11-29 10:46:02 +00:00
|
|
|
import Routeur
|
2022-11-21 08:31:32 +00:00
|
|
|
|
|
|
|
struct StatusRowView: View {
|
2022-11-29 10:46:02 +00:00
|
|
|
@EnvironmentObject private var routeurPath: RouterPath
|
|
|
|
|
2022-11-21 08:31:32 +00:00
|
|
|
let status: Status
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
VStack(alignment: .leading) {
|
2022-11-25 11:00:01 +00:00
|
|
|
HStack(alignment: .top) {
|
2022-11-29 10:46:02 +00:00
|
|
|
Button {
|
|
|
|
routeurPath.navigate(to: .accountDetail(id: status.account.id))
|
|
|
|
} label: {
|
|
|
|
accountView
|
|
|
|
}.buttonStyle(.plain)
|
|
|
|
|
2022-11-25 11:00:01 +00:00
|
|
|
Spacer()
|
|
|
|
Text(status.createdAtFormatted)
|
|
|
|
.font(.footnote)
|
|
|
|
.foregroundColor(.gray)
|
2022-11-21 08:31:32 +00:00
|
|
|
}
|
2022-11-29 10:46:02 +00:00
|
|
|
NavigationLink(value: RouteurDestinations.statusDetail(id: status.id)) {
|
|
|
|
Text(try! AttributedString(markdown: status.contentAsMarkdown))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@ViewBuilder
|
|
|
|
private var accountView: some View {
|
|
|
|
AsyncImage(
|
|
|
|
url: status.account.avatar,
|
|
|
|
content: { image in
|
|
|
|
image.resizable()
|
|
|
|
.aspectRatio(contentMode: .fit)
|
|
|
|
.cornerRadius(4)
|
|
|
|
.frame(maxWidth: 40, maxHeight: 40)
|
|
|
|
},
|
|
|
|
placeholder: {
|
|
|
|
ProgressView()
|
|
|
|
.frame(maxWidth: 40, maxHeight: 40)
|
|
|
|
}
|
|
|
|
)
|
|
|
|
VStack(alignment: .leading) {
|
|
|
|
Text(status.account.displayName)
|
|
|
|
.font(.headline)
|
|
|
|
Text("@\(status.account.acct)")
|
|
|
|
.font(.footnote)
|
|
|
|
.foregroundColor(.gray)
|
2022-11-21 08:31:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|