Add popup confirm mode, make on-demand mean connect+get_public_key

This commit is contained in:
artur
2024-02-06 11:41:51 +03:00
parent fa4c5d3532
commit 14940a4345
5 changed files with 51 additions and 20 deletions

View File

@@ -55,6 +55,7 @@ export const ModalConfirmEvent: FC<ModalConfirmEventProps> = ({
const [searchParams] = useSearchParams()
const appNpub = searchParams.get('appNpub') || ''
const isPopup = searchParams.get('popup') === 'true'
const { npub = '' } = useParams<{ npub: string }>()
const apps = useAppSelector((state) => selectAppsByNpub(state, npub))
@@ -118,6 +119,7 @@ export const ModalConfirmEvent: FC<ModalConfirmEventProps> = ({
})
})
closeModalAfterRequest()
if (isPopup) window.close();
}
const handleChangeCheckbox = (reqId: string) => () => {
@@ -137,8 +139,20 @@ export const ModalConfirmEvent: FC<ModalConfirmEventProps> = ({
return action
}
if (isPopup) {
document.addEventListener('visibilitychange', () => {
if (document.visibilityState == 'hidden') {
confirmPending(false);
}
})
}
return (
<Modal open={isModalOpened} onClose={handleCloseModal}>
<Modal
open={isModalOpened}
withCloseButton={!isPopup}
onClose={!isPopup ? handleCloseModal : undefined}
>
<Stack gap={'1rem'} paddingTop={'1rem'}>
<Stack
direction={'row'}