diff --git a/packages/page-treasury/src/Overview/TipEndorse.tsx b/packages/page-treasury/src/Overview/TipEndorse.tsx index 05aed04a9a..7316e2369b 100644 --- a/packages/page-treasury/src/Overview/TipEndorse.tsx +++ b/packages/page-treasury/src/Overview/TipEndorse.tsx @@ -3,9 +3,9 @@ // of the Apache-2.0 license. See the LICENSE file for details. import BN from 'bn.js'; -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { Button, InputAddress, InputBalance, Modal, TxButton } from '@polkadot/react-components'; -import { useToggle } from '@polkadot/react-hooks'; +import { useAccounts, useToggle } from '@polkadot/react-hooks'; import { useTranslation } from '../translate'; @@ -19,9 +19,17 @@ interface Props { function TipEndorse ({ hash, isMember, median, members }: Props): React.ReactElement { const { t } = useTranslation(); const [isOpen, toggleOpen] = useToggle(); + const { allAccounts } = useAccounts(); const [accountId, setAccountId] = useState(null); + const [defaultId, setDefaultId] = useState(null); const [value, setValue] = useState(); + useEffect((): void => { + setDefaultId( + members.find((memberId) => allAccounts.includes(memberId)) || null + ); + }, [allAccounts, members]); + return ( <>