Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix max stack #1128

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading