Skip to content

Commit 73162a1

Browse files
committed
fix(suite): transaction labels blurred during editing
1 parent 86d92ed commit 73162a1

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

packages/suite/src/components/wallet/TransactionItem/TransactionTarget/TransactionTarget.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { WalletAccountTransaction } from 'src/types/wallet';
2323
import { useDispatch, useSelector } from 'src/hooks/suite';
2424
import { AccountLabels } from 'src/types/suite/metadata';
2525
import { selectLocalCurrency } from 'src/reducers/wallet/settingsReducer';
26+
import { selectLabelingValueBeingEdited } from 'src/reducers/suite/metadataReducer';
2627

2728
import { TokenTransferAddressLabel } from './TokenTransferAddressLabel';
2829
import { TargetAddressLabel } from './TargetAddressLabel';
@@ -167,6 +168,10 @@ export const TransactionTarget = ({
167168
const operation = getTxOperation(transaction.type);
168169
const targetMetadata = accountMetadata?.outputLabels?.[transaction.txid]?.[target.n];
169170

171+
const defaultMetadataValue = `${transaction.txid}-${target.n}`;
172+
const labelingValueBeingEdited = useSelector(selectLabelingValueBeingEdited);
173+
const isBeingEdited = defaultMetadataValue === labelingValueBeingEdited;
174+
170175
const copyAddress = () => {
171176
let payload: ToastPayload = { type: 'copy-to-clipboard' };
172177
if (!target?.addresses) {
@@ -190,6 +195,7 @@ export const TransactionTarget = ({
190195
return (
191196
<TransactionTargetLayout
192197
{...baseLayoutProps}
198+
useHiddenPlaceholder={!isBeingEdited}
193199
addressLabel={
194200
<MetadataLabeling
195201
isDisabled={isActionDisabled}
@@ -213,7 +219,7 @@ export const TransactionTarget = ({
213219
entityKey: accountKey,
214220
txid: transaction.txid,
215221
outputIndex: target.n,
216-
defaultValue: `${transaction.txid}-${target.n}`,
222+
defaultValue: defaultMetadataValue,
217223
value: targetMetadata,
218224
}}
219225
/>

packages/suite/src/components/wallet/TransactionItem/TransactionTargetLayout.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ interface TransactionTargetLayoutProps {
101101
amount?: ReactNode;
102102
fiatAmount?: ReactNode;
103103
useAnimation?: boolean;
104+
useHiddenPlaceholder?: boolean;
104105
singleRowLayout?: boolean;
105106
isFirst?: boolean;
106107
isLast?: boolean;
@@ -115,6 +116,7 @@ export const TransactionTargetLayout = ({
115116
singleRowLayout,
116117
isFirst,
117118
isLast,
119+
useHiddenPlaceholder,
118120
...rest
119121
}: TransactionTargetLayoutProps) => {
120122
const animation = useAnimation ? motionAnimation.expand : {};
@@ -128,7 +130,11 @@ export const TransactionTargetLayout = ({
128130
</TimelineDotWrapper>
129131

130132
<TargetAddress>
131-
<StyledHiddenPlaceholder>{addressLabel}</StyledHiddenPlaceholder>
133+
{useHiddenPlaceholder === false ? (
134+
addressLabel
135+
) : (
136+
<StyledHiddenPlaceholder>{addressLabel}</StyledHiddenPlaceholder>
137+
)}
132138
</TargetAddress>
133139

134140
<TargetAmountsWrapper $paddingBottom={!isLast}>

packages/suite/src/reducers/suite/metadataReducer.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ export const selectIsLabelingAvailable = (state: MetadataRootState) => {
280280
};
281281

282282
/**
283-
it is possible to initiate metadata
283+
it is possible to initiate metadata
284284
*/
285285
export const selectIsLabelingInitPossible = (state: MetadataRootState) => {
286286
const device = selectDevice(state);
@@ -328,4 +328,6 @@ export const selectPasswordManagerState = (
328328
METADATA_PASSWORDS.DEFAULT_PASSWORD_MANAGER_STATE) as PasswordManagerState;
329329
};
330330

331+
export const selectLabelingValueBeingEdited = ({ metadata }: MetadataRootState) => metadata.editing;
332+
331333
export default metadataReducer;

0 commit comments

Comments
 (0)