// Copyright 2017-2022 @polkadot/app-assets authors & contributors // SPDX-License-Identifier: Apache-2.0 import type { TeamState } from './types'; import React, { useEffect, useState } from 'react'; import { InputAddress, Modal } from '@polkadot/react-components'; import { useApi } from '@polkadot/react-hooks'; import { useTranslation } from '../../translate'; interface Props { accountId: string; className?: string; defaultValue: TeamState | null; onChange: (info: TeamState | null) => void; } function Team ({ accountId, className = '', defaultValue, onChange }: Props): React.ReactElement { const { t } = useTranslation(); const { api } = useApi(); const [initial] = useState(() => defaultValue); const [adminId, setAdminId] = useState(null); const [freezerId, setFreezerId] = useState(null); const [issuerId, setIssuerId] = useState(null); useEffect((): void => { onChange( adminId && freezerId && issuerId ? { adminId, freezerId, issuerId } : null ); }, [api, adminId, freezerId, issuerId, onChange]); return ( ('The account that is to be used for ongoing admin on the token.')}> ('admin account')} onChange={setAdminId} type='account' /> ('The account that is to be used for issuing this token.')}> ('issuer account')} onChange={setIssuerId} type='account' /> ('The account that is to be used for performing freezing.')}> ('freezer account')} onChange={setFreezerId} type='account' /> ); } export default React.memo(Team);