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

Feat/leaderboard datagrid #2650

Open
wants to merge 24 commits into
base: develop
Choose a base branch
from

Conversation

KacperKoza343
Copy link
Contributor

task HDM-20

@CLAassistant
Copy link

CLAassistant commented Oct 17, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

vercel bot commented Oct 17, 2024

@migace is attempting to deploy a commit to the HUMAN Protocol Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

vercel bot commented Oct 18, 2024

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

Name Status Preview Comments Updated (UTC)
human-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 11, 2024 9:34am
human-dashboard-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 11, 2024 9:34am
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
faucet-frontend ⬜️ Ignored (Inspect) Visit Preview Nov 11, 2024 9:34am
faucet-server ⬜️ Ignored (Inspect) Visit Preview Nov 11, 2024 9:34am

Copy link
Contributor

@dnechay dnechay left a comment

Choose a reason for hiding this comment

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

"View All" is not available anymore, is this expected?

Also font size is changed from 16 to 14, not sure if it's an intended change

@mgacek-blockydevs
Copy link

mgacek-blockydevs commented Nov 6, 2024

"View All" is not available anymore, is this expected?

Also font size is changed from 16 to 14, not sure if it's an intended change

image

should be ok :)

…human-protocol into feat/leaderboard-datagrid
Copy link
Contributor

@dnechay dnechay left a comment

Choose a reason for hiding this comment

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

  1. Sorting arrows are cut
Screenshot 2024-11-11 at 12 39 43
  1. Please fix the git history, maybe by re-applying changes on top of current HEAD in develop. Right now we see excessive commits (like this one) when we should not
  2. Some other minor comments

@@ -1,57 +1,58 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Projects in repo set up to use 2 spaces for tab, not tab character for indents. Could you please align with that and update this file? It's confusing that we have it full of changes and makes hard to find the real change with new package installed

"@mui/icons-material": "^6.1.1",
"@mui/material": "^5.15.18",
"@mui/styled-engine-sc": "6.1.3",
"@mui/x-data-grid": "^7.19.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove it and add install package properly, so it can be reflected in lock file as will

You need to run add command for this particular workspace:

yarn workspace @human-protocol/dashboard-ui-2024 add @mui/x-data-grid@<version-you-need>

}}
initialState={{
sorting: {
sortModel: [{ field: 'role', sort: 'asc' }],
Copy link
Contributor

Choose a reason for hiding this comment

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

IMU the idea of leaderboard is to show by default leaders ordered by amountStaked (ref from SDK) and BE already returns leaders ordered, so we need to change that to amountStaked and desc or remove it at all to use data we get from BE

display="flex"
alignItems="center"
>
{params.api.state.sorting.sortedRows.indexOf(params.id) + 1}
Copy link
Contributor

Choose a reason for hiding this comment

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

This logic is implicit and easy to break, esp. with the fact we have a hack with onSortModelChange for it. The right way of doing this would be to implement something similar "server-side" sorting, where we sort on our end and change raw index accordingly.

IMU the idea of this leaderboard is to show items depending on "amountStaked" by default and "index" column should show the "rank" based on this criteria. In case user decides to sort the table based on some other column - rank won't change.

So I see three possible ways of making it right:

  1. Implement it like "server-side" to avoid hacks with re-render triggering
  2. Remove this column at all
  3. Display it as is, assuming it is a rank value (so it will work like this table)

IMO #1 is overhead here, so I would go #3 since it corresponds to the idea of leaderboard

Copy link
Contributor

@dnechay dnechay Nov 12, 2024

Choose a reason for hiding this comment

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

Discussed with the team, let's do the following now:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants