Skip to content

Commit

Permalink
Fix landing to globe pages unwanted navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
barbara-chaves committed Oct 31, 2024
1 parent 8dfb783 commit e171807
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion client/src/components/map/legend/item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/component
import LegendItemToolbar from './toolbar';

export const LegendItem: React.FC<PropsWithChildren & LegendItemProps> = ({
id,
children,
name,
className = '',
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/globe/filters/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const Filters = ({ filtersActive }: FiltersProps) => {
</div>
<div>
<RadioGroup className="inline-flex flex-wrap gap-2" value={category || ''}>
{categoriesData?.data?.map(({ id, attributes }) => {
{categoriesData?.data?.map(({ attributes }) => {
if (attributes?.name && attributes?.slug) {
return (
<RadioGroupItem
Expand Down
5 changes: 4 additions & 1 deletion client/src/containers/map/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import { bboxAtom, layersInteractiveIdsAtom, tmpBboxAtom } from '@/store/map';

import { Bbox } from '@/types/map';

import { useIsMobile } from '@/hooks/screen-size';

import { MAPBOX_STYLES } from '@/constants/map';

import GlobeMarkers from '@/containers/map/markers/globe-markers';
Expand Down Expand Up @@ -120,6 +122,7 @@ export default function MapContainer() {

const targetRef = useRef<HTMLDivElement>(null);
const containerRef = useRef<HTMLDivElement>(null);
const isMobile = useIsMobile();

const { scrollYProgress } = useScroll({
target: targetRef,
Expand All @@ -131,7 +134,7 @@ export default function MapContainer() {
});

useMotionValueEvent(scrollYProgress, 'change', (v) => {
if (isLandingPage && v > 0.9) {
if (isLandingPage && isMobile && v > 0.9) {
router.push('/globe');
}
});
Expand Down
2 changes: 0 additions & 2 deletions client/src/lib/stories/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { MapRef } from 'react-map-gl';

import { GetCategoriesParams } from '@/types/generated/strapi.schemas';

export const getStoriesParams = (params?: {
Expand Down

0 comments on commit e171807

Please sign in to comment.