Less x-mass tree pool display (#8481)

This commit is contained in:
Jaco 2022-12-05 13:25:34 +02:00 committed by GitHub
parent 42c30267a5
commit ccd04e3feb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,9 +20,11 @@ const OPT_MULTI = {
? {
bonded: optBonded.unwrap(),
metadata: metadata.length
? metadata.isUtf8
? metadata.toUtf8()
: metadata.toString()
? transformName(
metadata.isUtf8
? metadata.toUtf8()
: metadata.toString()
)
: null,
nominating: optNominating
.unwrapOr({ targets: [] })
@ -33,6 +35,14 @@ const OPT_MULTI = {
: null
};
function transformName (input: string): string {
const mid = input.replace(/[^\x20-\x7E]/g, '');
return (mid.length > 64)
? `${mid.substring(0, 64)}…`
: mid;
}
function usePoolInfoImpl (poolId: BN): PoolInfo | null | undefined {
const { api } = useApi();
const accounts = usePoolAccounts(poolId);