-
Notifications
You must be signed in to change notification settings - Fork 306
/
Modal.tsx
26 lines (25 loc) · 1.01 KB
/
Modal.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import type { PersonaInformation, SingletonModalRefCreator } from '@masknet/shared-base'
import { forwardRef, useState } from 'react'
import { VerifyNextIDDialog, type VerifyNextIDDialogCloseProps, type VerifyNextIDDialogProps } from './index.js'
import { useSingletonModal } from '@masknet/shared-base-ui'
export const VerifyNextIDModal = forwardRef<
SingletonModalRefCreator<VerifyNextIDDialogProps, VerifyNextIDDialogCloseProps>
>(function VerifyNextIDModal(props, ref) {
const [personaInfo, setPersonaInfo] = useState<PersonaInformation>()
const [open, dispatch] = useSingletonModal(ref, {
onOpen(props) {
setPersonaInfo(props.personaInfo)
},
})
if (!open || !personaInfo) return null
return (
<VerifyNextIDDialog
personaInfo={personaInfo}
onClose={() => dispatch?.close({ aborted: true })}
onSentPost={(res) => {
if (!dispatch || !res) return
dispatch.close(res)
}}
/>
)
})