From c388ca2decf507756aceb4943545f21a6cc2d016 Mon Sep 17 00:00:00 2001 From: samglt Date: Thu, 6 Feb 2025 19:59:05 -0800 Subject: [PATCH] [iOS] Show critic & community ratings alongside attributes (#1420) --- .../ItemView/Components/AttributeHStack.swift | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Swiftfin/Views/ItemView/Components/AttributeHStack.swift b/Swiftfin/Views/ItemView/Components/AttributeHStack.swift index 910fb32b..59a64414 100644 --- a/Swiftfin/Views/ItemView/Components/AttributeHStack.swift +++ b/Swiftfin/Views/ItemView/Components/AttributeHStack.swift @@ -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)