import type { PasswordLimitsFragment } from '@affine/graphql'; import { useI18n } from '@affine/i18n'; import type { FC } from 'react'; import { useCallback, useRef, useState } from 'react'; import { Button } from '../../ui/button'; import { Wrapper } from '../../ui/layout'; import { PasswordInput } from './password-input'; export const SetPassword: FC<{ passwordLimits: PasswordLimitsFragment; showLater?: boolean; onLater?: () => void; onSetPassword: (password: string) => void; }> = ({ passwordLimits, onLater, onSetPassword, showLater = false }) => { const t = useI18n(); const [passwordPass, setPasswordPass] = useState(false); const passwordRef = useRef(''); return ( <> { setPasswordPass(true); passwordRef.current = password; }, [])} onPrevent={useCallback(() => { setPasswordPass(false); }, [])} /> {showLater ? ( ) : null} ); };