33 */
44import "core-js/features/array/to-sorted" ;
55
6- import { Button , Loader } from "@babylonlabs-io/core-ui" ;
6+ import { Loader , TableElement } from "@babylonlabs-io/core-ui" ;
77
88import warningOctagon from "@/ui/common/assets/warning-octagon.svg" ;
99import warningTriangle from "@/ui/common/assets/warning-triangle.svg" ;
10- import { FinalityProviderLogo } from "@/ui/common/components/Staking/FinalityProviders/FinalityProviderLogo" ;
1110import { StatusView } from "@/ui/common/components/Staking/FinalityProviders/FinalityProviderTableStatusView" ;
1211import { getNetworkConfigBTC } from "@/ui/common/config/network/btc" ;
1312import { useFinalityProviderBsnState } from "@/ui/common/state/FinalityProviderBsnState" ;
@@ -76,6 +75,7 @@ export const FinalityProviderTable = ({ selectedFP, onSelectRow }: Props) => {
7675 { finalityProviders . map ( ( fp ) => {
7776 const isSelected = selectedFP === fp . btcPk ;
7877 const isSelectable = isRowSelectable ( fp ) ;
78+
7979 const totalDelegation = maxDecimals (
8080 satoshiToBtc ( fp . activeTVLSat || 0 ) ,
8181 8 ,
@@ -84,62 +84,31 @@ export const FinalityProviderTable = ({ selectedFP, onSelectRow }: Props) => {
8484 const status = FinalityProviderStateLabels [ fp . state ] || "Unknown" ;
8585
8686 return (
87- < div
87+ < TableElement
8888 key = { fp . btcPk }
89- className = { `bg-secondary-highlight h-[316px] overflow-hidden p-4 flex flex-col rounded justify-between` }
90- >
91- < div className = "flex gap-2 items-center" >
92- < FinalityProviderLogo
93- logoUrl = { fp . logo_url }
94- rank = { fp . rank }
95- moniker = { fp . description ?. moniker }
96- className = "w-10 h-10"
97- />
98- < div className = "flex flex-col" >
99- < div className = "text-xs text-accent-secondary" >
100- { fp . btcPk
101- ? `${ fp . btcPk . slice ( 0 , 6 ) } ...${ fp . btcPk . slice ( - 6 ) } `
102- : "" }
103- </ div >
104- < div className = "text-base font-medium text-accent-primary" >
105- { fp . description ?. moniker || "Unnamed Provider" }
106- </ div >
107- </ div >
108- </ div >
109- < div className = "w-full h-px bg-secondary-strokeLight" />
110- < div className = "text-sm flex flex-row justify-between" >
111- < div className = "text-accent-secondary" > Status</ div >
112- < div className = "text-accent-primary font-medium" > { status } </ div >
113- </ div >
114- < div className = "text-sm flex flex-row justify-between" >
115- < div className = "text-accent-secondary" > { coinSymbol } PK</ div >
116- < div className = "text-accent-primary font-medium" >
117- { fp . btcPk
118- ? `${ fp . btcPk . slice ( 0 , 5 ) } ...${ fp . btcPk . slice ( - 5 ) } `
119- : "" }
120- </ div >
121- </ div >
122- < div className = "text-sm flex flex-row justify-between" >
123- < div className = "text-accent-secondary" > Total Delegation</ div >
124- < div className = "text-accent-primary font-medium" >
125- { totalDelegation } { coinSymbol }
126- </ div >
127- </ div >
128- < div className = "text-sm flex flex-row justify-between" >
129- < div className = "text-accent-secondary" > Commission</ div >
130- < div className = "text-accent-primary font-medium" >
131- { commission } %
132- </ div >
133- </ div >
134- < Button
135- className = "mt-4"
136- onClick = { ( ) => handleSelect ( fp . btcPk ) }
137- disabled = { ! isSelectable }
138- variant = { isSelected ? "contained" : "outlined" }
139- >
140- { isSelected ? "Selected" : "Select" }
141- </ Button >
142- </ div >
89+ providerItemProps = { {
90+ bsnId : fp . bsnId || "" ,
91+ bsnName : fp . chain || "" ,
92+ address : fp . btcPk ,
93+ provider : {
94+ logo_url : fp . logo_url ,
95+ rank : fp . rank ,
96+ description : fp . description ,
97+ } ,
98+ } }
99+ attributes = { {
100+ Status : status ,
101+ "Total Delegation" : (
102+ < >
103+ { totalDelegation } { coinSymbol }
104+ </ >
105+ ) ,
106+ Commission : `${ commission } %` ,
107+ } }
108+ isSelected = { isSelected }
109+ isSelectable = { isSelectable }
110+ onSelect = { ( ) => handleSelect ( fp . btcPk ) }
111+ />
143112 ) ;
144113 } ) }
145114 </ div >
0 commit comments