Skip to content

Commit

Permalink
Merge pull request #244 from stabilitydao/platform-pages
Browse files Browse the repository at this point in the history
0.12.2-alpha: init Users page
  • Loading branch information
DevTeaLeaf authored Oct 3, 2024
2 parents e4e5534 + 057bcbe commit 2516962
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 28 deletions.
44 changes: 23 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,29 @@

## Pages

| Name | Status | Description |
|---------------------------------------------------------------------------------------------------------------------|-------------------|-----------------------------------------------|
| **Landing** | Development Figma | Index page |
| **AI** | | Chatbot. AI Router. |
| [**Vaults**](https://stability.farm/) | Live | List of vaults. Portfolio. |
| --- [**Vault**](https://stability.farm/vault/137/0xe319afa4d638f71400d4c7d60d90b0c227a5af48) | Live | Vault page |
| **Boosters** | | Liquid staking wrappers to get farming boosts |
| **Contest** | | Yield contests |
| **DAO** | | Self-developing DAO portal |
| [**Platform**](https://stability.farm/platform) | Development | Platform portal |
| --- [**Factory**](https://stability.farm/create-vault) | Development | Factory of vaults, farms. |
| --- [**Network**](https://stability.farm/network) | Development | Stability p2p network nodes |
| --- --- [**Node**](https://stability.farm/network/6e9a70eb6628e1295772218defdf254ce3200890cb16cc588c4dab5000972edd) | Development | Node page |
| --- [**Strategies**](https://stability.farm/strategies) | Development | List of strategies |
| --- --- **Strategy** | | Strategy page |
| --- [**Integrations**](https://stability.farm/protocols) | Development | List of DeFi protocols and organizations |
| --- --- **Organization** | | Organization page |
| --- [**Chains**](https://stability.farm/chains) | Development | List of EVM-networks known for the Platform |
| --- --- **Chain** | | Chain page |
| --- [**Assets**](https://stability.farm/assets) | Development | List of supported assets |
| --- --- **Asset** | | Asset page |
| Name | Status | Description |
|---------------------------------------------------------------------------------------------------------------------|-------------------|-------------------------------------------------|
| **Landing** | Development Figma | Index page |
| **AI** | | Chatbot. AI Router. |
| [**Vaults**](https://stability.farm/) | Live | List of vaults. Portfolio. |
| **Boosters** | | Liquid staking wrappers to get farming boosts |
| --- [**Vault**](https://stability.farm/vault/137/0xe319afa4d638f71400d4c7d60d90b0c227a5af48) | Live | Vault page |
| [**Users**](https://stability.farm/users) | Development | Users portal: active contests, leaderboard, etc |
| --- **Contests** | | All yield contests |
| --- --- **Contest** | | Contest page |
| **DAO** | | Self-developing DAO portal |
| [**Platform**](https://stability.farm/platform) | Development | Platform portal |
| --- [**Factory**](https://stability.farm/create-vault) | Development | Factory of vaults, farms. |
| --- [**Network**](https://stability.farm/network) | Development | Stability p2p network nodes |
| --- --- [**Node**](https://stability.farm/network/6e9a70eb6628e1295772218defdf254ce3200890cb16cc588c4dab5000972edd) | Development | Node page |
| --- [**Strategies**](https://stability.farm/strategies) | Development | List of strategies |
| --- --- **Strategy** | | Strategy page |
| --- [**Integrations**](https://stability.farm/integrations) | Development | List of DeFi protocols and organizations |
| --- --- **Organization** | | Organization page |
| --- [**Chains**](https://stability.farm/chains) | Development | List of EVM-networks known for the Platform |
| --- --- **Chain** | | Chain page |
| --- [**Assets**](https://stability.farm/assets) | Development | List of supported assets |
| --- --- **Asset** | | Asset page |

## Coverage

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "stability-ui",
"type": "module",
"version": "0.12.1-alpha",
"version": "0.12.2-alpha",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
Expand Down
6 changes: 3 additions & 3 deletions src/modules/Platform/Chains.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { apiData } from "@store";

import { formatNumber } from "@utils";

const shortAddress = (address: string): string => {
return `${address.slice(0, 4)}...${address.slice(-2)}`;
const shortAddress = (address: string, firstChars: number = 4, lastChars: number = 2): string => {
return `${address.slice(0, firstChars)}..${address.slice(-lastChars)}`;
};

const BridgesList: React.FC<{
Expand Down Expand Up @@ -200,4 +200,4 @@ const Chains = (): JSX.Element => {
);
};

export { Chains };
export { Chains, shortAddress };
17 changes: 14 additions & 3 deletions src/modules/Platform/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,19 @@ const Platform = (): JSX.Element => {
<div className="flex flex-col min-[1440px]:min-w-[1338px] gap-[36px]">
<h1 className="mb-0 text-[40px] font-bold">Platform</h1>

<div className="p-[36px] hidden">
Beta coming 2025. Enjoy this MVP (alpha Version) now.
<div className="flex p-[16px] gap-[8px] bg-[#441B06] rounded-[24px]">
<svg className="mt-[2px]" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M12 9V13M12 17H12.01M21.7299 18L13.7299 3.99998C13.5555 3.69218 13.3025 3.43617 12.9969 3.25805C12.6912 3.07993 12.3437 2.98608 11.9899 2.98608C11.6361 2.98608 11.2887 3.07993 10.983 3.25805C10.6773 3.43617 10.4244 3.69218 10.2499 3.99998L2.24993 18C2.07361 18.3053 1.98116 18.6519 1.98194 19.0045C1.98272 19.3571 2.07671 19.7032 2.25438 20.0078C2.43204 20.3124 2.68708 20.5646 2.99362 20.7388C3.30017 20.9131 3.64734 21.0032 3.99993 21H19.9999C20.3508 20.9996 20.6955 20.9069 20.9992 20.7313C21.303 20.5556 21.5551 20.3031 21.7304 19.9991C21.9057 19.6951 21.998 19.3504 21.9979 18.9995C21.9978 18.6486 21.9054 18.3039 21.7299 18Z"
stroke="#FB8B13" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
</svg>
<div className="flex text-[18px] font-semibold" style={{lineHeight: '24px'}}>
This is an early Alpha version of the Stability platform, a minimum viable product.
<br/>
Only the critical scope of vault contracts has been audited.
<br/>
Beta version coming in 2025.
</div>
</div>

<div className="flex flex-wrap p-[36px] ">
Expand All @@ -76,7 +87,7 @@ const Platform = (): JSX.Element => {
].map(t => (
<div
key={t[0]}
className="flex w-full sm:w-6/12 md:w-4/12 lg:w-3/12 min-[1440px]:w-4/12 h-[120px] px-[12px] rounded-full text-gray-200 items-center justify-center flex-col">
className="flex w-full sm:w-6/12 md:w-4/12 lg:w-3/12 min-[1440px]:w-4/12 h-[120px] px-[12px] rounded-full text-gray-200 items-center justify-center flex-col">
<div className="text-[36px]">{t[1]}</div>
<div className="flex self-center justify-center text-[16px]">{t[0]}</div>
</div>
Expand Down
41 changes: 41 additions & 0 deletions src/modules/Users/index.tsx
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}
2 changes: 2 additions & 0 deletions src/modules/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Integrations } from "./Platform/Integrations";
import { Network } from "./Platform/Network";
import { Node } from "./Platform/Node";
import { Strategies } from "./Platform/Strategies";
import { Users } from "./Users";

export {
CreateVault,
Expand All @@ -22,4 +23,5 @@ export {
Network,
Strategies,
Node,
Users,
};
17 changes: 17 additions & 0 deletions src/pages/users.astro
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>

0 comments on commit 2516962

Please sign in to comment.