@@ -199,24 +199,24 @@ struct AniListDetailsView: View {
199199 return partialResult
200200 }
201201 let computedAverage = totalCount > 0 ? Double ( totalScore) / Double( totalCount) : 0.0
202-
203- HStack ( alignment: . center) {
204- Text ( " Average Score: \( String ( format: " %.1f " , computedAverage) ) " )
202+ VStack {
203+ Text ( " Score Distribution " )
205204 . font ( . headline)
206- . frame ( width: 120 , alignment: . leading)
207- VStack ( alignment: . center) {
208- Text ( " Score Distribution " )
209- . font ( . headline)
210- HStack ( alignment: . bottom, spacing: 8 ) {
211- ForEach ( Array ( scoreDistribution. enumerated ( ) ) , id: \. offset) { _, dataPoint in
212- if let score = dataPoint [ " score " ] as? Int ,
213- let amount = dataPoint [ " amount " ] as? Int {
214- VStack {
215- Rectangle ( )
216- . fill ( Color . accentColor)
217- . frame ( width: 20 , height: CGFloat ( amount) / CGFloat( maxValue) * 100 )
218- Text ( " \( score) " )
219- . font ( . caption)
205+ HStack ( alignment: . center) {
206+ MediaDetailItem ( title: " Average Score " , value: String ( format: " %.1f " , computedAverage) )
207+ . frame ( width: 120 , alignment: . leading)
208+ VStack ( alignment: . center) {
209+ HStack ( alignment: . bottom, spacing: 8 ) {
210+ ForEach ( Array ( scoreDistribution. enumerated ( ) ) , id: \. offset) { _, dataPoint in
211+ if let score = dataPoint [ " score " ] as? Int ,
212+ let amount = dataPoint [ " amount " ] as? Int {
213+ VStack {
214+ Rectangle ( )
215+ . fill ( Color . accentColor)
216+ . frame ( width: 20 , height: CGFloat ( amount) / CGFloat( maxValue) * 100 )
217+ Text ( " \( score) " )
218+ . font ( . caption)
219+ }
220220 }
221221 }
222222 }
0 commit comments