From c796163cfbbcc41e8c8a2b4b38128636d090e1ba Mon Sep 17 00:00:00 2001 From: Samman Adhikari Date: Mon, 1 Aug 2022 19:18:27 +0545 Subject: [PATCH] 1. Model closed 2. Account selected --- .../components/WatchAccountButton.tsx | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/renderer/components/WatchAccountButton.tsx b/src/renderer/components/WatchAccountButton.tsx index 887e338a..5a23fced 100644 --- a/src/renderer/components/WatchAccountButton.tsx +++ b/src/renderer/components/WatchAccountButton.tsx @@ -6,11 +6,13 @@ import Form from 'react-bootstrap/Form'; import OverlayTrigger from 'react-bootstrap/OverlayTrigger'; import Popover from 'react-bootstrap/Popover'; import { logger } from '../common/globals'; +import { setSelected } from '../data/SelectedAccountsList/selectedAccountsState'; +import { useAppDispatch } from '../hooks'; function WatchAcountPopover(props: { - pinAccount: (pk: string, b: boolean) => void; + onWatch: (pk: string, b: boolean) => void; }) { - const { pinAccount } = props; + const { onWatch } = props; const pubKeyVal = ''; @@ -74,7 +76,7 @@ function WatchAcountPopover(props: { type="button" disabled={validationError || !toKey} onClick={() => { - pinAccount(toKey, false); + onWatch(toKey, false); }} > Watch @@ -91,15 +93,29 @@ function WatchAccountButton(props: { pinAccount: (pk: string, b: boolean) => void; }) { const { pinAccount } = props; + const [show, setShow] = useState(false); + const dispatch = useAppDispatch(); + + const handleWatch = (toKey, isPinned) => { + pinAccount(toKey, isPinned); + dispatch(setSelected(toKey)); + setShow(false); + }; return ( -