Skip to content

Commit

Permalink
front: remove state value isActive in ButtonMapInfraErrrors
Browse files Browse the repository at this point in the history
Signed-off-by: Clara Ni <[email protected]>
  • Loading branch information
clarani committed Feb 6, 2025
1 parent c3a63cc commit 66a9cad
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions front/src/common/Map/Buttons/ButtonMapInfraErrors.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { useState } from 'react';

import cx from 'classnames';
import { useTranslation } from 'react-i18next';
import { BsExclamationOctagon } from 'react-icons/bs';
Expand All @@ -15,21 +13,19 @@ interface ButtonMapInfraErrorsProps {
const ButtonMapInfraErrors = ({ editorState }: ButtonMapInfraErrorsProps) => {
const dispatch = useAppDispatch();
const { t } = useTranslation('translation');
const [isActive, setIsActive] = useState(false);

const toggleInfraErrors = () => {
const newSet = new Set<Layer>(editorState.editorLayers);
if (newSet.has('errors')) newSet.delete('errors');
else newSet.add('errors');
dispatch(editorSliceActions.selectLayers(newSet));
setIsActive(!isActive);
};

return (
<button
type="button"
className={cx('editor-btn btn-rounded', {
active: isActive,
active: editorState.editorLayers.has('errors'),
})}
aria-label={t('common.toggleInfraErrors')}
title={t('common.toggleInfraErrors')}
Expand Down

0 comments on commit 66a9cad

Please sign in to comment.