+
{value}
diff --git a/apps/trading/lib/hooks/Teams.graphql b/apps/trading/lib/hooks/Teams.graphql
index be308f3bfa..b256c6a3c2 100644
--- a/apps/trading/lib/hooks/Teams.graphql
+++ b/apps/trading/lib/hooks/Teams.graphql
@@ -1,15 +1,20 @@
+fragment TeamsFields on Team {
+ teamId
+ referrer
+ name
+ teamUrl
+ avatarUrl
+ createdAt
+ createdAtEpoch
+ closed
+ totalMembers
+}
+
query Teams($teamId: ID, $partyId: ID) {
teams(teamId: $teamId, partyId: $partyId) {
edges {
node {
- teamId
- referrer
- name
- teamUrl
- avatarUrl
- createdAt
- createdAtEpoch
- closed
+ ...TeamsFields
}
}
}
diff --git a/apps/trading/lib/hooks/__generated__/Teams.ts b/apps/trading/lib/hooks/__generated__/Teams.ts
index 08b2f14326..ea610632bb 100644
--- a/apps/trading/lib/hooks/__generated__/Teams.ts
+++ b/apps/trading/lib/hooks/__generated__/Teams.ts
@@ -3,33 +3,40 @@ import * as Types from '@vegaprotocol/types';
import { gql } from '@apollo/client';
import * as Apollo from '@apollo/client';
const defaultOptions = {} as const;
+export type TeamsFieldsFragment = { __typename?: 'Team', teamId: string, referrer: string, name: string, teamUrl: string, avatarUrl: string, createdAt: any, createdAtEpoch: number, closed: boolean, totalMembers: number };
+
export type TeamsQueryVariables = Types.Exact<{
teamId?: Types.InputMaybe;
partyId?: Types.InputMaybe;
}>;
-export type TeamsQuery = { __typename?: 'Query', teams?: { __typename?: 'TeamConnection', edges: Array<{ __typename?: 'TeamEdge', node: { __typename?: 'Team', teamId: string, referrer: string, name: string, teamUrl: string, avatarUrl: string, createdAt: any, createdAtEpoch: number, closed: boolean } }> } | null };
-
+export type TeamsQuery = { __typename?: 'Query', teams?: { __typename?: 'TeamConnection', edges: Array<{ __typename?: 'TeamEdge', node: { __typename?: 'Team', teamId: string, referrer: string, name: string, teamUrl: string, avatarUrl: string, createdAt: any, createdAtEpoch: number, closed: boolean, totalMembers: number } }> } | null };
+export const TeamsFieldsFragmentDoc = gql`
+ fragment TeamsFields on Team {
+ teamId
+ referrer
+ name
+ teamUrl
+ avatarUrl
+ createdAt
+ createdAtEpoch
+ closed
+ totalMembers
+}
+ `;
export const TeamsDocument = gql`
query Teams($teamId: ID, $partyId: ID) {
teams(teamId: $teamId, partyId: $partyId) {
edges {
node {
- teamId
- referrer
- name
- teamUrl
- avatarUrl
- createdAt
- createdAtEpoch
- closed
+ ...TeamsFields
}
}
}
}
- `;
+ ${TeamsFieldsFragmentDoc}`;
/**
* __useTeamsQuery__
diff --git a/apps/trading/lib/hooks/use-my-team.ts b/apps/trading/lib/hooks/use-my-team.ts
new file mode 100644
index 0000000000..dac0ab6f27
--- /dev/null
+++ b/apps/trading/lib/hooks/use-my-team.ts
@@ -0,0 +1,25 @@
+import { useVegaWallet } from '@vegaprotocol/wallet';
+import compact from 'lodash/compact';
+import first from 'lodash/first';
+import { useTeamsQuery } from './__generated__/Teams';
+import { useTeam } from './use-team';
+import { useTeams } from './use-teams';
+
+export const useMyTeam = () => {
+ const { pubKey } = useVegaWallet();
+ const { data: teams } = useTeams();
+
+ const { data: maybeMyTeam } = useTeamsQuery({
+ variables: {
+ partyId: pubKey,
+ },
+ skip: !pubKey,
+ fetchPolicy: 'cache-and-network',
+ });
+
+ const team = first(compact(maybeMyTeam?.teams?.edges.map((n) => n.node)));
+ const rank = teams.findIndex((t) => t.teamId === team?.teamId) + 1;
+ const { games, stats } = useTeam(team?.teamId);
+
+ return { team, stats, games, rank };
+};
diff --git a/libs/i18n/src/locales/en/trading.json b/libs/i18n/src/locales/en/trading.json
index ed36da9732..82a2e0aeae 100644
--- a/libs/i18n/src/locales/en/trading.json
+++ b/libs/i18n/src/locales/en/trading.json
@@ -417,6 +417,7 @@
"myVolume_other": "My volume (last {{count}} epochs)",
"numberEpochs": "{{count}} epochs",
"numberEpochs_one": "{{count}} epoch",
+ "Rewards earned": "Rewards earned",
"Rewards paid out": "Rewards paid out",
"{{reward}}x": "{{reward}}x",
"userActive": "{{active}} trader: {{count}} epochs so far",
@@ -431,5 +432,19 @@
"{{assetSymbol}} Reward pot": "{{assetSymbol}} Reward pot",
"{{checkedAssets}} Assets": "{{checkedAssets}} Assets",
"{{distance}} ago": "{{distance}} ago",
- "{{instrumentCode}} liquidity provision": "{{instrumentCode}} liquidity provision"
+ "{{instrumentCode}} liquidity provision": "{{instrumentCode}} liquidity provision",
+ "My team": "My team",
+ "Profile": "Profile",
+ "Last {{games}} games result_one": "Last game result",
+ "Last {{games}} games result_other": "Last {{games}} games result",
+ "Leaderboard": "Leaderboard",
+ "View all teams": "View all teams",
+ "Competitions": "Competitions",
+ "Be a team player! Participate in games and work together to rake in as much profit to win.": "Be a team player! Participate in games and work together to rake in as much profit to win.",
+ "Create a public team": "Create a public team",
+ "Create a private team": "Create a private team",
+ "Choose a team": "Choose a team",
+ "Join a team": "Join a team",
+ "Solo team / lone wolf": "Solo team / lone wolf",
+ "Choose a team to get involved": "Choose a team to get involved"
}