Skip to content

Commit

Permalink
Merge pull request #1128 from Vizzuality/feature/error-upload
Browse files Browse the repository at this point in the history
fix max stack
  • Loading branch information
mluena authored May 30, 2024
2 parents 2d87e2c + 2ab4f34 commit d84cae5
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 40 deletions.
8 changes: 6 additions & 2 deletions src/containers/datasets/species-threatened/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
const Types = {
export type ThreatenedSpecies = 'ex' | 'ew' | 're' | 'cr' | 'en' | 'vu' | 'lr' | 'nt' | 'lc' | 'dd';

export type Colors = Partial<Record<ThreatenedSpecies, string>>;

export const Types: Record<string, ThreatenedSpecies> = {
EX: 'ex',
EW: 'ew',
RE: 're',
Expand All @@ -24,7 +28,7 @@ export const RED_LIST_CATEGORIES = {
[Types.DD]: 'Data Deficient',
};

export const COLORS = {
export const COLORS: Colors = {
ex: '#000000',
ew: '#542243',
cr: '#EE4D5A',
Expand Down
6 changes: 3 additions & 3 deletions src/containers/map/iucn-ecoregion-popup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import cn from 'lib/classnames';

import { AnimatePresence, motion } from 'framer-motion';

import { INFO } from 'containers/datasets';
// import { INFO } from 'containers/datasets';
import { COLORS } from 'containers/datasets/iucn-ecoregion/constants';
import { useMangroveEcoregions } from 'containers/datasets/iucn-ecoregion/hooks';
import type { IUCNEcoregionPopUpInfo, Label } from 'containers/datasets/iucn-ecoregion/types';

import { Dialog, DialogContent, DialogTrigger, DialogClose } from 'components/ui/dialog';
// import { Dialog, DialogContent, DialogTrigger, DialogClose } from 'components/ui/dialog';
import { WIDGET_CARD_WRAPPER_STYLE } from 'styles/widgets';

type Tags =
Expand Down Expand Up @@ -62,7 +62,7 @@ const FAKE_DATA_POP_UP = [
},
];

const Info = INFO['mangrove_iucn_ecoregion'];
// const Info = INFO['mangrove_iucn_ecoregion'];

const IucnEcoregionPopup = ({ info }: { info: IUCNEcoregionPopUpInfo }) => {
const [open, setOpen] = useState(false);
Expand Down
2 changes: 1 addition & 1 deletion src/containers/navigation/menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import Helper from 'containers/guide/helper';
import About from 'containers/navigation/menu/about';
import BlogContent from 'containers/news/content';

import { Media } from 'components/media-query';
import { Dialog, DialogContent, DialogClose, DialogTrigger } from 'components/ui/dialog';
import Icon from 'components/ui/icon';
import { Media } from 'components/media-query';

import GMA_PNG from 'images/gma.png';

Expand Down
50 changes: 16 additions & 34 deletions src/containers/widgets/widgets-menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,45 +62,27 @@ const WidgetsMenu: FC = () => {
if (newCat !== categorySelected) setCategory(newCat);
},

[activeWidgets, setActiveWidgets, setCategory, categorySelected]
[activeWidgets, setActiveWidgets, setCategory, categorySelected, widgets]
);

const handleAllWidgets = useCallback(() => {
activeWidgets.length === widgets.length ? setActiveWidgets([]) : setActiveWidgets(widgetsIds);
}, [widgetsIds, setActiveWidgets, activeWidgets]);
}, [widgetsIds, setActiveWidgets, activeWidgets, widgets]);

const handleAllLayers = useCallback(
(e) => {
if (activeLayers.length <= LAYERS.length) {
setActiveLayers([]);
}
if (LAYERS.length > activeLayers.length) {
const NewLayersActive: ActiveLayers[] = LAYERS.map((layer) => ({
id: layer.id as WidgetSlugType | ContextualBasemapsId | 'custom-area',
opacity: '1',
visibility: 'visible',
}));

setActiveLayers(NewLayersActive);
}

// const activeLayers = LAYERS.map((layer) => ({
// id: layer.id,
// opacity: '1',
// visibility: 'visible',
// }));
// e
// ? setActiveLayers(
// activeLayers as {
// id: WidgetSlugType | ContextualBasemapsId | 'custom-area';
// opacity: string;
// visibility: Visibility;
// }[]
// )
// : setActiveLayers([]);
},
[setActiveLayers]
);
const handleAllLayers = useCallback(() => {
if (activeLayers.length <= LAYERS.length && activeLayers.length > 0) {
setActiveLayers([]);
}
if (LAYERS.length > activeLayers.length) {
const NewLayersActive: ActiveLayers[] = LAYERS.map((layer) => ({
id: layer.id as WidgetSlugType | ContextualBasemapsId | 'custom-area',
opacity: '1',
visibility: 'visible',
}));

setActiveLayers(NewLayersActive);
}
}, [setActiveLayers, activeLayers]);

const handleLayers = useCallback(
(e: WidgetSlugType) => {
Expand Down

0 comments on commit d84cae5

Please sign in to comment.