Skip to content

Commit

Permalink
Show ratings with attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
samglt committed Feb 6, 2025
1 parent 21cf786 commit c41770e
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Swiftfin/Views/ItemView/Components/AttributeHStack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,33 @@ extension ItemView {

var body: some View {
HStack {
if let criticRating = viewModel.item.criticRating {
HStack(spacing: 2) {
Group {
if criticRating >= 60 {
Image(.tomatoFresh)
.symbolRenderingMode(.hierarchical)
} else {
Image(.tomatoRotten)
}
}
.font(.caption2)

Text("\(criticRating, specifier: "%.0f")")
}
.asAttributeStyle(.outline)
}

if let communityRating = viewModel.item.communityRating {
HStack(spacing: 2) {
Image(systemName: "star.fill")
.font(.caption2)

Text("\(communityRating, specifier: "%.1f")")
}
.asAttributeStyle(.outline)
}

if let officialRating = viewModel.item.officialRating {
Text(officialRating)
.asAttributeStyle(.outline)
Expand Down

0 comments on commit c41770e

Please sign in to comment.