diff --git a/apps/trading/client-pages/competitions/team-form.tsx b/apps/trading/client-pages/competitions/team-form.tsx index 9ed0393e0..01593a12a 100644 --- a/apps/trading/client-pages/competitions/team-form.tsx +++ b/apps/trading/client-pages/competitions/team-form.tsx @@ -6,6 +6,8 @@ import { TextArea, TradingButton, Intent, + VegaIcon, + VegaIconNames, } from '@vegaprotocol/ui-toolkit'; import { URL_REGEX, isValidVegaPublicKey } from '@vegaprotocol/utils'; @@ -17,6 +19,8 @@ import type { UpdateReferralSet, Status, } from '@vegaprotocol/wallet'; +import classNames from 'classnames'; +import { useLayoutEffect, useState } from 'react'; export type FormFields = { id: string; @@ -239,16 +243,52 @@ const SubmitButton = ({ text = t('Update'); } + let confirmedText = t('Created'); + if (type === TransactionType.UpdateReferralSet) { + confirmedText = t('Updated'); + } + if (status === 'requested') { text = t('Confirm in wallet...'); } else if (status === 'pending') { text = t('Confirming transaction...'); } + const [showConfirmed, setShowConfirmed] = useState(false); + useLayoutEffect(() => { + let to: ReturnType; + if (status === 'confirmed' && !showConfirmed) { + to = setTimeout(() => { + setShowConfirmed(true); + }, 100); + } + return () => { + clearTimeout(to); + }; + }, [showConfirmed, status]); + + const confirmed = ( + + {' '} + {confirmedText} + + ); + return ( - - {text} - +
+ + {text} + + {status === 'confirmed' && confirmed} +
); };