Skip to content

Commit bb77f8f

Browse files
authored
Noves.fi tag (#2579)
1 parent 37b47ad commit bb77f8f

8 files changed

+97
-3
lines changed

public/static/noves-logo-dark.svg

+35
Loading

public/static/noves-logo.svg

+35
Loading

ui/shared/tx/interpretation/TxInterpretation.tsx

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Tooltip, Image, chakra } from '@chakra-ui/react';
1+
import { Tooltip, Image, chakra, useColorModeValue } from '@chakra-ui/react';
22
import BigNumber from 'bignumber.js';
33
import React from 'react';
44

@@ -38,6 +38,7 @@ type Props = {
3838
isLoading?: boolean;
3939
addressDataMap?: Record<string, AddressParam>;
4040
className?: string;
41+
isNoves?: boolean;
4142
};
4243

4344
type NonStringTxInterpretationVariable = Exclude<TxInterpretationVariable, TxInterpretationVariableString>;
@@ -173,7 +174,8 @@ const TxInterpretationElementByType = (
173174
}
174175
};
175176

176-
const TxInterpretation = ({ summary, isLoading, addressDataMap, className }: Props) => {
177+
const TxInterpretation = ({ summary, isLoading, addressDataMap, className, isNoves }: Props) => {
178+
const novesLogoUrl = useColorModeValue('/static/noves-logo.svg', '/static/noves-logo-dark.svg');
177179
if (!summary) {
178180
return null;
179181
}
@@ -191,7 +193,7 @@ const TxInterpretation = ({ summary, isLoading, addressDataMap, className }: Pro
191193
const chunks = getStringChunks(intermediateResult);
192194

193195
return (
194-
<Skeleton isLoaded={ !isLoading } className={ className } fontWeight={ 500 } whiteSpace="pre-wrap" >
196+
<Skeleton isLoaded={ !isLoading } className={ className } fontWeight={ 500 } whiteSpace="pre-wrap">
195197
<Tooltip label="Transaction summary">
196198
<IconSvg name="lightning" boxSize={ 5 } color="text_secondary" mr={ 1 } verticalAlign="text-top"/>
197199
</Tooltip>
@@ -216,6 +218,14 @@ const TxInterpretation = ({ summary, isLoading, addressDataMap, className }: Pro
216218
</chakra.span>
217219
);
218220
}) }
221+
{ isNoves && (
222+
<Tooltip label="Human readable transaction provided by Noves.fi">
223+
<Tag ml={ 2 } display="inline-flex" alignItems="center" verticalAlign="unset" transform="translateY(-2px)">
224+
by
225+
<Image src={ novesLogoUrl } alt="Noves logo" h="12px" ml={ 1.5 }/>
226+
</Tag>
227+
</Tooltip>
228+
) }
219229
</Skeleton>
220230
);
221231
};

ui/tx/TxSubHeading.pw.tsx

+13
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { AddressMetadataInfo, AddressMetadataTagApi } from 'types/api/addre
55
import config from 'configs/app';
66
import * as addressMock from 'mocks/address/address';
77
import { protocolTagWithMeta } from 'mocks/metadata/address';
8+
import { transaction as novesTransaction } from 'mocks/noves/transaction';
89
import * as txMock from 'mocks/txs/tx';
910
import { txInterpretation } from 'mocks/txs/txInterpretation';
1011
import { ENVS_MAP } from 'playwright/fixtures/mockEnvs';
@@ -144,3 +145,15 @@ test.describe('blockscout provider', () => {
144145
await expect(component).toHaveScreenshot();
145146
});
146147
});
148+
149+
test.describe('noves provider', () => {
150+
test.beforeEach(async({ mockEnvs }) => {
151+
await mockEnvs([ [ 'NEXT_PUBLIC_TRANSACTION_INTERPRETATION_PROVIDER', 'noves' ] ]);
152+
});
153+
154+
test('with interpretation +@mobile +@dark-mode', async({ render, mockApiResponse }) => {
155+
await mockApiResponse('noves_transaction', novesTransaction, { pathParams: { hash } });
156+
const component = await render(<TxSubHeading hash={ hash } hasTag={ false } txQuery={ txQuery }/>);
157+
await expect(component).toHaveScreenshot();
158+
});
159+
});

ui/tx/TxSubHeading.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ const TxSubHeading = ({ hash, hasTag, txQuery }: Props) => {
7474
addressDataMap={ addressDataMap }
7575
fontSize="lg"
7676
mr={{ base: 0, lg: 6 }}
77+
isNoves
7778
/>
7879
);
7980
} else if (hasInternalInterpretation) {

0 commit comments

Comments
 (0)