diff --git a/apps/trading/client-pages/competitions/competitions-team.tsx b/apps/trading/client-pages/competitions/competitions-team.tsx
index e0fd44a79..37e1f53e9 100644
--- a/apps/trading/client-pages/competitions/competitions-team.tsx
+++ b/apps/trading/client-pages/competitions/competitions-team.tsx
@@ -9,6 +9,10 @@ import {
Button,
VegaIcon,
VegaIconNames,
+ Tooltip,
+ TradingAnchorButton,
+ Intent,
+ CopyWithTooltip,
} from '@vegaprotocol/ui-toolkit';
import { TransferStatus, type Asset } from '@vegaprotocol/types';
import classNames from 'classnames';
@@ -18,6 +22,7 @@ import {
addDecimalsFormatNumberQuantum,
formatNumber,
getDateTimeFormat,
+ removePaginationWrapper,
} from '@vegaprotocol/utils';
import {
useTeam,
@@ -52,6 +57,7 @@ import {
ActiveRewardCard,
DispatchMetricInfo,
} from '../../components/rewards-container/reward-card';
+import { usePartyProfilesQuery } from '../../components/vega-wallet-connect-button/__generated__/PartyProfiles';
export const CompetitionsTeam = () => {
const t = useT();
@@ -140,11 +146,25 @@ const TeamPage = ({
const t = useT();
const [showGames, setShowGames] = useState(true);
+ const createdAt = new Date(team.createdAt);
+
+ const closedIndicator = team.closed ? (
+
+
+ {t('Private')}
+
+ ) : (
+
+
+ {t('Public')}
+
+ );
+
return (
@@ -331,13 +383,30 @@ const Games = ({
const Members = ({ members }: { members?: Member[] }) => {
const t = useT();
+ const partyIds = members?.map((m) => m.referee) || [];
+ const { data: profilesData } = usePartyProfilesQuery({
+ variables: {
+ partyIds,
+ },
+ skip: partyIds.length === 0,
+ });
+ const profiles = removePaginationWrapper(
+ profilesData?.partiesProfilesConnection?.edges
+ );
+
if (!members?.length) {
return {t('No members')}
;
}
const data = orderBy(
members.map((m) => ({
- referee: ,
+ referee: (
+
+ ),
rewards: formatNumber(m.totalQuantumRewards),
volume: formatNumber(m.totalQuantumVolume),
gamesPlayed: formatNumber(m.totalGamesPlayed),
@@ -351,7 +420,7 @@ const Members = ({ members }: { members?: Member[] }) => {
return (
{
const RefereeLink = ({
pubkey,
isCreator,
+ profiles,
}: {
pubkey: string;
isCreator: boolean;
+ profiles?: { partyId: string; alias: string }[];
}) => {
const t = useT();
const linkCreator = useLinks(DApp.Explorer);
const link = linkCreator(EXPLORER_PARTIES.replace(':id', pubkey));
+ const alias = profiles?.find((p) => p.partyId === pubkey)?.alias;
+
return (
- <>
+
- {truncateMiddle(pubkey)}
- {' '}
- {isCreator ? t('Owner') : ''}
- >
+ {alias || truncateMiddle(pubkey)}
+
+ {!alias && (
+
+
+
+
+
+ )}
+ {alias && (
+ {truncateMiddle(pubkey)}
+ )}
+ {isCreator && (
+
+ {t('Owner')}
+
+ )}
+
);
};
diff --git a/apps/trading/client-pages/competitions/join-team.tsx b/apps/trading/client-pages/competitions/join-team.tsx
index 156d52586..cec268331 100644
--- a/apps/trading/client-pages/competitions/join-team.tsx
+++ b/apps/trading/client-pages/competitions/join-team.tsx
@@ -70,6 +70,12 @@ export const JoinButton = ({
}) => {
const t = useT();
+ /**
+ * A team cannot be joined (closed) when set as such
+ * and the currently connected pubkey is not whitelisted.
+ */
+ const isTeamClosed = team.closed && !team.allowList.includes(pubKey || '');
+
if (!pubKey || isReadOnly) {
return (
@@ -79,8 +85,9 @@ export const JoinButton = ({
);
}
+
// Party is the creator of a team
- else if (partyTeam && partyTeam.referrer === pubKey) {
+ if (partyTeam && partyTeam.referrer === pubKey) {
// Party is the creator of THIS team
if (partyTeam.teamId === team.teamId) {
return (
@@ -105,8 +112,24 @@ export const JoinButton = ({
);
}
}
+
// Party is in a team, but not this one
- else if (partyTeam && partyTeam.teamId !== team.teamId) {
+ if (partyTeam && partyTeam.teamId !== team.teamId) {
+ // This team is closed.
+ if (isTeamClosed) {
+ return (
+
+
+ {t('Switch team')}{' '}
+
+
+ );
+ }
+ // This team is open.
return (
onJoin('switch')}
@@ -117,8 +140,9 @@ export const JoinButton = ({
);
}
+
// Joined. Current party is already in this team
- else if (partyTeam && partyTeam.teamId === team.teamId) {
+ if (partyTeam && partyTeam.teamId === team.teamId) {
return (
@@ -131,6 +155,17 @@ export const JoinButton = ({
);
}
+ // This team is closed.
+ if (isTeamClosed) {
+ return (
+
+
+ {t('Join team')}
+
+
+ );
+ }
+ // This team is open.
return (
onJoin('join')} intent={Intent.Primary}>
{t('Join team')}
diff --git a/apps/trading/components/competitions/competitions-leaderboard.tsx b/apps/trading/components/competitions/competitions-leaderboard.tsx
index a0e5e98c4..fdd428c81 100644
--- a/apps/trading/components/competitions/competitions-leaderboard.tsx
+++ b/apps/trading/components/competitions/competitions-leaderboard.tsx
@@ -67,7 +67,7 @@ export const CompetitionsLeaderboard = ({
),
earned: num(td.totalQuantumRewards),
games: num(td.totalGamesPlayed),
- status: td.closed ? t('Closed') : t('Open'),
+ status: td.closed ? t('Private') : t('Public'),
volume: num(td.totalQuantumVolume),
};
})}
diff --git a/apps/trading/e2e/tests/teams/test_teams.py b/apps/trading/e2e/tests/teams/test_teams.py
index 657533b07..b9e9917db 100644
--- a/apps/trading/e2e/tests/teams/test_teams.py
+++ b/apps/trading/e2e/tests/teams/test_teams.py
@@ -242,6 +242,7 @@ def test_team_page_games_table(team_page: Tuple[Page, str, str, VegaServiceNull]
expect(page.get_by_test_id("games-toggle")).to_have_text("Results (10)")
expect(page.get_by_test_id("rank-0")).to_have_text("1")
expect(page.get_by_test_id("epoch-0")).to_have_text("19")
+ expect(page.get_by_test_id("endtime-0")).to_be_visible()
expect(page.get_by_test_id("type-0")).to_have_text(
"Price maker fees paid • tDAI "
)
@@ -256,6 +257,9 @@ def test_team_page_members_table(team_page: Tuple[Page, str, str, VegaServiceNul
page.get_by_test_id("members-toggle").click()
expect(page.get_by_test_id("members-toggle")).to_have_text("Members (4)")
expect(page.get_by_test_id("referee-0")).to_be_visible()
+ expect(page.get_by_test_id("icon-question-mark").nth(0)).to_be_visible()
+ expect(page.get_by_test_id("referee-3").locator(".text-muted").nth(1)
+ ).to_have_text("Owner")
expect(page.get_by_test_id("joinedAt-0")).to_be_visible()
expect(page.get_by_test_id("joinedAtEpoch-0")).to_have_text("9")
@@ -263,6 +267,8 @@ def test_team_page_members_table(team_page: Tuple[Page, str, str, VegaServiceNul
def test_team_page_headline(team_page: Tuple[Page, str, str, VegaServiceNull]):
page, team_name, team_id, vega = team_page
expect(page.get_by_test_id("team-name")).to_have_text(team_name)
+ expect(page.get_by_test_id("icon-open-external").nth(1)).to_be_visible()
+ expect(page.get_by_test_id("icon-copy")).to_be_visible()
expect(page.get_by_test_id("members-count-stat")).to_have_text("4")
expect(page.get_by_test_id("total-games-stat")).to_have_text("1")
@@ -295,7 +301,7 @@ def test_leaderboard(competitions_page: Tuple[Page, str, VegaServiceNull]):
page.get_by_test_id("rank-1").locator(".text-vega-clight-500")
).to_have_count(1)
expect(page.get_by_test_id("team-1")).to_have_text(team_name)
- expect(page.get_by_test_id("status-1")).to_have_text("Open")
+ expect(page.get_by_test_id("status-1")).to_have_text("Public")
# FIXME: the numbers are different we need to clarify this with the backend
# expect(competitions_page.get_by_test_id("earned-1")).to_have_text("160")
@@ -320,7 +326,6 @@ def test_game_card(competitions_page: Tuple[Page, str, VegaServiceNull]):
"Price maker fees paid • tDAI"
)
expect(game_1.get_by_test_id("assessed-over")).to_have_text("15 epochs")
- page.pause()
expect(game_1.get_by_test_id("scope")).to_have_text("Eligible")
expect(game_1.get_by_test_id("staking-requirement")).to_have_text("-")
expect(game_1.get_by_test_id("average-position")).to_have_text("-")
diff --git a/libs/i18n/src/locales/en/trading.json b/libs/i18n/src/locales/en/trading.json
index b3cafeeae..faeccb2f8 100644
--- a/libs/i18n/src/locales/en/trading.json
+++ b/libs/i18n/src/locales/en/trading.json
@@ -18,6 +18,7 @@
"Anyone with the referral link can apply it to their key(s) of choice via an on chain transaction": "Anyone with the referral link can apply it to their key(s) of choice via an on chain transaction",
"Are you sure you want to join team: {{team}}": "Are you sure you want to join team: {{team}}",
"As a team creator, you cannot switch teams": "As a team creator, you cannot switch teams",
+ "You cannot join a private team": "You cannot join a private team",
"Assessed over": "Assessed over",
"Asset (1)": "Asset (1)",
"Assets": "Assets",
@@ -213,6 +214,8 @@
"Market triggers cancellation or governance vote has passed to cancel": "Market triggers cancellation or governance vote has passed to cancel",
"Markets": "Markets",
"Member ID": "Member ID",
+ "Member": "Member",
+ "You can set your pubkey alias by using the key selector in the top right corner.": "You can set your pubkey alias by using the key selector in the top right corner.",
"Members": "Members",
"Members ({{count}})": "Members ({{count}})",
"Menu": "Menu",
@@ -496,5 +499,9 @@
"{{distance}} ago": "{{distance}} ago",
"{{entity}} scope": "{{entity}} scope",
"{{instrumentCode}} liquidity provision": "{{instrumentCode}} liquidity provision",
- "{{reward}}x": "{{reward}}x"
+ "{{reward}}x": "{{reward}}x",
+ "Private": "Private",
+ "Public": "Public",
+ "Copy this page url.": "Copy this page url.",
+ "Visit the team's page.": "Visit the team's page."
}