Skip to content

Commit

Permalink
Merge pull request #265 from stabilitydao/platform-pages
Browse files Browse the repository at this point in the history
0.12.24-alpha: chain page upgrade, chains table fix
  • Loading branch information
a17 authored Oct 13, 2024
2 parents 5cd1e2b + 8987e1b commit 23e2fd4
Show file tree
Hide file tree
Showing 95 changed files with 934 additions and 576 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "stability-ui",
"type": "module",
"version": "0.12.22-alpha",
"version": "0.12.24-alpha",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
Expand All @@ -18,7 +18,7 @@
"@astrojs/tailwind": "^5.0.2",
"@astrojs/vercel": "^5.1.0",
"@nanostores/react": "^0.7.1",
"@stabilitydao/stability": "=0.16.1",
"@stabilitydao/stability": "=0.17.0",
"@tanstack/query-sync-storage-persister": "^5.22.2",
"@tanstack/react-query": "^5.22.2",
"@tanstack/react-query-persist-client": "^5.22.2",
Expand Down
Binary file added public/chain-covers/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chain-covers/10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chain-covers/100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chain-covers/108.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chain-covers/1088.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chain-covers/1100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chain-covers/1101.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chain-covers/1111.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chain-covers/111188.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chain-covers/1116.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chain-covers/11235.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chain-covers/11501.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chain-covers/122.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chain-covers/1284.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chain-covers/1285.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chain-covers/1313161554.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chain-covers/1329.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chain-covers/13371.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chain-covers/137.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chain-covers/1380012617.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chain-covers/14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chain-covers/1625.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chain-covers/167000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chain-covers/169.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chain-covers/185.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chain-covers/196.png
Binary file added public/chain-covers/199.png
Binary file added public/chain-covers/2000.png
Binary file added public/chain-covers/200901.png
Binary file added public/chain-covers/204.png
Binary file added public/chain-covers/2046399126.png
Binary file added public/chain-covers/2222.png
Binary file added public/chain-covers/250.png
Binary file added public/chain-covers/252.png
Binary file added public/chain-covers/255.png
Binary file added public/chain-covers/288.png
Binary file added public/chain-covers/295.png
Binary file added public/chain-covers/30.png
Binary file added public/chain-covers/314.png
Binary file added public/chain-covers/324.png
Binary file added public/chain-covers/34443.png
Binary file added public/chain-covers/37.png
Binary file added public/chain-covers/3776.png
Binary file added public/chain-covers/40.png
Binary file added public/chain-covers/4200.png
Binary file added public/chain-covers/42161.png
Binary file added public/chain-covers/42170.png
Binary file added public/chain-covers/42220.png
Binary file added public/chain-covers/42766.png
Binary file added public/chain-covers/43114.png
Binary file added public/chain-covers/48900.png
Binary file added public/chain-covers/5000.png
Binary file added public/chain-covers/534352.png
Binary file added public/chain-covers/56.png
Binary file added public/chain-covers/570.png
Binary file added public/chain-covers/59144.png
Binary file added public/chain-covers/6001.png
Binary file added public/chain-covers/60808.png
Binary file added public/chain-covers/7000.png
Binary file added public/chain-covers/7560.png
Binary file added public/chain-covers/7777777.png
Binary file added public/chain-covers/810180.png
Binary file added public/chain-covers/81457.png
Binary file added public/chain-covers/8217.png
Binary file added public/chain-covers/8453.png
Binary file added public/chain-covers/8822.png
Binary file added public/chain-covers/9001.png
Binary file added public/chain-covers/9790.png
14 changes: 14 additions & 0 deletions public/github.svg
12 changes: 11 additions & 1 deletion src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { chains } from "@stabilitydao/stability";

import { TABLE_FILTERS, TABLE, CHAINS_TABLE } from "./tables";
import {
TABLE_FILTERS,
TABLE,
CHAINS_TABLE,
ASSETS_TABLE,
INTEGRATIONS_TABLE,
STRATEGIES_TABLE,
} from "./tables";

import {
USDC,
Expand Down Expand Up @@ -282,4 +289,7 @@ export {
DEFAULT_ERROR,
IL,
ZERO_BigInt,
ASSETS_TABLE,
INTEGRATIONS_TABLE,
STRATEGIES_TABLE,
};
92 changes: 84 additions & 8 deletions src/constants/tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,25 +80,101 @@ const CHAINS_TABLE: TTableColumn[] = [
sortType: "none",
dataType: "number",
},
// {
// name: "Treasury",
// keyName: "multisig",
// sortType: "none",
// dataType: "string",
// },
// {
// name: "Issue",
// keyName: "chainLibGithubId",
// sortType: "none",
// dataType: "number",
// },
{ name: "Status", keyName: "status", sortType: "none", dataType: "string" },
{
name: "Bridges",
keyName: "bridgesCount",
sortType: "none",
dataType: "number",
},
];

const ASSETS_TABLE: TTableColumn[] = [
{
name: "Treasury",
keyName: "multisig",
name: "Symbol",
keyName: "symbol",
sortType: "none",
dataType: "string",
},
{
name: "Issue",
keyName: "chainLibGithubId",
name: "Website",
keyName: "",
sortType: "none",
dataType: "",
unsortable: true,
},
{
name: "Addresses",
keyName: "addresses",
sortType: "none",
dataType: "number",
},
{ name: "Status", keyName: "status", sortType: "none", dataType: "string" },
];
const INTEGRATIONS_TABLE: TTableColumn[] = [
{
name: "Bridges",
keyName: "chainId", //temp
name: "Organization",
keyName: "name",
sortType: "none",
dataType: "string",
},
{
name: "Links",
keyName: "",
sortType: "none",
dataType: "",
unsortable: true,
},
{
name: "Protocols",
keyName: "protocolsLength",
sortType: "none",
dataType: "number",
},
];
const STRATEGIES_TABLE: TTableColumn[] = [
{
name: "Id",
keyName: "shortId",
sortType: "none",
dataType: "string",
},
{
name: "Name",
keyName: "id",
sortType: "none",
dataType: "string",
},
{
name: "State",
keyName: "state",
sortType: "none",
dataType: "string",
},
{
name: "Issue",
keyName: "contractGithubId",
sortType: "none",
dataType: "number",
},
];

export { TABLE_FILTERS, TABLE, CHAINS_TABLE };
export {
TABLE_FILTERS,
TABLE,
CHAINS_TABLE,
ASSETS_TABLE,
INTEGRATIONS_TABLE,
STRATEGIES_TABLE,
};
87 changes: 60 additions & 27 deletions src/modules/Platform/components/Assets.tsx
Original file line number Diff line number Diff line change
@@ -1,45 +1,78 @@
import { useState, useEffect } from "react";

import { assets } from "@stabilitydao/stability";

import { Breadcrumbs } from "@ui";
import { sortTable } from "@utils";

import { Breadcrumbs, TableColumnSort } from "@ui";

import { ASSETS_TABLE } from "@constants";

import type { TTableColumn, TAssetData } from "@types";

const Assets = (): JSX.Element => {
const [tableStates, setTableStates] = useState(ASSETS_TABLE);
const [tableData, setTableData] = useState<TAssetData[]>([]);

const initTableData = async () => {
if (assets) {
const assetsData = assets.map(({ symbol, website, addresses }) => ({
symbol,
website,
addresses: Object.keys(addresses).length,
}));
setTableData(assetsData);
}
};

useEffect(() => {
initTableData();
}, []);
return (
<div className="">
<div>
<Breadcrumbs links={["Platform", "Assets"]} />

<h1>Assets</h1>

<table className="font-manrope w-full">
<thead className="bg-accent-950 text-neutral-600 h-[36px]">
<tr className="text-[12px] uppercase">
<td className="px-4 py-2">Symbol</td>
<td className="px-4 py-2">Website</td>
<td className="px-4 py-2">Addresses</td>
{tableStates.map((value: TTableColumn, index: number) => (
<TableColumnSort
key={value.name + index}
index={index}
value={value.name}
sort={sortTable}
table={tableStates}
setTable={setTableStates}
tableData={tableData}
setTableData={setTableData}
/>
))}
</tr>
</thead>
<tbody className="text-[14px]">
{assets.map(({ addresses, symbol, website }) => (
<tr className="h-[48px] hover:bg-accent-950" key={website}>
<td className="px-4 py-3">{symbol}</td>
<td className="px-4 py-3 ">
<a
className="flex items-center justify-center"
href={website}
target="_blank"
title="Go to asset website"
>
<img
src="/icons/web.svg"
alt="Website"
className="w-[20px]"
/>
</a>
</td>
<td className="px-4 py-3 text-end">
{Object.keys(addresses).length}
</td>
</tr>
))}
{!!tableData.length &&
tableData.map(({ addresses, symbol, website }) => (
<tr className="h-[48px] hover:bg-accent-950" key={symbol}>
<td className="px-4 py-3">{symbol}</td>
<td className="px-4 py-3 ">
<a
className="flex items-center justify-center"
href={website}
target="_blank"
title="Go to asset website"
>
<img
src="/icons/web.svg"
alt="Website"
className="w-[20px]"
/>
</a>
</td>
<td className="px-4 py-3 text-end">{addresses}</td>
</tr>
))}
</tbody>
</table>
</div>
Expand Down
Loading

0 comments on commit 23e2fd4

Please sign in to comment.