fix(trading): do not show alias edit on read only (#6111)

This commit is contained in:
m.ray 2024-03-27 10:11:37 +00:00 committed by GitHub
parent bfa6be4c1c
commit 64fc075f7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -96,6 +96,7 @@ export const VegaWalletConnectButton = ({
pubKeys={pubKeys}
activeKey={activeKey?.publicKey}
onSelect={selectPubKey}
isReadOnly={isReadOnly}
/>
<TradingDropdownSeparator />
{!isReadOnly && (
@ -141,11 +142,13 @@ const KeypairRadioGroup = ({
pubKeys,
activeKey,
onSelect,
isReadOnly,
}: {
pubKey: string | undefined;
pubKeys: Key[];
activeKey: string | undefined;
onSelect: (pubKey: string) => void;
isReadOnly: boolean;
}) => {
const { data } = usePartyProfilesQuery({
variables: { partyIds: pubKeys.map((pk) => pk.publicKey) },
@ -165,6 +168,7 @@ const KeypairRadioGroup = ({
pk={pk}
isActive={activeKey === pk.publicKey}
alias={profile?.node.alias}
isReadOnly={isReadOnly}
/>
);
})}
@ -176,10 +180,12 @@ const KeypairItem = ({
pk,
isActive,
alias,
isReadOnly,
}: {
pk: Key;
alias: string | undefined;
isActive: boolean;
isReadOnly: boolean;
}) => {
const t = useT();
const [copied, setCopied] = useCopyTimeout();
@ -210,6 +216,7 @@ const KeypairItem = ({
className={classNames('flex-1 mr-2 text-secondary text-sm')}
data-testid={`key-${pk.publicKey}`}
>
{!isReadOnly && (
<Tooltip description={t('Public facing key alias. Click to edit')}>
<button
data-testid="alias"
@ -220,6 +227,7 @@ const KeypairItem = ({
{isActive && <VegaIcon name={VegaIconNames.EDIT} />}
</button>
</Tooltip>
)}
</div>
</div>
<TradingDropdownItemIndicator />