-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #244 from stabilitydao/platform-pages
0.12.2-alpha: init Users page
- Loading branch information
Showing
7 changed files
with
101 additions
and
28 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import type {ApiMainReply} from "@stabilitydao/stability"; | ||
import {useStore} from "@nanostores/react"; | ||
import {apiData} from "@store"; | ||
import {shortAddress} from "../Platform/Chains.tsx"; | ||
|
||
const Users = (): JSX.Element => { | ||
const $apiData: ApiMainReply | undefined = useStore(apiData); | ||
|
||
return ( | ||
<div className="flex flex-col min-[1440px]:min-w-[1000px] gap-[36px]"> | ||
<h1 className="mb-0 text-[40px] font-bold">Users</h1> | ||
|
||
{$apiData ? ( | ||
<table> | ||
<thead> | ||
<tr> | ||
<td>Rank</td> | ||
<td>Address</td> | ||
<td className="text-right">Earned</td> | ||
<td className="text-right">Deposit</td> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{$apiData.leaderboard.map((user, rank) => ( | ||
<tr> | ||
<td>{rank+1}</td> | ||
<td style={{fontFamily: 'monospace',}}>{shortAddress(user.address, 6, 4)}</td> | ||
<td className="text-right">{user.earned.toFixed(2)}</td> | ||
<td className="text-right">{user.deposit ? (Math.round(user.deposit * 100) / 100).toFixed(2) : ''}</td> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
) : ( | ||
<span>Loading</span> | ||
)} | ||
</div> | ||
) | ||
} | ||
|
||
export {Users} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
import {Users} from '@modules'; | ||
import Layout from '@layouts/Layout.astro'; | ||
--- | ||
|
||
<Layout title="Users"> | ||
<div class="platform"> | ||
<Users client:only="react" /> | ||
</div> | ||
</Layout> | ||
|
||
<style is:global> | ||
.what-to-build table td { | ||
padding: 0 20px; | ||
} | ||
|
||
</style> |