-
Notifications
You must be signed in to change notification settings - Fork 25
feat: add BSNs to delegationList #1155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: jb-implement-chain-selection
Are you sure you want to change the base?
feat: add BSNs to delegationList #1155
Conversation
8e81bb6
to
1702ccc
Compare
return ( | ||
<AuthGuard> | ||
<Section title="Activity"> | ||
<Delegations /> | ||
<DelegationList /> | ||
{renderDelegationList()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{renderDelegationList()} | |
{FeatureFlagService.IsPhase3Enabled ? | |
<FinalityProviderBsnState> | |
<DelegationList /> | |
</FinalityProviderBsnState> | |
: <DelegationList />} |
if (lowerCaseBsnName in chainLogos) { | ||
return chainLogos[lowerCaseBsnName as BsnLogoKey]; | ||
} | ||
return chainLogos.placeholder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (lowerCaseBsnName in chainLogos) { | |
return chainLogos[lowerCaseBsnName as BsnLogoKey]; | |
} | |
return chainLogos.placeholder; | |
return return chainLogos[lowerCaseBsnName as BsnLogoKey] ?? chainLogos.placeholder; |
const { getFinalityProvidersBsns } = useFinalityProviderBsnState(); | ||
|
||
const handleBsnClick = (delegation: DelegationWithFP) => { | ||
setBsnPreviewModal({ delegation }); | ||
}; | ||
|
||
const closeBsnPreviewModal = () => { | ||
setBsnPreviewModal(null); | ||
}; | ||
|
||
const columnOrder = FeatureFlagService.IsPhase3Enabled | ||
? phase3ColumnOrder | ||
: defaultColumnOrder; | ||
|
||
const tableColumns = columnOrder | ||
.map((key) => columnDefinitions.get(key)) | ||
.filter(Boolean) as TableColumn<DelegationWithFP, TableParams>[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just use a separate config for phase-3
table. You don't need change any logic here. Just reuse GridTable component with different configurations
}, | ||
], | ||
[ | ||
"stakingTxHashHex", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need this
if (FeatureFlagService.IsPhase3Enabled) { | ||
return { | ||
...delegationWithFP, | ||
fps: allFinalityProviders, | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's allowed to use FF on this level (actually we should use it only once in our code)
export const SelectedBsnPreviewModal = ({ | ||
onClose, | ||
bsnList, | ||
finalityProviders, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you only need FP here, cause you can always restore BSN from FP (FP has a BSN id)
{Array.from({ | ||
length: Math.max(bsnList.length, finalityProviders.length), | ||
}).map((_, index) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the comment from above would help you simplify this
<div className="w-8 h-8 rounded-lg bg-primary flex items-center justify-center flex-shrink-0"> | ||
{fp.logo_url ? ( | ||
<img | ||
src={fp.logo_url} | ||
alt={ | ||
fp.description?.moniker || "Finality Provider" | ||
} | ||
className="w-6 h-6 rounded" | ||
/> | ||
) : ( | ||
<div className="w-6 h-6 bg-accent-secondary rounded flex items-center justify-center"> | ||
<span className="text-xs text-white"> | ||
{(fp.description?.moniker || "FP") | ||
.charAt(0) | ||
.toUpperCase()} | ||
</span> | ||
</div> | ||
)} | ||
</div> | ||
<span className="text-accent-primary text-sm"> | ||
{fp.description?.moniker || | ||
"Unknown Finality Provider"} | ||
</span> | ||
</> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use avatar here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll review this one later
No description provided.