33import React , { use , useState , useMemo , useEffect } from "react" ;
44import Link from "next/link" ;
55import { useApi } from "@/hooks/use-api" ;
6+ import { useChainNames } from "@/hooks/use-chain-names" ;
67import { Skeleton } from "@/components/ui/skeleton" ;
78import { StatCard } from "@/components/data/StatCard" ;
89import { ChainLink } from "@/components/data/ChainLink" ;
@@ -133,6 +134,7 @@ function generateProviderMockData(): TimeSeriesEntry[] {
133134export default function ProviderPage ( { params } : { params : Promise < { lavaid : string } > } ) {
134135 const { lavaid } = use ( params ) ;
135136 const { data : provider , isLoading : providerLoading } = useApi < ProviderDetail > ( `/providers/${ lavaid } ` ) ;
137+ const { getName } = useChainNames ( ) ;
136138 const { data : rewards , isLoading : rewardsLoading } = useApi < { data : ChartEntry [ ] } > ( `/providers/${ lavaid } /charts` ) ;
137139 const [ rangeDays , setRangeDays ] = useState ( 90 ) ;
138140 const chartFrom = rangeDays > 0 ? new Date ( Date . now ( ) - rangeDays * 24 * 60 * 60 * 1000 ) . toISOString ( ) . slice ( 0 , 10 ) : "" ;
@@ -268,7 +270,7 @@ export default function ProviderPage({ params }: { params: Promise<{ lavaid: str
268270 } } ,
269271 { id : "total" , header : "Total Stake" , accessorFn : ( r : Stake ) => Number ( BigInt ( r . stake || "0" ) + BigInt ( r . delegation || "0" ) ) , cell : ( { row } : { row : { original : Stake } } ) => < LavaAmount amount = { String ( BigInt ( row . original . stake || "0" ) + BigInt ( row . original . delegation || "0" ) ) } /> } ,
270272 { id : "stake" , header : "Self Stake" , meta : { hideOnMobile : true } , accessorFn : ( r : Stake ) => Number ( BigInt ( r . stake || "0" ) ) , cell : ( { row } : { row : { original : Stake } } ) => < LavaAmount amount = { row . original . stake } /> } ,
271- { id : "delegation" , header : "Delegation" , meta : { hideOnMobile : true } , accessorFn : ( r : Stake ) => Number ( BigInt ( r . delegation || "0" ) ) , cell : ( { row } : { row : { original : Stake } } ) => < LavaAmount amount = { row . original . delegation } /> } ,
273+ { id : "delegation" , header : "Delegation Stake " , meta : { hideOnMobile : true } , accessorFn : ( r : Stake ) => Number ( BigInt ( r . delegation || "0" ) ) , cell : ( { row } : { row : { original : Stake } } ) => < LavaAmount amount = { row . original . delegation } /> } ,
272274 { id : "commission" , header : "Commission" , meta : { hideOnMobile : true } , accessorFn : ( r : Stake ) => Number ( r . delegateCommission || "0" ) , cell : ( { row } : { row : { original : Stake } } ) => `${ Number ( row . original . delegateCommission || "0" ) } %` } ,
273275 { id : "geolocation" , header : "Location" , meta : { hideOnMobile : true } , accessorFn : ( r : Stake ) => r . geolocation ?? 0 , cell : ( { row } : { row : { original : Stake } } ) => {
274276 const regions = geoLabel ( row . original . geolocation ) ;
@@ -315,7 +317,7 @@ export default function ProviderPage({ params }: { params: Promise<{ lavaid: str
315317 < dd className = "text-base font-semibold" > < LavaAmount amount = { s . stake } /> </ dd >
316318 </ div >
317319 < div >
318- < dt className = "text-sm uppercase tracking-wider text-muted-foreground mb-1.5" > Delegation</ dt >
320+ < dt className = "text-sm uppercase tracking-wider text-muted-foreground mb-1.5" > Delegation Stake </ dt >
319321 < dd className = "text-base font-semibold" > < LavaAmount amount = { s . delegation } /> </ dd >
320322 </ div >
321323 < div >
@@ -636,9 +638,27 @@ export default function ProviderPage({ params }: { params: Promise<{ lavaid: str
636638 < StatCard className = "hidden md:block" label = "Relays (30d)" loading = { rewardsLoading } value = { formatNumberKMB ( relays30d . toString ( ) ) } fullValue = { relays30d . toLocaleString ( ) } icon = { < ArrowUpNarrowWide className = "h-4 w-4 text-muted-foreground" /> } />
637639 < StatCard className = "hidden md:block" label = "CU (30d)" loading = { rewardsLoading } value = { formatNumberKMB ( cu30d . toString ( ) ) } fullValue = { cu30d . toLocaleString ( ) } icon = { < MonitorCog className = "h-4 w-4 text-muted-foreground" /> } />
638640
639- < StatCard label = "Total Stake" loading = { providerLoading } value = { < LavaAmount amount = { ( totalStake + totalDelegation ) . toString ( ) } /> } icon = { < Coins className = "h-4 w-4 text-muted-foreground" /> } />
640- < StatCard label = "Self Stake" loading = { providerLoading } value = { < LavaAmount amount = { totalStake . toString ( ) } /> } icon = { < Coins className = "h-4 w-4 text-muted-foreground" /> } />
641- < StatCard label = "Delegation" loading = { providerLoading } value = { < LavaAmount amount = { totalDelegation . toString ( ) } /> } icon = { < Coins className = "h-4 w-4 text-muted-foreground" /> } />
641+ < StatCard
642+ label = "Total Stake"
643+ loading = { providerLoading }
644+ icon = { < Coins className = "h-4 w-4 text-muted-foreground" /> }
645+ className = "col-span-1 md:col-span-2 xl:col-span-1"
646+ value = {
647+ < div >
648+ < div > < LavaAmount amount = { ( totalStake + totalDelegation ) . toString ( ) } /> </ div >
649+ < div className = "grid grid-cols-2 gap-x-4 gap-y-1 mt-3 text-xs font-normal" >
650+ < div >
651+ < div className = "text-muted-foreground" > Self Stake</ div >
652+ < div className = "text-sm font-medium text-foreground mt-0.5" > < LavaAmount amount = { totalStake . toString ( ) } /> </ div >
653+ </ div >
654+ < div >
655+ < div className = "text-muted-foreground" > Delegation Stake</ div >
656+ < div className = "text-sm font-medium text-foreground mt-0.5" > < LavaAmount amount = { totalDelegation . toString ( ) } /> </ div >
657+ </ div >
658+ </ div >
659+ </ div >
660+ }
661+ />
642662 < StatCard label = "Commission" loading = { providerLoading } value = { commissionDisplay ?? "—" } icon = { < Percent className = "h-4 w-4 text-muted-foreground" /> } />
643663 </ div >
644664 </ div >
@@ -797,10 +817,17 @@ export default function ProviderPage({ params }: { params: Promise<{ lavaid: str
797817 >
798818 < ChainIconImg chainId = { s . specId } />
799819 < div className = "min-w-0 flex-1" >
800- < div className = "flex items-center gap-2" >
801- < span className = "text-base font-medium truncate" > { s . specId } </ span >
802- </ div >
803- < div className = "flex items-center gap-1.5 mt-0.5" >
820+ { ( ( ) => {
821+ const fullName = getName ( s . specId ) ;
822+ const hasFullName = fullName && fullName !== s . specId ;
823+ return (
824+ < >
825+ < div className = "text-base font-medium truncate" > { hasFullName ? fullName : s . specId } </ div >
826+ { hasFullName && < div className = "text-xs text-muted-foreground truncate mt-0.5" > { s . specId } </ div > }
827+ </ >
828+ ) ;
829+ } ) ( ) }
830+ < div className = "flex items-center gap-1.5 mt-1" >
804831 { h ? (
805832 < >
806833 < span className = { `w-1.5 h-1.5 rounded-full ${ isHealthy ? "bg-green-500" : "bg-red-500" } ` } />
@@ -816,8 +843,9 @@ export default function ProviderPage({ params }: { params: Promise<{ lavaid: str
816843 ) }
817844 </ div >
818845 </ div >
819- < div className = "flex flex-col items-end shrink-0" >
820- < span className = "text-sm font-medium" > < LavaAmount amount = { total . toString ( ) } /> </ span >
846+ < div className = "shrink-0 text-right" >
847+ < div className = "text-[10px] uppercase tracking-wider text-muted-foreground" > Total Stake</ div >
848+ < div className = "text-sm font-semibold mt-0.5" > < LavaAmount amount = { total . toString ( ) } /> </ div >
821849 </ div >
822850 < ChevronRight size = { 18 } className = { `text-muted-foreground transition-transform shrink-0 ${ isExpanded ? "rotate-90" : "" } ` } />
823851 </ button >
0 commit comments