diff --git a/apps/commune-validator/src/app/(expanded-pages)/module/[...slug]/page.tsx b/apps/commune-validator/src/app/(expanded-pages)/module/[...slug]/page.tsx index 1f62f54d..0093e891 100644 --- a/apps/commune-validator/src/app/(expanded-pages)/module/[...slug]/page.tsx +++ b/apps/commune-validator/src/app/(expanded-pages)/module/[...slug]/page.tsx @@ -51,12 +51,11 @@ export default async function ModulePage({ params }: Params) { mdl.metadataUri ?? "", )) as CustomMetadata; - const title = metadata.Ok?.title ?? "No Metadata"; // limited to 140 characters const description = metadata.Ok?.body ?? "This module has no custom metadata"; return ( -
+

- {title} + {mdl.name}

@@ -101,17 +100,6 @@ function ModuleDataGrid({ module }: { module: Module }) { label: "Registration Block", value: module.registrationBlock ?? "N/A", }, - { - label: "Registered At", - value: new Date(module.createdAt).toLocaleString(), - }, - ], - }, - { - title: "URIs", - fields: [ - { label: "Address URI", value: module.addressUri ?? "N/A" }, - { label: "Metadata URI", value: module.metadataUri ?? "N/A" }, ], }, { diff --git a/apps/commune-validator/src/app/(expanded-pages)/subnet/[...slug]/page.tsx b/apps/commune-validator/src/app/(expanded-pages)/subnet/[...slug]/page.tsx index 17700fa0..ef006fd5 100644 --- a/apps/commune-validator/src/app/(expanded-pages)/subnet/[...slug]/page.tsx +++ b/apps/commune-validator/src/app/(expanded-pages)/subnet/[...slug]/page.tsx @@ -1,12 +1,11 @@ import Link from "next/link"; import { notFound } from "next/navigation"; import { ArrowLeftIcon } from "@heroicons/react/16/solid"; +import { GlobeAltIcon } from "@heroicons/react/24/outline"; -import { MarkdownView } from "@commune-ts/ui/markdown-view"; -import { fetchCustomMetadata, smallAddress } from "@commune-ts/utils"; +import { formatToken, smallAddress } from "@commune-ts/utils"; import type { Subnet } from "~/utils/types"; -// import { ReportSubnet } from "~/app/components/report-Subnet"; import { api } from "~/trpc/server"; interface Params { @@ -15,13 +14,6 @@ interface Params { }; } -interface CustomMetadata { - Ok?: { - title?: string; - body?: string; - }; -} - export default async function SubnetPage({ params }: Params) { const { slug } = params; @@ -41,41 +33,36 @@ export default async function SubnetPage({ params }: Params) { notFound(); } - const metadata = (await fetchCustomMetadata( - "proposal", - sbnt.id, - sbnt.subnetMetadata ?? "", - )) as CustomMetadata; - - const title = metadata.Ok?.title ?? "No Metadata"; - - const description = metadata.Ok?.body ?? "This Subnet has no custom metadata"; - return ( -
-
- - - Go back to Subnets list - -

- {title} -

-
-
-
-
-

Description

- -
-
-
- +
+
+
+ + + Go back to Subnets list + + {sbnt.subnetMetadata && ( + + + View More + + )}
+

+ + {sbnt.name} + {" "} + / NETUID: {sbnt.netuid} +

+
); } @@ -88,7 +75,6 @@ function SubnetDataGrid({ subnet }: { subnet: Subnet }) { { label: "Subnet ID", value: subnet.id }, { label: "Netuid", value: subnet.netuid }, { label: "Name", value: subnet.name }, - { label: "At Block", value: subnet.atBlock }, { label: "Tempo", value: subnet.tempo }, { label: "Founder", value: smallAddress(subnet.founder) }, ], @@ -112,7 +98,10 @@ function SubnetDataGrid({ subnet }: { subnet: Subnet }) { fields: [ { label: "Founder Share", value: subnet.founderShare }, { label: "Incentive Ratio", value: subnet.incentiveRatio }, - { label: "Subnet Emission", value: subnet.subnetEmission.toString() }, + { + label: "Subnet Emission", + value: `${formatToken(BigInt(subnet.subnetEmission))} COMAI`, + }, { label: "Bonds MA", value: subnet.bondsMa }, { label: "Immunity Period", value: subnet.immunityPeriod }, ], @@ -120,7 +109,10 @@ function SubnetDataGrid({ subnet }: { subnet: Subnet }) { { title: "Governance Configuration", fields: [ - { label: "Proposal Cost", value: subnet.proposalCost.toString() }, + { + label: "Proposal Cost", + value: `${formatToken(BigInt(subnet.proposalCost))} COMAI`, + }, { label: "Proposal Expiration", value: subnet.proposalExpiration }, { label: "Vote Mode", value: subnet.voteMode }, { @@ -129,7 +121,7 @@ function SubnetDataGrid({ subnet }: { subnet: Subnet }) { }, { label: "Max Proposal Reward Treasury Allocation", - value: subnet.maxProposalRewardTreasuryAllocation.toString(), + value: `${formatToken(BigInt(subnet.maxProposalRewardTreasuryAllocation))} COMAI`, }, { label: "Proposal Reward Interval", @@ -140,9 +132,18 @@ function SubnetDataGrid({ subnet }: { subnet: Subnet }) { { title: "Burn Configuration", fields: [ - { label: "Min Burn", value: subnet.minBurn.toString() }, - { label: "Max Burn", value: subnet.maxBurn.toString() }, - { label: "Adjustment Alpha", value: subnet.adjustmentAlpha }, + { + label: "Min Burn", + value: `${formatToken(BigInt(subnet.minBurn))} COMAI`, + }, + { + label: "Max Burn", + value: `${formatToken(BigInt(subnet.maxBurn))} COMAI`, + }, + { + label: "Adjustment Alpha", + value: subnet.adjustmentAlpha, + }, { label: "Target Registrations Interval", value: subnet.targetRegistrationsInterval, @@ -160,27 +161,18 @@ function SubnetDataGrid({ subnet }: { subnet: Subnet }) { { title: "Additional Information", fields: [ + { label: "At Block", value: subnet.atBlock }, { label: "Min Validator Stake", - value: subnet.minValidatorStake?.toString(), + value: `${formatToken(subnet.minValidatorStake ?? 0)} COMAI`, }, { label: "Max Allowed Validators", value: subnet.maxAllowedValidators }, - { - label: "Created At", - value: new Date(subnet.createdAt).toLocaleString(), - }, - { - label: "Deleted At", - value: subnet.deletedAt - ? new Date(subnet.deletedAt).toLocaleString() - : "N/A", - }, ], }, ]; return ( -
+
{dataGroups.map((group, index) => (
{data.map((subnet) => ( - +
{weightedModules.length ? (
{weightedModules.map((module) => ( @@ -39,6 +39,6 @@ export default function Page() { No weighted modules found. )} - +
); } diff --git a/apps/commune-validator/src/app/(pages)/weighted-subnets/page.tsx b/apps/commune-validator/src/app/(pages)/weighted-subnets/page.tsx index 7776b20b..eeb5f565 100644 --- a/apps/commune-validator/src/app/(pages)/weighted-subnets/page.tsx +++ b/apps/commune-validator/src/app/(pages)/weighted-subnets/page.tsx @@ -2,7 +2,7 @@ import { useCommune } from "@commune-ts/providers/use-commune"; -import SubnetAccordion from "~/app/components/subnet-accordion"; +import SubnetCard from "~/app/components/subnet-card"; import { useDelegateSubnetStore } from "~/stores/delegateSubnetStore"; export default function Page() { @@ -21,11 +21,11 @@ export default function Page() { ); return ( - <> +
{weightedSubnets.length ? (
{weightedSubnets.map((subnet) => ( - )} - +
); } diff --git a/apps/commune-validator/src/app/components/subnet-accordion.tsx b/apps/commune-validator/src/app/components/subnet-card.tsx similarity index 65% rename from apps/commune-validator/src/app/components/subnet-accordion.tsx rename to apps/commune-validator/src/app/components/subnet-card.tsx index da3ffa87..813c2acb 100644 --- a/apps/commune-validator/src/app/components/subnet-accordion.tsx +++ b/apps/commune-validator/src/app/components/subnet-card.tsx @@ -1,30 +1,27 @@ "use client"; import { useState } from "react"; -import { ChevronUpIcon } from "@heroicons/react/16/solid"; +import Link from "next/link"; +import { ArrowRightIcon, ChevronUpIcon } from "@heroicons/react/16/solid"; import { smallAddress } from "@commune-ts/utils"; import { useDelegateSubnetStore } from "~/stores/delegateSubnetStore"; import { DelegateSubnetWeight } from "./delegate-subnet-weight"; -interface SubnetAccordionWeightProps { +interface SubnetCardWeightProps { id: number; name: string; founderAddress: string; percentage?: number; } -export default function SubnetAccordion({ +export default function SubnetCard({ id, name, founderAddress, percentage, -}: SubnetAccordionWeightProps) { - const [isOpen, setIsOpen] = useState(false); - - const toggleAccordion = () => setIsOpen(!isOpen); - +}: SubnetCardWeightProps) { const { delegatedSubnets } = useDelegateSubnetStore(); const isSubnetDelegated = delegatedSubnets.some((s) => s.id === id); @@ -45,19 +42,12 @@ export default function SubnetAccordion({ name={name} founderAddress={founderAddress} /> - + View More +