Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: texto TabCoin no singular concatena com valor booleano #1590

Merged
merged 1 commit into from
Jan 3, 2024
Merged

Conversation

smrsassa
Copy link
Contributor

@smrsassa smrsassa commented Jan 3, 2024

Mudanças realizadas

No componente TabCoinCount, existe uma condição para retirar ou adicionar o plural, dependendo se o usuário possui uma única ou mais TabCoins.
O problema ocorre quando o usuário possui apenas uma TabCoin. Nessa condição, a verificação amount !== 1 faz com que o seu retorno booleano seja concatenado na string "TabCoin", como por exemplo:

image

Mudei essa condição utilizando o operador ternário para corrigir o problema.

Tipo de mudança

  • Correção de bug

Copy link

vercel bot commented Jan 3, 2024

@smrsassa is attempting to deploy a commit to the TabNews Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Collaborator

@Rafatcb Rafatcb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bem observado, @smrsassa! Obrigado pelo PR.

Aproveitando que sugeri uma edição, depois você pode realizar um squash dos commits, deixando a mensagem de commit em inglês, por favor?

pages/interface/components/TabCoinCount/index.js Outdated Show resolved Hide resolved
@Rafatcb Rafatcb added front Envolve modificações no frontend bug Comportamento diferente do esperado labels Jan 3, 2024
Copy link
Collaborator

@aprendendofelipe aprendendofelipe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Boa @smrsassa, obrigado pelo PR! 💪

@@ -9,7 +9,7 @@ export default function TabCoinCount({ amount, direction, mode = 'tooltip', sx }
},
full: {
iconSize: 20,
text: `${amount?.toLocaleString('pt-BR')} TabCoin${amount !== 1 && 's'}`,
text: `${amount?.toLocaleString('pt-BR')} TabCoin${Math.abs(amount) === 1 ? '' : 's'}`,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considerem o que foi feito no #1461 como referência, então -1, 0 e 1 ficam no singular. Ficaria algo como:

Suggested change
text: `${amount?.toLocaleString('pt-BR')} TabCoin${Math.abs(amount) === 1 ? '' : 's'}`,
text: `${amount?.toLocaleString('pt-BR')} TabCoin${amount > 1 || amount < -1 ? 's' : ''}`,

Copy link

vercel bot commented Jan 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tabnews ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 3, 2024 6:11pm

Copy link
Collaborator

@aprendendofelipe aprendendofelipe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smrsassa, não passou no Lint do commit.

Use o comando npm run commit para criar a mensagem no padrão do projeto, ou use algo já no padrão, como:

fix(tabcoin_count): fix the singular TabCoin text

@aprendendofelipe aprendendofelipe merged commit 5aa2d49 into filipedeschamps:main Jan 3, 2024
4 checks passed
@aprendendofelipe
Copy link
Collaborator

@smrsassa, seu código já está rodando em produção! 🚀🚀🚀

Bem vindo à Turma de Contribuidores do TabNews! 👏👏👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Comportamento diferente do esperado front Envolve modificações no frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants