forked from humanprotocol/human-protocol
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(app/leaderboard): update leaderboard page
- Loading branch information
1 parent
1709815
commit 4d747b7
Showing
18 changed files
with
1,156 additions
and
198 deletions.
There are no files selected for viewing
62 changes: 0 additions & 62 deletions
62
packages/apps/dashboard/ui-2024/src/components/Home/Leaderboard/Leaderboard.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
export * from './SmallGraph'; | ||
export * from './GraphSwiper'; | ||
export * from './Leaderboard/Leaderboard'; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
57 changes: 57 additions & 0 deletions
57
packages/apps/dashboard/ui-2024/src/features/Leaderboard/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { colorPalette } from '@assets/styles/color-palette'; | ||
import Box from '@mui/material/Box'; | ||
import Paper from '@mui/material/Paper'; | ||
import TableContainer from '@mui/material/TableContainer'; | ||
import { LeaderBoardData } from '@services/api/use-leaderboard-details'; | ||
import { useNavigate } from 'react-router-dom'; | ||
import SimpleBar from 'simplebar-react'; | ||
import { SelectNetwork } from './components/SelectNetwork'; | ||
import { Table } from './components/Table'; | ||
|
||
export type LeaderboardCommonProps = { | ||
data: LeaderBoardData | undefined; | ||
status: 'success' | 'error' | 'pending'; | ||
error: unknown; | ||
}; | ||
|
||
export const Leaderboard = ({ | ||
data, | ||
status, | ||
error, | ||
viewAllBanner, | ||
}: LeaderboardCommonProps & { | ||
viewAllBanner?: boolean; | ||
}) => { | ||
const navigate = useNavigate(); | ||
return ( | ||
<TableContainer | ||
component={Paper} | ||
sx={{ padding: '32px', marginTop: '30px' }} | ||
> | ||
<div className="mobile-select"> | ||
<SelectNetwork /> | ||
</div> | ||
<SimpleBar> | ||
<Table data={data} status={status} error={error} /> | ||
</SimpleBar> | ||
{viewAllBanner ? ( | ||
<Box | ||
sx={{ | ||
height: '42px', | ||
border: `1px ${colorPalette.primary.main} solid`, | ||
borderRadius: '4px', | ||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
cursor: 'pointer', | ||
}} | ||
onClick={() => { | ||
navigate('/leaderboard'); | ||
}} | ||
> | ||
View All | ||
</Box> | ||
) : null} | ||
</TableContainer> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
packages/apps/dashboard/ui-2024/src/pages/Home/Leaderboard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { useLeaderboardDetails } from '@services/api/use-leaderboard-details'; | ||
import { Leaderboard as LeaderboardFeature } from '../../features/Leaderboard'; | ||
|
||
export const Leaderboard = () => { | ||
const { data, status, error } = useLeaderboardDetails(); | ||
const isMoreThatFiveEntries = data?.length && data.length > 5; | ||
|
||
return ( | ||
<LeaderboardFeature | ||
data={isMoreThatFiveEntries ? data.slice(0, 5) : data} | ||
status={status} | ||
error={error} | ||
viewAllBanner | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.