1
1
import Box from "@mui/material/Box" ;
2
+ import Grid from "@mui/material/Grid2" ;
3
+ import OverallRating from "components/OverallRating" ;
2
4
import useRoomRatings from "hooks/useRoomRatings" ;
3
5
import React from "react" ;
4
6
@@ -9,31 +11,40 @@ const RoomRatingList: React.FC<{
9
11
} > = ( { roomID } ) => {
10
12
const { ratings } = useRoomRatings ( roomID ) ;
11
13
12
- let cleanlinesRating = 0 ;
14
+ let cleanlinessRating = 0 ;
13
15
let quietnessRating = 0 ;
14
16
let locationRating = 0 ;
15
17
let overallRating = 0 ;
16
18
17
19
if ( ratings && ratings . length > 0 ) {
18
20
ratings . forEach ( ( rating ) => {
19
- cleanlinesRating += rating . cleanliness ;
21
+ cleanlinessRating += rating . cleanliness ;
20
22
quietnessRating += rating . cleanliness ;
21
23
locationRating += rating . location ;
22
24
overallRating += rating . overall ;
23
25
} ) ;
24
26
25
- cleanlinesRating = cleanlinesRating / ratings . length ;
27
+ cleanlinessRating = cleanlinessRating / ratings . length ;
26
28
quietnessRating = quietnessRating / ratings . length ;
27
29
locationRating = locationRating / ratings . length ;
28
30
overallRating = overallRating / ratings . length ;
29
31
}
30
-
31
32
return (
32
- < Box display = "flex" justifyContent = "flex-start" mt = { 2 } gap = { 9 } >
33
- < CircularRating category = "Cleanliness" rating = { cleanlinesRating } />
34
- < CircularRating category = "Quietness" rating = { quietnessRating } />
35
- < CircularRating category = "Location" rating = { locationRating } />
36
- < CircularRating category = "Overall" rating = { overallRating } />
33
+ < Box display = "flex" justifyContent = "center" mt = { 2 } >
34
+ < Grid container spacing = { { xs : 1 , sm : 2 } } columns = { { xs : 2 , sm : 4 } } >
35
+ < Grid size = { 1 } >
36
+ < OverallRating />
37
+ </ Grid >
38
+ < Grid size = { 1 } >
39
+ < CircularRating category = "Cleanliness" rating = { cleanlinessRating } />
40
+ </ Grid >
41
+ < Grid size = { 1 } >
42
+ < CircularRating category = "Quietness" rating = { quietnessRating } />
43
+ </ Grid >
44
+ < Grid size = { 1 } >
45
+ < CircularRating category = "Location" rating = { locationRating } />
46
+ </ Grid >
47
+ </ Grid >
37
48
</ Box >
38
49
) ;
39
50
} ;
0 commit comments