import { ErrorBoundary } from '../../components/error-boundary'; import { usePageTitle } from '../../lib/hooks/use-page-title'; import { Box } from '../../components/competitions/box'; import { useT } from '../../lib/use-t'; import { useVegaWallet, useVegaWalletDialogStore } from '@vegaprotocol/wallet'; import { Loader, Splash } from '@vegaprotocol/ui-toolkit'; import { RainbowButton } from '../../components/rainbow-button'; import { Link, Navigate, useParams } from 'react-router-dom'; import { Links } from '../../lib/links'; import { useReferralSetTransaction } from '../../lib/hooks/use-referral-set-transaction'; import { type FormFields, TeamForm, TransactionType } from './team-form'; import { useTeam } from '../../lib/hooks/use-team'; import { LayoutWithGradient } from '../../components/layouts-inner'; export const CompetitionsUpdateTeam = () => { const t = useT(); usePageTitle([t('Competitions'), t('Update a team')]); const { pubKey, isReadOnly } = useVegaWallet(); const openWalletDialog = useVegaWalletDialogStore( (store) => store.openVegaWalletDialog ); const { teamId } = useParams<{ teamId: string }>(); if (!teamId) { return ; } return (

{t('Update a team')}

{pubKey && !isReadOnly ? ( ) : ( <>

{t('Connect to update the details of your team.')}

{t('Connect wallet')} )}
); }; const UpdateTeamFormContainer = ({ teamId, pubKey, }: { teamId: string; pubKey: string; }) => { const t = useT(); const { team, loading, error } = useTeam(teamId, pubKey); const { err, status, onSubmit } = useReferralSetTransaction({ onSuccess: () => { // NOOP }, }); if (loading) { return ; } if (error) { return ( {t('Something went wrong.')} {t("Go back to the team's profile")} ); } const isMyTeam = team?.referrer === pubKey; if (!isMyTeam) { return ; } const defaultValues: FormFields = { id: team.teamId, name: team.name, url: team.teamUrl, avatarUrl: team.avatarUrl, private: team.closed, allowList: team.allowList.join(','), }; return ( ); };