Skip to content

Commit

Permalink
Final fix for all pages and both mobile and desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
Falsal committed Aug 10, 2024
1 parent 0c24992 commit 5042598
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/components/Search/CityResultList.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export function CityResultList({
console.log("L76 ListItem, cityOne :", cityOne)

if(!!cityOne && !!idOne ){
console.log("L83 ==> idOne :", idOne)
setCityInput(_city.label);
setCity(_city.value)
navigate(`tour/${idOne}/${_city.value}`);
Expand Down
16 changes: 8 additions & 8 deletions src/components/Search/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { compose } from "redux";
import { connect, useSelector } from "react-redux";
import { loadCities } from "../../actions/cityActions";
import { Fragment, useEffect, useState } from "react";
import { useSearchParams } from "react-router-dom";
import { useSearchParams, useParams } from "react-router-dom";
import {
parseIfNeccessary,
setOrRemoveSearchParam,
Expand Down Expand Up @@ -48,8 +48,8 @@ export function Search({
setFilterValues,
filterValues,
mapBounds,
idOne,
cityOne
// idOne,
// cityOne
}) {
//navigation
const navigate = useNavigate();
Expand All @@ -72,7 +72,7 @@ export function Search({
let suggestion; //variable that stores the text of the selected option
const urlSearchParams = new URLSearchParams(window.location.search);
const cityParam = urlSearchParams.get("city");
// const { cityOne, idOne } = useParams();
const { cityOne, idOne } = useParams();
const [city, setCity] = useState({
label: capitalize(cityParam) || capitalize(cityOne),
value: cityParam,
Expand All @@ -85,7 +85,7 @@ export function Search({
console.log("L75 Search/ cityParam", cityParam);
console.log("L75 Search/ city", city);

}, []);
}, [city, cityParam]);

const [region, setRegion] = useState(null);
// const initialIsMapView = (searchParams.has('map') && (searchParams.get('map') === 'true')) || false;
Expand Down Expand Up @@ -449,7 +449,7 @@ export function Search({
console.log("YOU ARE AT L438 !")
setCityInput(city.label);
setCity(city.value);
navigate(`tour/${idOne.idOne}/${city.value}`);
navigate(`tour/${idOne}/${city.value}`);
} else if (!!city) {
setCityInput(city.label);
setCity(city);
Expand All @@ -459,8 +459,8 @@ export function Search({
}
hideModal();
},
cityOne: { cityOne },
idOne: { idOne },
cityOne: cityOne ,
idOne: idOne ,
setSearchParams,
title: "",
sourceCall: "city",
Expand Down

0 comments on commit 5042598

Please sign in to comment.