diff --git a/frontend/src/colors.js b/frontend/src/colors.js
index 3569e748..d8447c4d 100644
--- a/frontend/src/colors.js
+++ b/frontend/src/colors.js
@@ -9,6 +9,7 @@ export const colors = {
gray1: '#5D5D5D',
gray2: '#898989',
gray3: '#F9F9F9',
+ gray4: '#C4C4C4',
white: '#FFFFFF',
landlordCardRed: '#F3664B',
green1: '#68BB59',
diff --git a/frontend/src/components/Review/ReviewHeader.tsx b/frontend/src/components/Review/ReviewHeader.tsx
index 4e75c1d5..18361a0d 100644
--- a/frontend/src/components/Review/ReviewHeader.tsx
+++ b/frontend/src/components/Review/ReviewHeader.tsx
@@ -20,7 +20,7 @@ export default function ReviewHeader({ aveRatingInfo }: Props): ReactElement {
{feature.charAt(0).toUpperCase() + feature.slice(1)}
-
+
diff --git a/frontend/src/components/utils/LabeledLinearProgress.tsx b/frontend/src/components/utils/LabeledLinearProgress.tsx
index a9f10ec8..900b9f14 100644
--- a/frontend/src/components/utils/LabeledLinearProgress.tsx
+++ b/frontend/src/components/utils/LabeledLinearProgress.tsx
@@ -1,8 +1,6 @@
import React, { ReactElement } from 'react';
-import Box from '@material-ui/core/Box';
-import LinearProgress from '@material-ui/core/LinearProgress';
+import { colors } from '../../colors';
import Typography from '@material-ui/core/Typography';
-import styles from '../Review/Review.module.scss';
import { makeStyles } from '@material-ui/core';
type Props = {
@@ -10,25 +8,48 @@ type Props = {
};
const useStyles = makeStyles((theme) => ({
- bar: {
- width: '90%',
+ barContainer: {
+ display: 'flex',
+ alignItems: 'center',
+ },
+ barSegment: {
+ flex: 1,
+ height: '8px', // Adjust the height as needed
+ borderRadius: '4px', // Adjust the border radius as needed
+ marginRight: '4px', // Add a small gap between segments
+ },
+ aveRating: {
+ marginLeft: '8px', // Add spacing between the segments and the rating
},
}));
export default function LabeledLinearProgress({ value }: Props): ReactElement {
- const { bar } = useStyles();
+ const { barContainer, barSegment, aveRating } = useStyles();
+ let rating_value = value * 2;
+ rating_value = Math.round(rating_value);
+ rating_value = rating_value / 2 - 1;
+ console.log(rating_value);
+ const segments = Array.from({ length: 5 }, (_, index) => (
+
rating_value && rating_value + 0.5 === index
+ ? `linear-gradient(to right, ${colors.red1} 0%, ${colors.red1} 50%, ${colors.gray4} 50%, ${colors.gray4} 100%)`
+ : colors.gray4,
+ }}
+ >
+ ));
+
return (
-
-
-
-
-
- {`${value.toFixed(1)}`}
-
-
+
+ {segments}
+
+ {`${value.toFixed(1)}`}
+
+
);
}
diff --git a/frontend/src/pages/ApartmentPage.tsx b/frontend/src/pages/ApartmentPage.tsx
index cef77917..67a5d25e 100644
--- a/frontend/src/pages/ApartmentPage.tsx
+++ b/frontend/src/pages/ApartmentPage.tsx
@@ -156,10 +156,9 @@ const ApartmentPage = ({ user, setUser }: Props): ReactElement => {
}
}, [isMobile, reviewData.length]);
- // Increase the number of results to show when the "Show More" button is clicked.
- const handleShowMore = () => {
- setResultsToShow(resultsToShow + 5);
- };
+ // const handleShowMore = () => {
+ // setResultsToShow(resultsToShow + 5);
+ // };
// Set 'notFound' to true when a page is not found.
const handlePageNotFound = () => {
@@ -176,7 +175,6 @@ const ApartmentPage = ({ user, setUser }: Props): ReactElement => {
container,
expand,
expandOpen,
- horizontalLine,
} = useStyles();
// Set the page title based on whether apartment data is loaded.
@@ -364,9 +362,11 @@ const ApartmentPage = ({ user, setUser }: Props): ReactElement => {
);
const Header = (
+ // Header section with review count, average rating, and leave review button
+
<>
-
+
Reviews ({reviewData.length})
{reviewData.length === 0 && (
@@ -375,7 +375,7 @@ const ApartmentPage = ({ user, setUser }: Props): ReactElement => {
{reviewData.length > 0 && (
-
+
@@ -388,6 +388,18 @@ const ApartmentPage = ({ user, setUser }: Props): ReactElement => {
)}
+
+
+
+
{landlordData && landlordData.photos.length > 0 && (
@@ -403,42 +415,8 @@ const ApartmentPage = ({ user, setUser }: Props): ReactElement => {
-
-
-
-
-
-
- Sort by:
-
-
- {
- setSortBy('date');
- },
- },
- {
- item: 'Helpful',
- callback: () => {
- setSortBy('likes');
- },
- },
- ]}
- />
-
-
-
+
+
@@ -560,9 +538,8 @@ const ApartmentPage = ({ user, setUser }: Props): ReactElement => {
>
);
-
const InfoSection = landlordData && (
-
+
{
);
return notFound ? (
+ // Display Not Found page if the apartment is not found
) : !loaded ? (
+ // Display Not Found page if the apartment is not found
) : (
+ // Display Not Found page if the apartment is not found
<>
{landlordData && (
@@ -591,7 +571,7 @@ const ApartmentPage = ({ user, setUser }: Props): ReactElement => {
-
+
{isMobile ? MobileHeader : Header}
{!isMobile && {InfoSection}}
{showConfirmation && (
@@ -610,51 +590,76 @@ const ApartmentPage = ({ user, setUser }: Props): ReactElement => {
time={toastTime}
/>
)}
-
- {sortReviews(reviewData, sortBy)
- .slice(0, resultsToShow)
- .map((review, index) => (
-
-
+
+
+ {!isMobile && (
+
+
+ Sort by:
+
+
+ {
+ setSortBy('date');
+ },
+ },
+ {
+ item: 'Helpful',
+ callback: () => {
+ setSortBy('likes');
+ },
+ },
+ ]}
+ />
+
- ))}
-
-
- {isMobile && reviewData.length > resultsToShow && (
-
-
-
+ )}
+ {/* Rest of your Review List content */}
+
+ {sortReviews(reviewData, sortBy)
+ .slice(0, resultsToShow)
+ .map((review, index) => (
+
+
+
+ ))}
-
-
+
+
+ {/* Second Grid item (InfoSection) */}
+ {isMobile && (
+
+
+ {InfoSection}
+
+
+ )}
+
+
+ {InfoSection}
-
- )}
+
+
- {isMobile && {InfoSection}}
- {InfoSection}
{Modals}