diff --git a/apps/trading/client-pages/competitions/competitions-create-team.tsx b/apps/trading/client-pages/competitions/competitions-create-team.tsx index e8ead8e9e..31906568d 100644 --- a/apps/trading/client-pages/competitions/competitions-create-team.tsx +++ b/apps/trading/client-pages/competitions/competitions-create-team.tsx @@ -31,7 +31,7 @@ export const CompetitionsCreateTeam = () => {

- {t('Create a team')} + {isSolo ? t('Create solo team') : t('Create a team')}

{pubKey && !isReadOnly ? ( @@ -125,7 +125,7 @@ const CreateTeamFormContainer = ({ isSolo }: { isSolo: boolean }) => { onSubmit={onSubmit} status={status} err={err} - isSolo={isSolo} + isCreatingSoloTeam={isSolo} /> ); }; diff --git a/apps/trading/client-pages/competitions/competitions-home.tsx b/apps/trading/client-pages/competitions/competitions-home.tsx index bfe1ed1c7..4b933f716 100644 --- a/apps/trading/client-pages/competitions/competitions-home.tsx +++ b/apps/trading/client-pages/competitions/competitions-home.tsx @@ -31,10 +31,7 @@ export const CompetitionsHome = () => { currentEpoch, }); - const { data: teamsData, loading: teamsLoading } = useTeams({ - sortByField: ['totalQuantumRewards'], - order: 'desc', - }); + const { data: teamsData, loading: teamsLoading } = useTeams(); return ( diff --git a/apps/trading/client-pages/competitions/competitions-team.tsx b/apps/trading/client-pages/competitions/competitions-team.tsx index fb03b71d3..be3157636 100644 --- a/apps/trading/client-pages/competitions/competitions-team.tsx +++ b/apps/trading/client-pages/competitions/competitions-team.tsx @@ -38,12 +38,11 @@ export const CompetitionsTeam = () => { const TeamPageContainer = ({ teamId }: { teamId: string | undefined }) => { const t = useT(); const { pubKey } = useVegaWallet(); - const { team, partyTeam, stats, members, games, loading, refetch } = useTeam( - teamId, - pubKey || undefined - ); + const { data, team, partyTeam, stats, members, games, loading, refetch } = + useTeam(teamId, pubKey || undefined); - if (loading) { + // only show spinner on first load so when users join teams its smoother + if (!data && loading) { return ( @@ -100,8 +99,10 @@ const TeamPage = ({ > {team.name} - - +
+ + +
@@ -184,7 +185,10 @@ const Members = ({ members }: { members?: Member[] }) => { const data = orderBy( members.map((m) => ({ - referee: , + referee: , + rewards: formatNumber(m.totalQuantumRewards), + volume: formatNumber(m.totalQuantumVolume), + gamesPlayed: formatNumber(m.totalGamesPlayed), joinedAt: getDateTimeFormat().format(new Date(m.joinedAt)), joinedAtEpoch: Number(m.joinedAtEpoch), })), @@ -195,7 +199,10 @@ const Members = ({ members }: { members?: Member[] }) => { return ( { ); }; -const RefereeLink = ({ pubkey }: { pubkey: string }) => { +const RefereeLink = ({ + pubkey, + isCreator, +}: { + pubkey: string; + isCreator: boolean; +}) => { + const t = useT(); const linkCreator = useLinks(DApp.Explorer); const link = linkCreator(EXPLORER_PARTIES.replace(':id', pubkey)); return ( - - {truncateMiddle(pubkey)} - + <> + + {truncateMiddle(pubkey)} + {' '} + {isCreator ? t('Owner') : ''} + ); }; diff --git a/apps/trading/client-pages/competitions/competitions-teams.tsx b/apps/trading/client-pages/competitions/competitions-teams.tsx index ecc716e43..bda7b8ab7 100644 --- a/apps/trading/client-pages/competitions/competitions-teams.tsx +++ b/apps/trading/client-pages/competitions/competitions-teams.tsx @@ -17,10 +17,7 @@ export const CompetitionsTeams = () => { usePageTitle([t('Competitions'), t('Teams')]); - const { data: teamsData, loading: teamsLoading } = useTeams({ - sortByField: ['totalQuantumRewards'], - order: 'desc', - }); + const { data: teamsData, loading: teamsLoading } = useTeams(); const inputRef = useRef(null); const [filter, setFilter] = useState(undefined); diff --git a/apps/trading/client-pages/competitions/competitions-update-team.tsx b/apps/trading/client-pages/competitions/competitions-update-team.tsx index 1ccad1a89..f0dae7c88 100644 --- a/apps/trading/client-pages/competitions/competitions-update-team.tsx +++ b/apps/trading/client-pages/competitions/competitions-update-team.tsx @@ -98,7 +98,7 @@ const UpdateTeamFormContainer = ({ type={TransactionType.UpdateReferralSet} status={status} err={err} - isSolo={team.closed} + isCreatingSoloTeam={team.closed} onSubmit={onSubmit} defaultValues={defaultValues} /> diff --git a/apps/trading/client-pages/competitions/join-team.tsx b/apps/trading/client-pages/competitions/join-team.tsx index 190d23265..0d583f5a0 100644 --- a/apps/trading/client-pages/competitions/join-team.tsx +++ b/apps/trading/client-pages/competitions/join-team.tsx @@ -6,11 +6,7 @@ import { VegaIcon, VegaIconNames, } from '@vegaprotocol/ui-toolkit'; -import { - useSimpleTransaction, - useVegaWallet, - type Status, -} from '@vegaprotocol/wallet'; +import { useSimpleTransaction, useVegaWallet } from '@vegaprotocol/wallet'; import { useT } from '../../lib/use-t'; import { type Team } from '../../lib/hooks/use-team'; import { useState } from 'react'; @@ -27,19 +23,8 @@ export const JoinTeam = ({ refetch: () => void; }) => { const { pubKey, isReadOnly } = useVegaWallet(); - const { send, status } = useSimpleTransaction({ - onSuccess: refetch, - }); const [confirmDialog, setConfirmDialog] = useState(); - const joinTeam = () => { - send({ - joinTeam: { - id: team.teamId, - }, - }); - }; - return ( <> setConfirmDialog(undefined)} + refetch={refetch} /> )} @@ -110,7 +94,7 @@ export const JoinButton = ({ // Not creator of the team, but still can't switch because // creators cannot leave their own team return ( - + @@ -149,21 +133,39 @@ export const JoinButton = ({ const DialogContent = ({ type, - status, team, partyTeam, - onConfirm, onCancel, + refetch, }: { type: JoinType; - status: Status; team: Team; partyTeam?: Team; - onConfirm: () => void; onCancel: () => void; + refetch: () => void; }) => { const t = useT(); + const { send, status, error } = useSimpleTransaction({ + onSuccess: refetch, + }); + + const joinTeam = () => { + send({ + joinTeam: { + id: team.teamId, + }, + }); + }; + + if (error) { + return ( +

+ {error} +

+ ); + } + if (status === 'requested') { return

{t('Confirm in wallet...')}

; } @@ -213,7 +215,7 @@ const DialogContent = ({ )}
-