Skip to content

Commit

Permalink
Merge pull request #80 from Lor3wp/productButtonsLastFix
Browse files Browse the repository at this point in the history
Product buttons last fix
  • Loading branch information
karoliam authored Dec 7, 2023
2 parents ea7da8b + 581a137 commit 5d74b36
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/components/Calendar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const RentCalendar = ({ futureDates, setSelectedDate }) => {
};

const handleChange = (date) => {
date.setHours(date.getHours() + 12);
date.setHours(date.getHours() + 3);
setSelectedDate(date);
console.log(date.getHours());
};
Expand Down
12 changes: 6 additions & 6 deletions src/components/GoogleMaps.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ import PropTypes from 'prop-types';

const GoogleMap = ({ stationLocation }) => {
const generateMapSrc = (stationLocation) => {
if (stationLocation === 'Kivikon Sortti-asema') {
if (stationLocation === 'Kivikko') {
return 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2001.3118495403837!2d25.04846202088959!3d60.23680115201916!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x469208ea5370bfbd%3A0x29ed900154fccc6d!2sKivikon%20Sortti-asema!5e0!3m2!1sfi!2sfi!4v1698780242158!5m2!1sfi!2sfi';
} else if (stationLocation === 'Konalan Sortti-asema') {
} else if (stationLocation === 'Konala') {
return 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d1979.741006586516!2d24.83206717669943!3d60.251202336891524!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x468df655ff312c6b%3A0x97894bc0c7d3aa90!2sSortti-asema%20Konala!5e0!3m2!1sfi!2sfi!4v1698783872304!5m2!1sfi!2sfi';
} else if (stationLocation === 'Ruskeasannan Sortti-asema') {
} else if (stationLocation === 'Ruskeasanta') {
return 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d1975.58165076051!2d24.990991676704354!3d60.31997603133454!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x468df87e8b6a9c87%3A0xd1d40798f0ca8a2!2sSortti-asema%20Ruskeasanta!5e0!3m2!1sfi!2sfi!4v1698784191866!5m2!1sfi!2sfi';
} else if (stationLocation === 'Jorvaksen Sortti-asema') {
} else if (stationLocation === 'Jorvas') {
return 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d1986.6493313853439!2d24.520375576691134!3d60.13687084612163!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x468d8d1d863fd1bd%3A0x553c2ab46c5c2d83!2sJorvaksen%20Sortti-asema!5e0!3m2!1sfi!2sfi!4v1698784339873!5m2!1sfi!2sfi';
} else if (stationLocation === 'Ämmässuon Sortti-asema') {
} else if (stationLocation === 'Ämmässuo') {
return 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d1980.3584160766723!2d24.538450876698665!3d60.24098963771647!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x468dedf57a039571%3A0x850c4b3c115023fc!2sSortti-asema%20%C3%84mm%C3%A4ssuo!5e0!3m2!1sfi!2sfi!4v1698784496918!5m2!1sfi!2sfi';
} else if (stationLocation === 'Koivukylän Sortti-pienasema') {
} else if (stationLocation === 'Koivukylä') {
return 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d1975.7598799139714!2d25.058810976704134!3d60.31703003157269!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x469207f26a1e7bdd%3A0x299a920ce8e760ae!2sSortti-pienasema%20Koivukyl%C3%A4!5e0!3m2!1sfi!2sfi!4v1698784551749!5m2!1sfi!2sfi';
} else {
// Handle unknown station names or provide default map URL
Expand Down
14 changes: 12 additions & 2 deletions src/components/SelectProduct.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,28 @@ const SelectProduct = ({ stationName, setFutureDates, futureDates }) => {
setSelectedProduct,
selectAdaptor,
setSelectAdaptor,
stationsData
} = useStepper();
const { getRequest } = useApi();
const { t } = useTranslation();
const [localFutureDates, setLocalFutureDates] = useState(futureDates);
const [selectedStation, setSelectedStation] = useState([]);


const handleProductClick = async (product) => {
console.log('stationsdata', stationsData);
stationsData.map((station) => {
if(station.selected) {
console.log("stations", station.stationName);
setSelectedStation(station.stationName);
}
})

setSelectedProduct(product);
const response = await getRequest('/reserved-dates', {
station: stationName,
station: selectedStation,
product: selectedProduct,
});

// Extracting only the dates from the response arrays
const newDates = response.map((item) => item.date);
console.log(response);
Expand Down
12 changes: 1 addition & 11 deletions src/components/TimeForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,9 @@ const ProductAndTime = ({
/>
<div className={rentStyle.rentBox}>
<div className={rentStyle.productBox}>
{stationsData.map((station) => {
if (station.selected) {
return (

<SelectProduct
stationName={station.stationName}
setFutureDates={setFutureDates}
futureDates={futureDates}
key={station.stationName}
/>
);
}
return null;
})}{' '}
</div>
<hr />
<div className={rentStyle.calendarBox}>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/RentInfo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ const RentInfoPage = ({ handleItemReturned }) => {
)}
</Stack>
</Container>
<GoogleMap stationLocation={mockRentInfo.stationLocation} />
<GoogleMap stationLocation={rentInfo.station} />
</>
);
};
Expand Down

0 comments on commit 5d74b36

Please sign in to comment.