File tree Expand file tree Collapse file tree 6 files changed +13
-10
lines changed
Expand file tree Collapse file tree 6 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ const PlanPopup = ({ plan }: { plan: Plan }) => {
77 < Link to = { `/plans/${ plan . _id } ` } >
88 < div className = "flex gap-1 sm:w-xs sm:h-32" >
99 < img
10- className = "w-24 h-full object-cover rounded-sm hidden sm:block"
10+ className = "w-24 object-cover rounded-sm hidden sm:block"
1111 src = { plan . images [ 0 ] }
1212 alt = { plan . title }
1313 />
Original file line number Diff line number Diff line change @@ -12,14 +12,16 @@ const PlacesMarkers = function Markers() {
1212
1313 const handleClick = useCallback (
1414 ( placeId ?: string , location ?: [ number , number ] ) => {
15+ if ( selection && placeId === selection . placeId ) return ;
1516 if ( placeId ) setSelection ( { placeId, location, source : "marker" } ) ;
1617 } ,
17- [ setSelection ] ,
18+ [ selection , setSelection ] ,
1819 ) ;
1920
2021 const handleMouseOver = useCallback (
2122 ( placeId ?: string , location ?: [ number , number ] ) => {
2223 if ( placeId ) {
24+ if ( selection && placeId === selection . placeId ) return ;
2325 if ( mouseOverTimeoutRef . current )
2426 clearTimeout ( mouseOverTimeoutRef . current ) ;
2527 mouseOverTimeoutRef . current = window . setTimeout (
@@ -28,7 +30,7 @@ const PlacesMarkers = function Markers() {
2830 ) ;
2931 }
3032 } ,
31- [ setSelection ] ,
33+ [ selection , setSelection ] ,
3234 ) ;
3335
3436 const handleMouseOut = useCallback (
Original file line number Diff line number Diff line change @@ -55,9 +55,9 @@ const Popup = () => {
5555 if ( ! place ) return null ;
5656
5757 return (
58- < div className = "flex gap-1 sm:w-xs sm:h-32 " >
58+ < div className = "flex gap-1 sm:w-xs" >
5959 < img
60- className = "w-24 h-full object-cover rounded-sm hidden sm:block"
60+ className = "w-24 object-cover rounded-sm hidden sm:block"
6161 src = { place . imageURL }
6262 alt = { place . name }
6363 />
Original file line number Diff line number Diff line change @@ -53,9 +53,9 @@ const Markers = ({ stops }: { stops: StopType[] }) => {
5353 position = { selectedPlace . location }
5454 onClose = { handlePopupClose }
5555 >
56- < div className = "flex gap-1 sm:w-xs sm:h-32 " >
56+ < div className = "flex gap-1 sm:w-xs" >
5757 < img
58- className = "w-24 h-full object-cover rounded-sm hidden sm:block"
58+ className = "w-24 object-cover rounded-sm hidden sm:block"
5959 src = { selectedPlace . imageURL }
6060 alt = { selectedPlace . name }
6161 />
Original file line number Diff line number Diff line change @@ -10,9 +10,10 @@ const Markers = memo(function Markers() {
1010
1111 const handleClick = useCallback (
1212 ( placeId ?: string , location ?: [ number , number ] ) => {
13+ if ( selection && placeId === selection . placeId ) return ;
1314 if ( placeId ) setSelection ( { placeId, location, source : "marker" } ) ;
1415 } ,
15- [ setSelection ] ,
16+ [ selection , setSelection ] ,
1617 ) ;
1718
1819 const handlePopupClose = useCallback ( ( ) => {
Original file line number Diff line number Diff line change @@ -56,9 +56,9 @@ const PlacePopup = () => {
5656 if ( ! place ) return null ;
5757
5858 return (
59- < div className = "flex gap-1 sm:w-xs sm:h-32 " >
59+ < div className = "flex gap-1 sm:w-xs" >
6060 < img
61- className = "w-24 h-full object-cover rounded-sm hidden sm:block"
61+ className = "w-24 object-cover rounded-sm hidden sm:block"
6262 src = { place . imageURL }
6363 alt = { place . name }
6464 />
You can’t perform that action at this time.
0 commit comments