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