From 558f7ca69818f38e21ed935bf46254af6013113b Mon Sep 17 00:00:00 2001 From: Arjun Porwal <65214523+ap211unitech@users.noreply.github.com> Date: Tue, 27 May 2025 11:01:24 +0530 Subject: [PATCH] Enhance Preimage Page with Decodable Call Link (#11570) * feat: add link and copy button for proposal decoding in PreimageCall component * feat: add background color to StyledTr for improved table visibility --- .../page-preimages/src/Preimages/Call.tsx | 29 +++++++++++++++++-- .../src/Preimages/userPreimages/Preimage.tsx | 2 ++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/packages/page-preimages/src/Preimages/Call.tsx b/packages/page-preimages/src/Preimages/Call.tsx index 76f6eff0a9..bd2612c303 100644 --- a/packages/page-preimages/src/Preimages/Call.tsx +++ b/packages/page-preimages/src/Preimages/Call.tsx @@ -3,9 +3,9 @@ import type { Preimage } from '@polkadot/react-hooks/types'; -import React from 'react'; +import React, { useMemo } from 'react'; -import { AddressMini, MarkError, MarkWarning } from '@polkadot/react-components'; +import { AddressMini, CopyButton, MarkError, MarkWarning, styled } from '@polkadot/react-components'; import { ZERO_ACCOUNT } from '@polkadot/react-hooks/useWeight'; import { CallExpander } from '@polkadot/react-params'; import { Null } from '@polkadot/types-codec'; @@ -21,6 +21,14 @@ interface Props { function PreimageCall ({ className = '', value }: Props): React.ReactElement { const { t } = useTranslation(); + const link = useMemo( + () => + value?.proposal + ? `#/extrinsics/decode/${value?.proposal?.toHex()}` + : null, + [value] + ); + return ( <> @@ -33,6 +41,16 @@ function PreimageCall ({ className = '', value }: Props): React.ReactElement )} + {link && ( + + {link.slice(0, 30)}... + + + )} {value.proposalError ? : value.proposalWarning @@ -68,4 +86,11 @@ function PreimageCall ({ className = '', value }: Props): React.ReactElement` + background: var(--bg-table); + .ui--Icon { border-width: 2px; }