From 9e41f328e0911efcd3cfb0a81f9cda26c0fddd74 Mon Sep 17 00:00:00 2001 From: jackiettran <41605212+jackiettran@users.noreply.github.com> Date: Thu, 1 Jan 2026 17:17:02 -0500 Subject: [PATCH] layout and styling changes for RentItem --- frontend/src/pages/RentItem.tsx | 487 ++++++++++++++++---------------- 1 file changed, 249 insertions(+), 238 deletions(-) diff --git a/frontend/src/pages/RentItem.tsx b/frontend/src/pages/RentItem.tsx index ff08add..a923c39 100644 --- a/frontend/src/pages/RentItem.tsx +++ b/frontend/src/pages/RentItem.tsx @@ -25,7 +25,10 @@ const validateDates = ( // Check if end datetime is after start datetime if (endDateTime <= startDateTime) { - return { isValid: false, error: "End date/time must be after start date/time" }; + return { + isValid: false, + error: "End date/time must be after start date/time", + }; } return { isValid: true, error: null }; @@ -65,7 +68,9 @@ const RentItem: React.FC = () => { const [costLoading, setCostLoading] = useState(false); const [costError, setCostError] = useState(null); const [completed, setCompleted] = useState(false); - const [dateValidationError, setDateValidationError] = useState(null); + const [dateValidationError, setDateValidationError] = useState( + null + ); const formatDateTime = (date: Date | null) => { if (!date) return ""; @@ -229,266 +234,272 @@ const RentItem: React.FC = () => { } return ( -
-
-
-

Renting {item.name}

+
+
+
+
+

Complete Your Request

- {/* Email Verification Warning Banner */} - {user && !user.isVerified && ( -
- -
- Email verification required. Verify your email - to book rentals. + {/* Email Verification Warning Banner */} + {user && !user.isVerified && ( +
+ +
+ Email verification required. Verify your + email to book rentals. +
+
- -
- )} + )} - {error && ( -
- {error} -
- )} + {error && ( +
+ {error} +
+ )} -
- {/* Pricing Card - appears first on mobile, right side on desktop */} -
-
-
- {item.imageFilenames && item.imageFilenames[0] && ( - {item.name} { - const target = e.currentTarget; - if (!target.dataset.fallback) { - target.dataset.fallback = 'true'; - target.src = getImageUrl(item.imageFilenames[0], 'original'); - } - }} - style={{ - width: "100%", - height: "150px", - objectFit: "contain", - backgroundColor: "#f8f9fa", - }} - /> - )} - -
{item.name}
-

- {item.city && item.state - ? `${item.city}, ${item.state}` - : ""} -

- -
- - {/* Pricing */} -
- {totalCost === 0 ? ( -
Free to Borrow
- ) : ( - <> - {item.pricePerHour && Number(item.pricePerHour) > 0 && ( -
${Math.floor(Number(item.pricePerHour))}/Hour
- )} - {item.pricePerDay && Number(item.pricePerDay) > 0 && ( -
${Math.floor(Number(item.pricePerDay))}/Day
- )} - +
+ {/* Pricing Card - appears first on mobile, right side on desktop */} +
+
+
+ {item.imageFilenames && item.imageFilenames[0] && ( + {item.name} { + const target = e.currentTarget; + if (!target.dataset.fallback) { + target.dataset.fallback = "true"; + target.src = getImageUrl( + item.imageFilenames[0], + "original" + ); + } + }} + style={{ + width: "100%", + height: "150px", + objectFit: "contain", + backgroundColor: "#f8f9fa", + }} + /> )} -
- {/* Selected Dates */} - {rentalDates.startDateTime && rentalDates.endDateTime && ( -
-
- Check-in:{" "} - {formatDateTime(rentalDates.startDateTime)} -
-
- Check-out:{" "} - {formatDateTime(rentalDates.endDateTime)} -
-
- )} +
{item.name}
+

+ {item.city && item.state + ? `${item.city}, ${item.state}` + : ""} +

- {/* Total Cost */} - <>
-
- Total: - {costLoading ? ( -
- - Calculating... - -
- ) : costError ? ( - Error - ) : totalCost > 0 ? ( - ${totalCost} + + {/* Pricing */} +
+ {totalCost === 0 ? ( +
Free to Borrow
) : ( - $0 + <> + {item.pricePerHour && + Number(item.pricePerHour) > 0 && ( +
+ ${Math.floor(Number(item.pricePerHour))}/Hour +
+ )} + {item.pricePerDay && Number(item.pricePerDay) > 0 && ( +
${Math.floor(Number(item.pricePerDay))}/Day
+ )} + )}
- + + {/* Selected Dates */} + {rentalDates.startDateTime && rentalDates.endDateTime && ( +
+
+ Check-in:{" "} + {formatDateTime(rentalDates.startDateTime)} +
+
+ Check-out:{" "} + {formatDateTime(rentalDates.endDateTime)} +
+
+ )} + + {/* Total Cost */} + <> +
+
+ Total: + {costLoading ? ( +
+ + Calculating... + +
+ ) : costError ? ( + Error + ) : totalCost > 0 ? ( + ${totalCost} + ) : ( + $0 + )} +
+ +
-
- {/* Form - appears second on mobile, left side on desktop */} -
- {completed ? ( -
-
-
- -

Rental Request Sent!

-

- Your rental request has been submitted to the owner. - You'll only be charged if they approve your request. -

-
- - + {/* Form - appears second on mobile, left side on desktop */} +
+ {completed ? ( +
+
+
+ +

Rental Request Sent!

+

+ Your rental request has been submitted to the owner. + You'll only be charged if they approve your request. +

+
+ + +
-
- ) : ( -
-
-
- {totalCost === 0 - ? "Complete Your Borrow Request" - : "Complete Your Rental Request"} -
- {totalCost > 0 && ( -

- Add your payment method to complete your rental request. - You'll only be charged if the owner approves your - request. -

- )} - -
- -