Card author (4.3.0)
This commit is contained in:
parent
c0b9eb4082
commit
06fea1da02
|
@ -7,11 +7,12 @@ struct PostCardView: View {
|
||||||
|
|
||||||
var card: Card
|
var card: Card
|
||||||
var inQuote: Bool = false
|
var inQuote: Bool = false
|
||||||
|
var imaging: Bool = false
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(alignment: .center, spacing: 10) {
|
VStack(alignment: .center, spacing: 10) {
|
||||||
if card.image != nil {
|
if card.image != nil {
|
||||||
OnlineImage(url: card.image, size: inQuote ? 260 : 300, useNuke: false)
|
OnlineImage(url: card.image, size: inQuote ? 260 : 300, useNuke: imaging)
|
||||||
.frame(width: inQuote ? 250 : 300)
|
.frame(width: inQuote ? 250 : 300)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +38,28 @@ struct PostCardView: View {
|
||||||
.multilineTextAlignment(.leading)
|
.multilineTextAlignment(.leading)
|
||||||
.lineLimit(3)
|
.lineLimit(3)
|
||||||
}
|
}
|
||||||
.padding([.horizontal, .bottom], 10)
|
.padding(card.authors.first?.account == nil ? [.horizontal, .bottom] : [.horizontal], 10)
|
||||||
|
|
||||||
|
if let acc = card.authors.first?.account {
|
||||||
|
Divider()
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
|
|
||||||
|
HStack(alignment: .center) {
|
||||||
|
Label {
|
||||||
|
Text("status.card.author-\(acc.acct)")
|
||||||
|
.font(.caption)
|
||||||
|
.lineLimit(1)
|
||||||
|
} icon: {
|
||||||
|
ProfilePicture(url: acc.avatar, size: 30.0)
|
||||||
|
}
|
||||||
|
.minimumScaleFactor(0.7)
|
||||||
|
}
|
||||||
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
.padding([.horizontal, .bottom], 10)
|
||||||
|
.onTapGesture {
|
||||||
|
Navigator.shared.navigate(to: .account(acc: acc))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.frame(width: inQuote ? 200 : 250)
|
.frame(width: inQuote ? 200 : 250)
|
||||||
.padding(.horizontal, 10)
|
.padding(.horizontal, 10)
|
||||||
|
|
|
@ -328,8 +328,19 @@ public struct Card: Codable, Identifiable, Equatable, Hashable {
|
||||||
public let url: String
|
public let url: String
|
||||||
public let title: String?
|
public let title: String?
|
||||||
public let description: String?
|
public let description: String?
|
||||||
|
public let authors: [Self.Author]
|
||||||
public let type: String
|
public let type: String
|
||||||
public let image: URL?
|
public let image: URL?
|
||||||
|
|
||||||
|
public struct Author: Codable, Identifiable, Equatable, Sendable, Hashable {
|
||||||
|
public var id: String {
|
||||||
|
url
|
||||||
|
}
|
||||||
|
|
||||||
|
let name: String
|
||||||
|
let url: String
|
||||||
|
let account: Account?
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Card: Sendable {}
|
extension Card: Sendable {}
|
||||||
|
|
|
@ -3679,6 +3679,22 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"status.card.author-%@" : {
|
||||||
|
"localizations" : {
|
||||||
|
"en" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Article by @%@"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"fr" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Article par @%@"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"status.content-filter.censor" : {
|
"status.content-filter.censor" : {
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
"en" : {
|
"en" : {
|
||||||
|
|
Loading…
Reference in New Issue