From 96d095b92f769f2391c4898fc26b3d25b7224e5e Mon Sep 17 00:00:00 2001 From: Cyrus Irani Date: Sun, 24 Sep 2023 20:45:25 -0400 Subject: [PATCH 1/4] changed the individual feature reviews to pill form to match the figma --- .../utils/LabeledLinearProgress.tsx | 45 ++++++++++++------- frontend/src/pages/ApartmentPage.tsx | 1 - 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/frontend/src/components/utils/LabeledLinearProgress.tsx b/frontend/src/components/utils/LabeledLinearProgress.tsx index a9f10ec8..f425f2c7 100644 --- a/frontend/src/components/utils/LabeledLinearProgress.tsx +++ b/frontend/src/components/utils/LabeledLinearProgress.tsx @@ -10,25 +10,40 @@ 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(); + + const segments = Array.from({ length: 5 }, (_, index) => ( +
+ )); + return ( - - - - - - {`${value.toFixed(1)}`} - - +
+ {segments} + + {`${value.toFixed(1)}`} + +
); } diff --git a/frontend/src/pages/ApartmentPage.tsx b/frontend/src/pages/ApartmentPage.tsx index c863b2e4..ed9e7607 100644 --- a/frontend/src/pages/ApartmentPage.tsx +++ b/frontend/src/pages/ApartmentPage.tsx @@ -534,7 +534,6 @@ const ApartmentPage = ({ user, setUser }: Props): ReactElement => { ); - const InfoSection = landlordData && ( Date: Sun, 1 Oct 2023 20:59:48 -0400 Subject: [PATCH 2/4] apartmentPage redesign to fit figma --- frontend/src/pages/ApartmentPage.tsx | 163 ++++++++++++++------------- 1 file changed, 83 insertions(+), 80 deletions(-) diff --git a/frontend/src/pages/ApartmentPage.tsx b/frontend/src/pages/ApartmentPage.tsx index ed9e7607..6116483e 100644 --- a/frontend/src/pages/ApartmentPage.tsx +++ b/frontend/src/pages/ApartmentPage.tsx @@ -340,7 +340,7 @@ const ApartmentPage = ({ user, setUser }: Props): ReactElement => { const Header = ( <> - + Reviews ({reviewData.length}) {reviewData.length === 0 && ( @@ -362,6 +362,18 @@ const ApartmentPage = ({ user, setUser }: Props): ReactElement => { )} + + + + {landlordData && landlordData.photos.length > 0 && ( @@ -377,42 +389,8 @@ const ApartmentPage = ({ user, setUser }: Props): ReactElement => { - - - - - - - Sort by: - - - { - setSortBy('date'); - }, - }, - { - item: 'Helpful', - callback: () => { - setSortBy('likes'); - }, - }, - ]} - /> - - - + + @@ -535,7 +513,7 @@ const ApartmentPage = ({ user, setUser }: Props): ReactElement => { ); const InfoSection = landlordData && ( - + { - + {isMobile ? MobileHeader : Header} {!isMobile && {InfoSection}} {showConfirmation && ( @@ -583,51 +561,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} From 3e7d792b034cf4a34c16dfee6b84a402ad0217be Mon Sep 17 00:00:00 2001 From: Cyrus Irani Date: Fri, 20 Oct 2023 15:23:00 -0400 Subject: [PATCH 3/4] finished the review bar segments to display correctly --- frontend/src/colors.js | 1 + frontend/src/components/Review/ReviewHeader.tsx | 2 +- .../src/components/utils/LabeledLinearProgress.tsx | 13 +++++++++++-- frontend/src/pages/ApartmentPage.tsx | 7 ++++++- 4 files changed, 19 insertions(+), 4 deletions(-) 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 f425f2c7..51dd25df 100644 --- a/frontend/src/components/utils/LabeledLinearProgress.tsx +++ b/frontend/src/components/utils/LabeledLinearProgress.tsx @@ -1,4 +1,5 @@ import React, { ReactElement } from 'react'; +import { colors } from '../../colors'; import Box from '@material-ui/core/Box'; import LinearProgress from '@material-ui/core/LinearProgress'; import Typography from '@material-ui/core/Typography'; @@ -27,13 +28,21 @@ const useStyles = makeStyles((theme) => ({ export default function LabeledLinearProgress({ value }: Props): ReactElement { 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, }} >
)); diff --git a/frontend/src/pages/ApartmentPage.tsx b/frontend/src/pages/ApartmentPage.tsx index 6116483e..9aed5f17 100644 --- a/frontend/src/pages/ApartmentPage.tsx +++ b/frontend/src/pages/ApartmentPage.tsx @@ -338,6 +338,8 @@ const ApartmentPage = ({ user, setUser }: Props): ReactElement => { ); const Header = ( + // Header section with review count, average rating, and leave review button + <> @@ -349,7 +351,7 @@ const ApartmentPage = ({ user, setUser }: Props): ReactElement => { {reviewData.length > 0 && ( - + @@ -524,10 +526,13 @@ const ApartmentPage = ({ user, setUser }: Props): ReactElement => { ); 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 && ( From 16a14c0a094d8817f8f8313ed95f84405227477d Mon Sep 17 00:00:00 2001 From: Cyrus Irani Date: Fri, 20 Oct 2023 15:27:59 -0400 Subject: [PATCH 4/4] final changes --- frontend/src/components/utils/LabeledLinearProgress.tsx | 3 --- frontend/src/pages/ApartmentPage.tsx | 7 +++---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/utils/LabeledLinearProgress.tsx b/frontend/src/components/utils/LabeledLinearProgress.tsx index 51dd25df..900b9f14 100644 --- a/frontend/src/components/utils/LabeledLinearProgress.tsx +++ b/frontend/src/components/utils/LabeledLinearProgress.tsx @@ -1,9 +1,6 @@ import React, { ReactElement } from 'react'; import { colors } from '../../colors'; -import Box from '@material-ui/core/Box'; -import LinearProgress from '@material-ui/core/LinearProgress'; import Typography from '@material-ui/core/Typography'; -import styles from '../Review/Review.module.scss'; import { makeStyles } from '@material-ui/core'; type Props = { diff --git a/frontend/src/pages/ApartmentPage.tsx b/frontend/src/pages/ApartmentPage.tsx index 9aed5f17..f1e29536 100644 --- a/frontend/src/pages/ApartmentPage.tsx +++ b/frontend/src/pages/ApartmentPage.tsx @@ -141,9 +141,9 @@ const ApartmentPage = ({ user, setUser }: Props): ReactElement => { } }, [isMobile, reviewData.length]); - const handleShowMore = () => { - setResultsToShow(resultsToShow + 5); - }; + // const handleShowMore = () => { + // setResultsToShow(resultsToShow + 5); + // }; const handlePageNotFound = () => { setNotFound(true); @@ -159,7 +159,6 @@ const ApartmentPage = ({ user, setUser }: Props): ReactElement => { container, expand, expandOpen, - horizontalLine, } = useStyles(); useTitle(