Skip to content

Commit 2f37831

Browse files
GBBE-308 Add key in single Entity operation data on transaction view (#126)
1 parent 4dd6004 commit 2f37831

6 files changed

+49
-15
lines changed

ui/entityOps/OpExpandableDetails.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@ import OperationSpecificData from 'ui/entityOp/OperationSpecificData';
99
import { Container, ItemDivider, ItemLabel, ItemValue } from 'ui/shared/DetailedInfo/DetailedInfo';
1010
import DetailedInfoTimestamp from 'ui/shared/DetailedInfo/DetailedInfoTimestamp';
1111
import AddressEntity from 'ui/shared/entities/address/AddressEntity';
12+
import StorageEntity from 'ui/shared/entities/entity/StorageEntity';
1213

1314
import EntityOpType from './EntityOpType';
1415

1516
interface Props {
1617
txHash: string;
1718
opIndex: string;
19+
withEntity?: boolean;
1820
}
1921

20-
const OpExpandableDetails = ({ txHash, opIndex }: Props) => {
22+
const OpExpandableDetails = ({ txHash, opIndex, withEntity }: Props) => {
2123
const { data, isPlaceholderData: isLoading } = useApiQuery('golemBaseIndexer:operation', {
2224
pathParams: { tx_hash: txHash, op_index: opIndex },
2325
queryOptions: {
@@ -32,6 +34,19 @@ const OpExpandableDetails = ({ txHash, opIndex }: Props) => {
3234

3335
return (
3436
<Container data-testid="operation-details">
37+
{ withEntity && (
38+
<>
39+
<ItemLabel hint="Entity operation type">Entity</ItemLabel>
40+
<ItemValue>
41+
<StorageEntity
42+
entityKey={ data.entity_key }
43+
isLoading={ isLoading }
44+
truncation="dynamic"
45+
/>
46+
</ItemValue>
47+
</>
48+
) }
49+
3550
<ItemLabel hint="Entity operation type">Type</ItemLabel>
3651
<ItemValue>
3752
<EntityOpType operation={ data.operation } isLoading={ isLoading }/>

ui/tx/details/TxInfo.pw.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22

3+
import * as entityOpsMock from 'mocks/operations/entityOps';
34
import * as tokenInstanceMock from 'mocks/tokens/tokenInstance';
45
import * as txMock from 'mocks/txs/tx';
56
import { ENVS_MAP } from 'playwright/fixtures/mockEnvs';
@@ -167,3 +168,20 @@ test('with interop message out +@mobile', async({ page, render, mockEnvs, mockAs
167168
maskColor: pwConfig.maskColor,
168169
});
169170
});
171+
172+
test('with sigle operation only +@mobile +@dark-mode', async({ page, render, mockApiResponse }) => {
173+
await mockApiResponse('golemBaseIndexer:operation', entityOpsMock.createEntityHistoryEntry, {
174+
pathParams: {
175+
tx_hash: txMock.base.hash,
176+
op_index: '0',
177+
},
178+
});
179+
const component = await render(<TxInfo data={ txMock.base } isLoading={ false } isSingleOperation/>);
180+
181+
await page.getByText('View details').click();
182+
183+
await expect(component).toHaveScreenshot({
184+
mask: [ page.locator(pwConfig.adsBannerSelector) ],
185+
maskColor: pwConfig.maskColor,
186+
});
187+
});

ui/tx/details/TxInfo.tsx

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -857,24 +857,25 @@ const TxInfo = ({ data, tacOperations, isLoading, socketStatus, isSingleOperatio
857857
</DetailedInfo.ItemValue>
858858
</>
859859
) }
860+
</>
861+
) }
860862

861-
{ isSingleOperation && (
862-
<>
863-
<DetailedInfo.ItemDivider/>
863+
{ isSingleOperation && (
864+
<>
865+
<DetailedInfo.ItemDivider/>
864866

865-
<DetailedInfo.ItemLabel
866-
hint="Since the transaction contains exactly one operation, we automatically show its full preview."
867-
isLoading={ isLoading }
868-
>
869-
Entity operation
870-
</DetailedInfo.ItemLabel>
871-
<DetailedInfo.ItemValue>
872-
<OpExpandableDetails txHash={ data.hash } opIndex="0"/>
873-
</DetailedInfo.ItemValue>
874-
</>
875-
) }
867+
<DetailedInfo.ItemLabel
868+
hint="Since the transaction contains exactly one operation, we automatically show its full preview."
869+
isLoading={ isLoading }
870+
>
871+
Entity operation
872+
</DetailedInfo.ItemLabel>
873+
<DetailedInfo.ItemValue>
874+
<OpExpandableDetails txHash={ data.hash } opIndex="0" withEntity/>
875+
</DetailedInfo.ItemValue>
876876
</>
877877
) }
878+
878879
<TxInfoScrollFees data={ data } isLoading={ isLoading }/>
879880

880881
<CollapsibleDetails loading={ isLoading } mt={ 6 } gridColumn={{ base: undefined, lg: '1 / 3' }} isExpanded={ isExpanded } onClick={ handleCutLinkClick }>
155 KB
Loading
153 KB
Loading
220 KB
Loading

0 commit comments

Comments
 (0)