Gradient for sub club posts

This commit is contained in:
lumaa-dev 2024-09-20 21:19:35 +02:00
parent 49ce369275
commit 100d788749

View File

@ -37,6 +37,7 @@ struct CompactPostView: View {
}
.withCovers(sheetDestination: $navigator.presentedCover)
.containerShape(Rectangle())
.background(postBackground())
.contextMenu {
PostMenu(status: status)
}
@ -285,6 +286,24 @@ struct CompactPostView: View {
quoteStatus = nil
}
}
// MARK: - Sub Club integration
@ViewBuilder
private func postBackground() -> some View {
ZStack {
if let match = status.account.acct.firstMatch(of: /(@)?[A-Za-z0-9_]+@sub\.club/) {
LinearGradient(
stops: [.init(color: Color.subClub, location: 0.0), .init(color: Color.appBackground, location: 0.2)],
startPoint: .topTrailing,
endPoint: .bottomLeading
)
.opacity(0.2)
} else {
Color.appBackground
}
}
}
}
#Preview {