From b355296753914ce8799748dc63f2513c659a2af1 Mon Sep 17 00:00:00 2001 From: Max Cao Date: Tue, 6 Sep 2022 06:24:46 -0700 Subject: [PATCH] fix(targets): disable delete button on non-custom targets (#502) * disable delete button on non-custom targets * fixed test * rename symbol * cleanup --- src/app/TargetSelect/TargetSelect.tsx | 5 +- .../__snapshots__/CreateRule.test.tsx.snap | 7 +-- src/test/Targets/TargetSelect.test.tsx | 53 ++++++++++++++----- 3 files changed, 48 insertions(+), 17 deletions(-) diff --git a/src/app/TargetSelect/TargetSelect.tsx b/src/app/TargetSelect/TargetSelect.tsx index 9c04e0016..3f15aa9c0 100644 --- a/src/app/TargetSelect/TargetSelect.tsx +++ b/src/app/TargetSelect/TargetSelect.tsx @@ -49,6 +49,7 @@ import { CreateTargetModal } from './CreateTargetModal'; import _ from 'lodash'; import { NotificationCategory } from '@app/Shared/Services/NotificationChannel.service'; +export const CUSTOM_TARGETS_REALM = "Custom Targets"; export interface TargetSelectProps { } @@ -62,7 +63,7 @@ export const TargetSelect: React.FunctionComponent = (props) const [isLoading, setLoading] = React.useState(false); const [isModalOpen, setModalOpen] = React.useState(false); const addSubscription = useSubscriptions(); - + const setCachedTargetSelection = React.useCallback((target) => { localStorage.setItem(TARGET_KEY, JSON.stringify(target)); }, [localStorage]); @@ -226,7 +227,7 @@ export const TargetSelect: React.FunctionComponent = (props) />