Skip to content

Commit

Permalink
Move atom to aois atoms
Browse files Browse the repository at this point in the history
  • Loading branch information
dzole0311 committed May 13, 2024
1 parent 5f1db8e commit acffd90
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
8 changes: 8 additions & 0 deletions app/scripts/components/common/map/controls/aoi/atoms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,12 @@ export const aoiDeleteAllAtom = atom(null, (get, set) => {
set(aoisSerialized, encodeAois([]));
});

// Atom that tracks whether an AOI can be edited or not.
export const selectedForEditingAtom = atomWithUrlValueStability({
initialValue: (new URLSearchParams(window.location.search).get('selectedForEditing') !== 'false'),
urlParam: 'selectedForEditing',
hydrate: (value) => value !== 'false',
dehydrate: (value) => value ? 'true' : 'false'
});

export const isDrawingAtom = atom(false);
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ import useMaps from '../../hooks/use-maps';
import useAois from '../hooks/use-aois';
import useThemedControl from '../hooks/use-themed-control';
import CustomAoIModal from './custom-aoi-modal';
import { aoiDeleteAllAtom } from './atoms';
import { aoiDeleteAllAtom, selectedForEditingAtom } from './atoms';
import PresetSelector from './preset-selector';
import { DIRECT_SELECT, DRAW_POLYGON, SIMPLE_SELECT, STATIC_MODE } from './';

import { TipToolbarIconButton } from '$components/common/tip-button';
import { Tip } from '$components/common/tip';
import { getZoomFromBbox } from '$components/common/map/utils';
import { ShortcutCode } from '$styles/shortcut-code';
import { selectedForEditingAtom } from '$components/exploration/atoms/selectedForEditing';

// 'moving' feature is disabled, match the cursor style accoringly
export const aoiCustomCursorStyle = css`
Expand Down
12 changes: 0 additions & 12 deletions app/scripts/components/exploration/atoms/selectedForEditing.ts

This file was deleted.

0 comments on commit acffd90

Please sign in to comment.