Merged in fix/SW-1111-r2 (pull request #1169)
fix(SW-1111) Fix issues with map Approved-by: Niclas Edenvin
This commit is contained in:
@@ -36,6 +36,7 @@ import {
|
|||||||
|
|
||||||
export default function FilterAndSortModal({
|
export default function FilterAndSortModal({
|
||||||
filters,
|
filters,
|
||||||
|
setShowSkeleton,
|
||||||
}: FilterAndSortModalProps) {
|
}: FilterAndSortModalProps) {
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
useInitializeFiltersFromUrl()
|
useInitializeFiltersFromUrl()
|
||||||
@@ -65,6 +66,9 @@ export default function FilterAndSortModal({
|
|||||||
|
|
||||||
const handleApplyFiltersAndSorting = useCallback(
|
const handleApplyFiltersAndSorting = useCallback(
|
||||||
(close: () => void) => {
|
(close: () => void) => {
|
||||||
|
if (setShowSkeleton) {
|
||||||
|
setShowSkeleton(true)
|
||||||
|
}
|
||||||
if (sort === searchParams.get("sort")) {
|
if (sort === searchParams.get("sort")) {
|
||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
@@ -78,8 +82,13 @@ export default function FilterAndSortModal({
|
|||||||
`${pathname}?${newSearchParams.toString()}`
|
`${pathname}?${newSearchParams.toString()}`
|
||||||
)
|
)
|
||||||
close()
|
close()
|
||||||
|
if (setShowSkeleton) {
|
||||||
|
setTimeout(() => {
|
||||||
|
setShowSkeleton(false)
|
||||||
|
}, 500)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
[pathname, searchParams, sort]
|
[pathname, searchParams, sort, setShowSkeleton]
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ export default function SelectHotelContent({
|
|||||||
className={styles.closeButton}
|
className={styles.closeButton}
|
||||||
asChild
|
asChild
|
||||||
>
|
>
|
||||||
<Link href={selectHotel(lang)} keepSearchParams>
|
<Link href={selectHotel(lang)} keepSearchParams prefetch>
|
||||||
<CloseIcon color="burgundy" />
|
<CloseIcon color="burgundy" />
|
||||||
{intl.formatMessage({ id: "Close the map" })}
|
{intl.formatMessage({ id: "Close the map" })}
|
||||||
</Link>
|
</Link>
|
||||||
@@ -138,7 +138,10 @@ export default function SelectHotelContent({
|
|||||||
<CloseLargeIcon />
|
<CloseLargeIcon />
|
||||||
</Link>
|
</Link>
|
||||||
</Button>
|
</Button>
|
||||||
<FilterAndSortModal filters={filterList} />
|
<FilterAndSortModal
|
||||||
|
filters={filterList}
|
||||||
|
setShowSkeleton={setShowSkeleton}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{showSkeleton ? (
|
{showSkeleton ? (
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import { debounce } from "@/utils/debounce"
|
|||||||
import styles from "./mapModal.module.css"
|
import styles from "./mapModal.module.css"
|
||||||
|
|
||||||
export function MapContainer({ children }: { children: React.ReactNode }) {
|
export function MapContainer({ children }: { children: React.ReactNode }) {
|
||||||
const [mapHeight, setMapHeight] = useState("0px")
|
const [mapHeight, setMapHeight] = useState("")
|
||||||
const [mapTop, setMapTop] = useState("0px")
|
const [mapTop, setMapTop] = useState("")
|
||||||
const [mapZIndex, setMapZIndex] = useState(0)
|
const [mapZIndex, setMapZIndex] = useState(0)
|
||||||
const [scrollHeightWhenOpened, setScrollHeightWhenOpened] = useState(0)
|
const [scrollHeightWhenOpened, setScrollHeightWhenOpened] = useState(0)
|
||||||
|
|
||||||
|
|||||||
@@ -18,4 +18,5 @@
|
|||||||
left: 0;
|
left: 0;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
right: 0;
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { CategorizedFilters } from "./hotelFilters"
|
import type { CategorizedFilters } from "./hotelFilters"
|
||||||
|
|
||||||
export type FilterAndSortModalProps = {
|
export type FilterAndSortModalProps = {
|
||||||
filters: CategorizedFilters
|
filters: CategorizedFilters
|
||||||
|
setShowSkeleton?: (showSkeleton: boolean) => void
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user