fix(trading): validate whitespace team names, show empty in list (#5727)
Co-authored-by: Madalina Raicu <madalina@raygroup.uk>
This commit is contained in:
parent
0d850bd8b9
commit
c7dd5e846a
@ -46,7 +46,7 @@ const prepareTransaction = (
|
|||||||
createReferralSet: {
|
createReferralSet: {
|
||||||
isTeam: true,
|
isTeam: true,
|
||||||
team: {
|
team: {
|
||||||
name: fields.name,
|
name: fields.name.trim(),
|
||||||
teamUrl: fields.url,
|
teamUrl: fields.url,
|
||||||
avatarUrl: fields.avatarUrl,
|
avatarUrl: fields.avatarUrl,
|
||||||
closed: fields.private,
|
closed: fields.private,
|
||||||
@ -62,7 +62,7 @@ const prepareTransaction = (
|
|||||||
id: fields.id,
|
id: fields.id,
|
||||||
isTeam: true,
|
isTeam: true,
|
||||||
team: {
|
team: {
|
||||||
name: fields.name,
|
name: fields.name.trim(),
|
||||||
teamUrl: fields.url,
|
teamUrl: fields.url,
|
||||||
avatarUrl: fields.avatarUrl,
|
avatarUrl: fields.avatarUrl,
|
||||||
closed: fields.private,
|
closed: fields.private,
|
||||||
@ -116,7 +116,17 @@ export const TeamForm = ({
|
|||||||
<input type="hidden" {...register('id')} />
|
<input type="hidden" {...register('id')} />
|
||||||
<TradingFormGroup label={t('Team name')} labelFor="name">
|
<TradingFormGroup label={t('Team name')} labelFor="name">
|
||||||
<TradingInput
|
<TradingInput
|
||||||
{...register('name', { required: t('Required') })}
|
{...register('name', {
|
||||||
|
required: t('Required'),
|
||||||
|
validate: {
|
||||||
|
notEmpty: (value) => {
|
||||||
|
if (/^\s*$/.test(value)) {
|
||||||
|
return t('Team name cannot be empty');
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})}
|
||||||
data-testid="team-name-input"
|
data-testid="team-name-input"
|
||||||
/>
|
/>
|
||||||
{errors.name?.message && (
|
{errors.name?.message && (
|
||||||
|
@ -56,7 +56,10 @@ export const CompetitionsLeaderboard = ({
|
|||||||
className="hover:underline"
|
className="hover:underline"
|
||||||
to={Links.COMPETITIONS_TEAM(td.teamId)}
|
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]')
|
||||||
|
}
|
||||||
</Link>
|
</Link>
|
||||||
),
|
),
|
||||||
earned: num(td.totalQuantumRewards),
|
earned: num(td.totalQuantumRewards),
|
||||||
|
@ -90,6 +90,7 @@
|
|||||||
"Earned by me": "Earned by me",
|
"Earned by me": "Earned by me",
|
||||||
"Eligible teams": "Eligible teams",
|
"Eligible teams": "Eligible teams",
|
||||||
"Enactment date reached and usual auction exit checks pass": "Enactment date reached and usual auction exit checks pass",
|
"Enactment date reached and usual auction exit checks pass": "Enactment date reached and usual auction exit checks pass",
|
||||||
|
"[empty]": "[empty]",
|
||||||
"Ends in": "Ends in",
|
"Ends in": "Ends in",
|
||||||
"Entity scope": "Entity scope",
|
"Entity scope": "Entity scope",
|
||||||
"{{entity}} scope": "{{entity}} scope",
|
"{{entity}} scope": "{{entity}} scope",
|
||||||
@ -317,6 +318,7 @@
|
|||||||
"Target stake": "Target stake",
|
"Target stake": "Target stake",
|
||||||
"Team": "Team",
|
"Team": "Team",
|
||||||
"Team name": "Team name",
|
"Team name": "Team name",
|
||||||
|
"Team name cannot be empty": "Team name cannot be empty",
|
||||||
"Team creation transaction successful": "Team creation transaction successful",
|
"Team creation transaction successful": "Team creation transaction successful",
|
||||||
"Team joined": "Team joined",
|
"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.",
|
"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.",
|
||||||
|
Loading…
Reference in New Issue
Block a user