diff --git a/apps/trading/client-pages/competitions/team-form.tsx b/apps/trading/client-pages/competitions/team-form.tsx
index 04f736d6b..33bc46ef6 100644
--- a/apps/trading/client-pages/competitions/team-form.tsx
+++ b/apps/trading/client-pages/competitions/team-form.tsx
@@ -46,7 +46,7 @@ const prepareTransaction = (
createReferralSet: {
isTeam: true,
team: {
- name: fields.name,
+ name: fields.name.trim(),
teamUrl: fields.url,
avatarUrl: fields.avatarUrl,
closed: fields.private,
@@ -62,7 +62,7 @@ const prepareTransaction = (
id: fields.id,
isTeam: true,
team: {
- name: fields.name,
+ name: fields.name.trim(),
teamUrl: fields.url,
avatarUrl: fields.avatarUrl,
closed: fields.private,
@@ -116,7 +116,17 @@ export const TeamForm = ({
{
+ if (/^\s*$/.test(value)) {
+ return t('Team name cannot be empty');
+ }
+ return true;
+ },
+ },
+ })}
data-testid="team-name-input"
/>
{errors.name?.message && (
diff --git a/apps/trading/components/competitions/competitions-leaderboard.tsx b/apps/trading/components/competitions/competitions-leaderboard.tsx
index 5a3291cc3..471de84cc 100644
--- a/apps/trading/components/competitions/competitions-leaderboard.tsx
+++ b/apps/trading/components/competitions/competitions-leaderboard.tsx
@@ -56,7 +56,10 @@ export const CompetitionsLeaderboard = ({
className="hover:underline"
to={Links.COMPETITIONS_TEAM(td.teamId)}
>
- {td.name}
+ {
+ // Its possible for a tx to be submitted with an empty space as team name
+ td.name.trim() !== '' ? td.name : t('[empty]')
+ }
),
earned: num(td.totalQuantumRewards),
diff --git a/libs/i18n/src/locales/en/trading.json b/libs/i18n/src/locales/en/trading.json
index 507950f49..0fe6110e1 100644
--- a/libs/i18n/src/locales/en/trading.json
+++ b/libs/i18n/src/locales/en/trading.json
@@ -90,6 +90,7 @@
"Earned by me": "Earned by me",
"Eligible teams": "Eligible teams",
"Enactment date reached and usual auction exit checks pass": "Enactment date reached and usual auction exit checks pass",
+ "[empty]": "[empty]",
"Ends in": "Ends in",
"Entity scope": "Entity scope",
"{{entity}} scope": "{{entity}} scope",
@@ -317,6 +318,7 @@
"Target stake": "Target stake",
"Team": "Team",
"Team name": "Team name",
+ "Team name cannot be empty": "Team name cannot be empty",
"Team creation transaction successful": "Team creation transaction successful",
"Team joined": "Team joined",
"Team switch successful. You will switch team at the end of the epoch.": "Team switch successful. You will switch team at the end of the epoch.",