diff --git a/backend/core/settings.py b/backend/core/settings.py index dfac4a4..2dacb2f 100644 --- a/backend/core/settings.py +++ b/backend/core/settings.py @@ -69,8 +69,8 @@ MIDDLEWARE = [ "django.middleware.security.SecurityMiddleware", - "django.contrib.sessions.middleware.SessionMiddleware", "corsheaders.middleware.CorsMiddleware", + "django.contrib.sessions.middleware.SessionMiddleware", "django.middleware.common.CommonMiddleware", "django.middleware.csrf.CsrfViewMiddleware", "django.contrib.auth.middleware.AuthenticationMiddleware", @@ -80,10 +80,7 @@ CORS_ALLOWED_ORIGINS = [ "http://localhost:3000", - "http://auctions.microvaninc.com", - "http://www.auctions.microvaninc.com", - "https://auctions.microvaninc.com", - "https://www.auctions.microvaninc.com", + "https://www.auction.microvaninc.com", ] CORS_ALLOW_CREDENTIALS = True @@ -165,11 +162,6 @@ DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" -AUTHENTICATION_BACKENDS = [ - "django.contrib.auth.backends.ModelBackend", - "django_cognito_jwt.backend.JWTBackend", -] - REST_FRAMEWORK = { "DEFAULT_AUTHENTICATION_CLASSES": ( "django_cognito_jwt.JSONWebTokenAuthentication", diff --git a/frontend/src/components/buttons/AddToListButton.jsx b/frontend/src/components/buttons/AddToListButton.jsx index 40b2f20..26255d6 100644 --- a/frontend/src/components/buttons/AddToListButton.jsx +++ b/frontend/src/components/buttons/AddToListButton.jsx @@ -6,15 +6,14 @@ export default function AddToListButton({ onClick, size = 'sm' }) { + ); +} diff --git a/frontend/src/components/buttons/NextSimilarVehicleButton.jsx b/frontend/src/components/buttons/NextSimilarVehicleButton.jsx index b3a2185..d1985c7 100644 --- a/frontend/src/components/buttons/NextSimilarVehicleButton.jsx +++ b/frontend/src/components/buttons/NextSimilarVehicleButton.jsx @@ -16,7 +16,7 @@ export default function NextSimilarVehicleButton({ }`} >

Next

- + ); } diff --git a/frontend/src/components/buttons/PreviousSimilarVehicleButton.jsx b/frontend/src/components/buttons/PreviousSimilarVehicleButton.jsx index 056b6b0..f9f2d0e 100644 --- a/frontend/src/components/buttons/PreviousSimilarVehicleButton.jsx +++ b/frontend/src/components/buttons/PreviousSimilarVehicleButton.jsx @@ -16,7 +16,7 @@ export default function PreviousSimilarVehicleButton({ : 'text-mv-button-dark-grey border-button-dark-grey' }`} > - +

Prev

); diff --git a/frontend/src/components/buttons/RemoveFromListButton.jsx b/frontend/src/components/buttons/RemoveFromListButton.jsx index 79ab7bc..a3692a8 100644 --- a/frontend/src/components/buttons/RemoveFromListButton.jsx +++ b/frontend/src/components/buttons/RemoveFromListButton.jsx @@ -12,18 +12,16 @@ export default function RemoveFromListButton({ size, onClick }) { large: 'text-[18px]', }; - const sizeIconClass = { - small: 'w-[20px] h-[20px]', - large: 'w-[24px] h-[24px]', - }; - return ( diff --git a/frontend/src/components/dropdowns/FilterDropdown.jsx b/frontend/src/components/dropdowns/FilterDropdown.jsx index 4be5f25..c138603 100644 --- a/frontend/src/components/dropdowns/FilterDropdown.jsx +++ b/frontend/src/components/dropdowns/FilterDropdown.jsx @@ -45,7 +45,7 @@ export default function FilterDropdown({ title, items, onValueChange }) { diff --git a/frontend/src/components/footers/Footer.jsx b/frontend/src/components/footers/Footer.jsx index aa82128..8b2894c 100644 --- a/frontend/src/components/footers/Footer.jsx +++ b/frontend/src/components/footers/Footer.jsx @@ -35,7 +35,7 @@ export default function Footer() { { day: 'Saturday', hours: '8am-4pm' }, { day: 'Sunday', hours: 'Closed' }, ].map((schedule) => ( -
+

{schedule.day}

diff --git a/frontend/src/components/imageSlideshows/ImageSlideshow.jsx b/frontend/src/components/imageSlideshows/ImageSlideshow.jsx index 3788f15..2ad494a 100644 --- a/frontend/src/components/imageSlideshows/ImageSlideshow.jsx +++ b/frontend/src/components/imageSlideshows/ImageSlideshow.jsx @@ -35,18 +35,18 @@ export default function ImageSlideshow({ images }) { return (
-
+
{`Vehicle {currentIndex < images.length - 1 && (
- +
)} {currentIndex > 0 && ( @@ -54,7 +54,10 @@ export default function ImageSlideshow({ images }) { onClick={goToPrevImage} className="absolute top-1/2 left-[10px] transform -translate-y-1/2 border border-solid border-mv-white rounded-full p-2 hover:cursor-pointer" > - +
)}
diff --git a/frontend/src/components/imageSlideshows/SimilarVehicleImageSlideshow.jsx b/frontend/src/components/imageSlideshows/SimilarVehicleImageSlideshow.jsx index d968620..3c56cf5 100644 --- a/frontend/src/components/imageSlideshows/SimilarVehicleImageSlideshow.jsx +++ b/frontend/src/components/imageSlideshows/SimilarVehicleImageSlideshow.jsx @@ -41,7 +41,7 @@ export default function SimilarVehicleImageSlideshow({ images }) { onClick={goToNextImage} className="absolute top-1/2 right-[10px] transform -translate-y-1/2 border border-solid border-mv-white rounded-full p-2 hover:cursor-pointer" > - +
)} {currentIndex > 0 && ( @@ -49,7 +49,10 @@ export default function SimilarVehicleImageSlideshow({ images }) { onClick={goToPrevImage} className="absolute top-1/2 left-[10px] transform -translate-y-1/2 border border-solid border-mv-white rounded-full p-2 hover:cursor-pointer" > - +
)}
diff --git a/frontend/src/components/modals/BiddingModal.jsx b/frontend/src/components/modals/BiddingModal.jsx index ce62f2c..07da419 100644 --- a/frontend/src/components/modals/BiddingModal.jsx +++ b/frontend/src/components/modals/BiddingModal.jsx @@ -1,80 +1,103 @@ -import React from 'react'; +import React, { useState, useEffect } from 'react'; +import DoNotDisturbOnOutlinedIcon from '@mui/icons-material/DoNotDisturbOnOutlined'; +import AddCircleOutlineOutlinedIcon from '@mui/icons-material/AddCircleOutlineOutlined'; +import BidNowButton from '../buttons/BidNowButton'; +import CancelButton from '../buttons/CancelButton'; -export default function BiddingModal({ isOpen, onClose, minimumBid }) { +export default function BiddingModal({ + isOpen, + onClose, + handleBidNow, + minimumBid, +}) { if (!isOpen) return null; - const [bidAmount, setBidAmount] = React.useState(minimumBid); + const increments = minimumBid > 100000 ? 5000 : 1000; + const [bidAmount, setBidAmount] = useState(minimumBid + increments); const handleBidChange = (e) => { const inputValue = e.target.value.substring(1); if (Number.isNaN(inputValue)) { - console.error('Invalid input: Please enter a number.'); return; } const newBid = parseInt(inputValue, 10); if (Number.isNaN(newBid)) { - console.error('Parsing error: Input is not a valid number.'); return; } setBidAmount(newBid > 0 ? newBid : 0); }; + const handleOutsideClick = (e) => { + if (e.target.id === 'modal-overlay') { + onClose(); + } + }; + + useEffect(() => { + window.addEventListener('click', handleOutsideClick); + return () => { + window.removeEventListener('click', handleOutsideClick); + }; + }, []); + return ( -
-
-

- Please insert your bid amount -

-

- Enter your maximum possible bid -

-
- - - -
-
- {/* Positions buttons vertically */} -
- - +
{personHover ? ( - + ) : ( - + )} {personHover && (
- + - + +
@@ -113,7 +113,10 @@ export default function HomePage() {

scroll down to bid

- +
diff --git a/frontend/src/pages/ListingsPage.jsx b/frontend/src/pages/ListingsPage.jsx index ef70ed3..24c19fd 100644 --- a/frontend/src/pages/ListingsPage.jsx +++ b/frontend/src/pages/ListingsPage.jsx @@ -53,7 +53,6 @@ export default function ListingsPage() { useEffect(() => { const fetchAuctionAndVehicles = async () => { try { - // Step 1: Fetch the current auction const currentAuctionResponse = await fetchData({ endpoint: '/v1/auctions/current', method: 'GET', diff --git a/frontend/src/pages/VehicleDetailsPage.jsx b/frontend/src/pages/VehicleDetailsPage.jsx index 4688a2c..7469100 100644 --- a/frontend/src/pages/VehicleDetailsPage.jsx +++ b/frontend/src/pages/VehicleDetailsPage.jsx @@ -19,14 +19,30 @@ import NextSimilarVehicleButton from '../components/buttons/NextSimilarVehicleBu import PreviousSimilarVehicleButton from '../components/buttons/PreviousSimilarVehicleButton'; import SimilarVehicleCard from '../components/cards/SimilarVehicleCard'; import useAxios from '../hooks/useAxios'; +import { convertSGTToLocalDateObject } from '../utils/dateTime'; +import BiddingModal from '../components/modals/BiddingModal'; export default function VehicleDetailsPage() { const navigate = useNavigate(); const { fetchData } = useAxios(); + const [auction, setAuction] = useState(null); const [vehicle, setVehicle] = useState(null); + const [bidModalOpen, setBidModalOpen] = useState(false); const { vehicleId } = useParams(); + useEffect(() => { + const fetchAuction = async () => { + const response = await fetchData({ + endpoint: '/v1/auctions/current', + method: 'GET', + }); + + setAuction(response.data); + }; + fetchAuction(); + }, []); + useEffect(() => { const fetchVehicleData = async () => { const response = await fetchData({ @@ -40,90 +56,115 @@ export default function VehicleDetailsPage() { fetchVehicleData(); }, [vehicleId]); + const startTime = convertSGTToLocalDateObject(auction?.start_time); + const endTime = convertSGTToLocalDateObject(auction?.end_time); + const currentDate = new Date(); + if (currentDate.getTime() > endTime.getTime()) { + startTime.setDate(startTime.getDate() + 1); + endTime.setDate(endTime.getDate() + 1); + } + return (
-
+
navigate('/listings')} className="flex gap-x-2 items-center hover:cursor-pointer" > - +

Back to available items

-
-
+
+
-
+

{vehicle?.description}

-
-
- -
-

Model

-

{vehicle?.model_number}

+
+
+
+ +
+

Model

+

{vehicle?.model_number}

+
+
+
+
+ +
+

Chassis

+

{vehicle?.chassis_number}

+
+
-
-
- +
-

Chassis

-

{vehicle?.chassis_number}

+

Engine no.

+

{vehicle?.engine_number}

-
- -
-

Engine no.

-

{vehicle?.engine_number}

-
+
+

+ Bid status: +

+

+ You haven't bid +

-
-
-

- Bid status: -

-

- You haven't bid -

-
-
-

- Current bid: -

-

- ₱210,000 -

-
-
-
- {}} size="lg" /> +
+

+ Current bid: +

+

+ ₱210,000 +

-
- {}} size="large" /> +
+
+ {}} size="lg" /> +
+
+ setBidModalOpen(true)} + size="lg" + /> +
-
+

Similar vehicles @@ -133,15 +174,23 @@ export default function VehicleDetailsPage() { {}} />

-
+
+ {bidModalOpen && ( + setBidModalOpen(false)} + handleBidNow={() => {}} + minimumBid={210000} + /> + )} -
+
diff --git a/frontend/tailwind.config.js b/frontend/tailwind.config.js index 69fbcff..c7159ea 100644 --- a/frontend/tailwind.config.js +++ b/frontend/tailwind.config.js @@ -19,6 +19,7 @@ module.exports = { 'button-disabled': '#D1D1D1', 'border-dark-grey': '#B7B7B7', 'onboarding-placeholder': '#D2D2D2', + 'icon-grey': '#7B7B7B', }, extend: { fontFamily: {