Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display NFTs #143

Merged
merged 47 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
b8c00ec
Initial commit for NFTs
TusharPardhe Mar 17, 2023
8e63ed3
Added a comment
TusharPardhe Apr 14, 2023
3bcc9ca
Added view more button
TusharPardhe Apr 18, 2023
6707aa4
Added test cases
TusharPardhe Apr 19, 2023
e46d429
Incorporated review comments
TusharPardhe Apr 30, 2023
9d2935f
Fixed cypress issue
TusharPardhe Apr 30, 2023
c23105b
Rename types and files
ThibautBremand Jun 28, 2023
07cee20
Fix NFTCard unit tests
ThibautBremand Jun 28, 2023
f610f17
Fix the way NFTs are displayed
ThibautBremand Jun 28, 2023
e100ae1
Add NFT details modal
ThibautBremand Jun 28, 2023
473c571
Do not filter out NFTs without URIs
ThibautBremand Jun 29, 2023
c8ac57d
Add cypress e2e tests
ThibautBremand Jun 29, 2023
f2f3748
Fix dependencies post rebase
ThibautBremand Jul 4, 2023
d28cfc8
Clean up types
FlorianBouron Jul 9, 2023
9daba3d
Fix build
ThibautBremand Jul 10, 2023
a9b6b7f
Fix NFT cypress tests
ThibautBremand Jul 22, 2023
4f2c321
Improve NFTCard UI
ThibautBremand Jul 22, 2023
ff34688
Fix NFT display when the URI is directly an img link
ThibautBremand Jul 28, 2023
0fb710f
Fix NFT display when the URI is an ipfs link without the .json extension
ThibautBremand Jul 28, 2023
77051e9
Fix NFT display when the URI is in "image_url" property of the json
ThibautBremand Jul 28, 2023
7f2e6e0
Handle more NFT display edge cases
ThibautBremand Jul 28, 2023
662732d
Add NFTViewer unit tests
ThibautBremand Jul 29, 2023
047eb8e
Handle case when the image is an http link
ThibautBremand Jul 29, 2023
7c3bf33
Move NFT image resolver into a dedicated util file
ThibautBremand Aug 1, 2023
50fbbf4
Do not display NFT without data
ThibautBremand Aug 1, 2023
eb6ee98
Fix NFTCard unit tests
ThibautBremand Aug 2, 2023
be3a41d
Handle .gif direct links in NFT Viewer
ThibautBremand Aug 4, 2023
88b90c7
Display NFT without data with a fallback description
ThibautBremand Aug 4, 2023
20bf669
Cleaning up code
FlorianBouron Aug 4, 2023
71cb8fd
Fix post review
ThibautBremand Aug 6, 2023
6fc5ad5
Simplify formatStringToBeDisplayed function
ThibautBremand Aug 6, 2023
3fdebd6
Add post review changes
ThibautBremand Aug 9, 2023
630dac3
Wrap fetchNFTs into useCallback
ThibautBremand Aug 9, 2023
c24a230
Fix typing in NFTCard.test.tsx
ThibautBremand Aug 9, 2023
97c7ec0
Extract NFT parts into dedicated components
ThibautBremand Aug 11, 2023
ee14815
Change code post review
ThibautBremand Aug 11, 2023
c5f274c
Introduce TruncatedText component
ThibautBremand Aug 11, 2023
b88e058
Fix post rebase
ThibautBremand Aug 11, 2023
c6e49a1
Handle parsing of XLS-24 standard
ThibautBremand Aug 11, 2023
6611661
Fix unit tests
ThibautBremand Aug 11, 2023
2721b72
Refactor TruncatedText & introduce TruncatedMultiLinesText components
ThibautBremand Aug 13, 2023
ae7e64c
Rework TruncatedText and TruncatedMultiLinesText components
ThibautBremand Aug 14, 2023
207f171
Remove NFTListItem component
ThibautBremand Aug 14, 2023
0139fd5
Refactor TruncatedText component
ThibautBremand Aug 14, 2023
f7f5859
Fix code post review
ThibautBremand Aug 14, 2023
dc53022
Refactor TruncatedText
FlorianBouron Aug 14, 2023
d71769c
Edit default NFT image
FlorianBouron Aug 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions packages/constants/src/payload/payload.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
SetAccountFlags,
CreateOfferFlags
} from '../xrpl/basic.types';
import { AccountNFToken } from './../xrpl/nft.types';
import { AccountNFToken, AccountNFTokenResponse, NFTokenIDResponse } from './../xrpl/nft.types';

/*
* Request Payloads
Expand Down Expand Up @@ -323,18 +323,13 @@ export interface SetTrustlineResponseDeprecated {
hash: string | null | undefined;
}

export interface GetNFTResponse
extends BaseResponse<{ account_nfts: AccountNFToken[]; marker?: unknown }> {}
export interface GetNFTResponse extends BaseResponse<AccountNFTokenResponse> {}

export interface GetNFTResponseDeprecated {
nfts: AccountNFToken[] | null | undefined;
}

export interface MintNFTResponse
extends BaseResponse<{
NFTokenID: string;
hash: string;
}> {}
export interface MintNFTResponse extends BaseResponse<NFTokenIDResponse> {}

export interface CreateNFTOfferResponse
extends BaseResponse<{
Expand Down
1 change: 1 addition & 0 deletions packages/constants/src/xrpl/nft.constant.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const IPFSResolverPrefix = 'https://ipfs.io/ipfs/';
25 changes: 25 additions & 0 deletions packages/constants/src/xrpl/nft.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,28 @@ export interface AccountNFToken {
URI?: string;
nft_serial: number;
}

export interface AccountNFTokenResponse {
account_nfts: AccountNFToken[];
marker?: unknown;
}

export interface NFTData {
ThibautBremand marked this conversation as resolved.
Show resolved Hide resolved
NFTokenID: string;

// XLS-24 standard fields
nftType?: string;
schema?: string;
name?: string;
description?: string;
image?: string;
collection?: {
name?: string;
family?: string;
};
}

export interface NFTokenIDResponse {
hash: string;
NFTokenID: string;
}
34 changes: 26 additions & 8 deletions packages/extension/cypress/e2e/NFT.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { formatFlags } from '../../src/utils';
describe('Mint', () => {
// deepcode ignore NoHardcodedPasswords: password used for testing purposes
const PASSWORD = 'SECRET_PASSWORD';
const MINT_NFT_URL = `http://localhost:3000?mint-nft?URI=4d696e746564207468726f7567682047656d57616c6c657421&flags=%7B%22tfOnlyXRP%22%3Afalse%2C%22tfTransferable%22%3Atrue%7D&fee=199&transferFee=3000&NFTokenTaxon=0&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210324818&requestMessage=undefined&transaction=mintNFT`;
const MINT_NFT_URL = `http://localhost:3000/mint-nft?URI=4d696e746564207468726f7567682047656d57616c6c657421&flags=%7B%22tfOnlyXRP%22%3Afalse%2C%22tfTransferable%22%3Atrue%7D&fee=199&transferFee=3000&NFTokenTaxon=0&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210324818&requestMessage=undefined&transaction=mintNFT`;

beforeEach(() => {
// Mock the localStorage with a wallet already loaded
Expand Down Expand Up @@ -54,7 +54,25 @@ describe('Mint', () => {
cy.get('p[data-testid="transaction-subtitle"]').should('have.text', 'Transaction Successful');
});

it('Read the minted NFT Token ID', () => {
it('View a NFT in the NFT Viewer', () => {
navigate('localhost:3000', PASSWORD);

// Wait for the wallet to load
cy.get('[data-testid="token-loader"]').should('not.exist');

// Go to NFT Viewer
cy.contains('button', 'NFTs').click();

// Find a NFT and open the details
cy.get('[data-testid="OpenInNewOutlinedIcon"]').parent('button').first().click();

// Check that the details view is open
cy.contains('NFT Details');
cy.contains('Token ID');
cy.contains('Description');
});

it('Read the minted NFT Token ID from the transaction history', () => {
navigate('localhost:3000', PASSWORD);

// Wait for the wallet to load
Expand All @@ -76,7 +94,7 @@ describe('Mint', () => {
});

it('Create NFT Offer (50 XRP)', function () {
const url = `http://localhost:3000?create-nft-offer&amount=50000000&NFTokenID=${this.NFTokenID}&fee=199&flags=%7B%22tfSellNFToken%22%3Atrue%7D&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210325582&requestMessage=undefined&transaction=createNFTOffer`;
const url = `http://localhost:3000/create-nft-offer?amount=50000000&NFTokenID=${this.NFTokenID}&fee=199&flags=%7B%22tfSellNFToken%22%3Atrue%7D&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210325582&requestMessage=undefined&transaction=createNFTOffer`;
navigate(url, PASSWORD);

// Confirm
Expand Down Expand Up @@ -196,7 +214,7 @@ describe('Mint', () => {
});

it('Accept NFT Offer', function () {
const url = `http://localhost:3000?accept-nft-offer&NFTokenSellOffer=${this.OfferID}&fee=199&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210325959&requestMessage=undefined&transaction=acceptNFTOffer`;
const url = `http://localhost:3000/accept-nft-offer?NFTokenSellOffer=${this.OfferID}&fee=199&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210325959&requestMessage=undefined&transaction=acceptNFTOffer`;

navigate(url, PASSWORD);

Expand Down Expand Up @@ -227,7 +245,7 @@ describe('Mint', () => {
issuer: 'rHZwvHEs56GCmHupwjA4RY7oPA3EoAJWuN',
value: '0.1'
});
const url = `http://localhost:3000?accept-nft-offer&NFTokenBrokerFee=${amount}&NFTokenSellOffer=${this.OfferID}&fee=199&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210325959&requestMessage=undefined&transaction=acceptNFTOffer`;
const url = `http://localhost:3000/accept-nft-offer?NFTokenBrokerFee=${amount}&NFTokenSellOffer=${this.OfferID}&fee=199&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210325959&requestMessage=undefined&transaction=acceptNFTOffer`;

navigate(url, PASSWORD);

Expand All @@ -254,7 +272,7 @@ describe('Mint', () => {
issuer: 'rHZwvHEs56GCmHupwjA4RY7oPA3EoAJWuN',
value: '0.1'
});
const url = `http://localhost:3000?accept-nft-offer&NFTokenBrokerFee=${amount}&NFTokenSellOffer=${this.OfferID}&fee=199&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210325959&requestMessage=undefined&transaction=acceptNFTOffer`;
const url = `http://localhost:3000/accept-nft-offer?NFTokenBrokerFee=${amount}&NFTokenSellOffer=${this.OfferID}&fee=199&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210325959&requestMessage=undefined&transaction=acceptNFTOffer`;

navigate(url, PASSWORD);

Expand All @@ -276,7 +294,7 @@ describe('Mint', () => {
});

it('Cancel NFT Offer', function () {
const url = `http://localhost:3000?cancel-nft-offer&NFTokenOffers=%5B%22${this.OfferID}%22%5D&fee=199&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210325959&requestMessage=undefined&transaction=cancelNFTOffer`;
const url = `http://localhost:3000/cancel-nft-offer?NFTokenOffers=%5B%22${this.OfferID}%22%5D&fee=199&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210325959&requestMessage=undefined&transaction=cancelNFTOffer`;
navigate(url, PASSWORD);

// Confirm
Expand All @@ -300,7 +318,7 @@ describe('Mint', () => {
});

it('Burn NFT', function () {
const url = `http://localhost:3000?burn-nft&NFTokenID=${this.NFTokenID}&fee=199&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210325959&requestMessage=undefined&transaction=burnNFT`;
const url = `http://localhost:3000/burn-nft?NFTokenID=${this.NFTokenID}&fee=199&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210325959&requestMessage=undefined&transaction=burnNFT`;
navigate(url, PASSWORD);

// Confirm
Expand Down
12 changes: 6 additions & 6 deletions packages/extension/cypress/e2e/offers.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Offers', () => {
});

it('Create offer (XRP to ETH)', () => {
const url = `http://localhost:3000?create-offer&takerGets=10000000&takerPays=%7B%22currency%22%3A%22ETH%22%2C%22issuer%22%3A%22rnm76Qgz4G9G4gZBJVuXVvkbt7gVD7szey%22%2C%22value%22%3A%220.1%22%7D&flags=%7B%22tfPassive%22%3Atrue%7D&fee=199&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210328024&requestMessage=undefined&transaction=createOffer`;
const url = `http://localhost:3000/create-offer?takerGets=10000000&takerPays=%7B%22currency%22%3A%22ETH%22%2C%22issuer%22%3A%22rnm76Qgz4G9G4gZBJVuXVvkbt7gVD7szey%22%2C%22value%22%3A%220.1%22%7D&flags=%7B%22tfPassive%22%3Atrue%7D&fee=199&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210328024&requestMessage=undefined&transaction=createOffer`;
navigate(url, PASSWORD);

cy.get('h1[data-testid="page-title"]').should('have.text', 'Create Offer');
Expand Down Expand Up @@ -54,7 +54,7 @@ describe('Offers', () => {
value: '0.1'
});

const url = `http://localhost:3000?create-offer&takerGets=10000000&takerPays=${amount}&flags=%7B%22tfPassive%22%3Atrue%7D&fee=199&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210328024&requestMessage=undefined&transaction=createOffer`;
const url = `http://localhost:3000/create-offer?takerGets=10000000&takerPays=${amount}&flags=%7B%22tfPassive%22%3Atrue%7D&fee=199&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210328024&requestMessage=undefined&transaction=createOffer`;
navigate(url, PASSWORD);

cy.get('h1[data-testid="page-title"]').should('have.text', 'Create Offer');
Expand Down Expand Up @@ -87,7 +87,7 @@ describe('Offers', () => {
value: '0.1'
});

const url = `http://localhost:3000?create-offer&takerPays=10000000&takerGets=${amount}&flags=%7B%22tfPassive%22%3Atrue%7D&fee=199&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210328024&requestMessage=undefined&transaction=createOffer`;
const url = `http://localhost:3000/create-offer?takerPays=10000000&takerGets=${amount}&flags=%7B%22tfPassive%22%3Atrue%7D&fee=199&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210328024&requestMessage=undefined&transaction=createOffer`;
navigate(url, PASSWORD);

cy.get('h1[data-testid="page-title"]').should('have.text', 'Create Offer');
Expand Down Expand Up @@ -120,7 +120,7 @@ describe('Offers', () => {
value: '0.1'
});

const url = `http://localhost:3000?create-offer&takerGets=10000000&takerPays=${amount}&flags=%7B%22tfPassive%22%3Atrue%7D&fee=199&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210328024&requestMessage=undefined&transaction=createOffer`;
const url = `http://localhost:3000/create-offer?takerGets=10000000&takerPays=${amount}&flags=%7B%22tfPassive%22%3Atrue%7D&fee=199&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210328024&requestMessage=undefined&transaction=createOffer`;
navigate(url, PASSWORD);

cy.get('h1[data-testid="page-title"]').should('have.text', 'Create Offer');
Expand Down Expand Up @@ -153,7 +153,7 @@ describe('Offers', () => {
value: '0.1'
});

const url = `http://localhost:3000?create-offer&takerPays=10000000&takerGets=${amount}&flags=%7B%22tfPassive%22%3Atrue%7D&fee=199&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210328024&requestMessage=undefined&transaction=createOffer`;
const url = `http://localhost:3000/create-offer?takerPays=10000000&takerGets=${amount}&flags=%7B%22tfPassive%22%3Atrue%7D&fee=199&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210328024&requestMessage=undefined&transaction=createOffer`;
navigate(url, PASSWORD);

cy.get('h1[data-testid="page-title"]').should('have.text', 'Create Offer');
Expand Down Expand Up @@ -202,7 +202,7 @@ describe('Offers', () => {

it('Cancel offer', function () {
navigate(
`http://localhost:3000?cancel-offer&offerSequence=${this.sequence}&fee=199&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210328126&requestMessage=undefined&transaction=cancelOffer`,
`http://localhost:3000/cancel-offer?offerSequence=${this.sequence}&fee=199&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210328126&requestMessage=undefined&transaction=cancelOffer`,
PASSWORD
);

Expand Down
2 changes: 1 addition & 1 deletion packages/extension/cypress/e2e/set_account.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('Set Account', () => {

it('Set Account', () => {
cy.visit(
`http://localhost:3000?set-account&emailHash=1D1382344586ECFF844DACFF698C2EFB&fee=199&flags=%7B%22tfAllowXRP%22%3Atrue%7D&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210327555&requestMessage=undefined&transaction=setAccount`,
`http://localhost:3000/set-account?emailHash=1D1382344586ECFF844DACFF698C2EFB&fee=199&flags=%7B%22tfAllowXRP%22%3Atrue%7D&memos=%5B%7B%22memo%22%3A%7B%22memoType%22%3A%224465736372697074696f6e%22%2C%22memoData%22%3A%2254657374206d656d6f%22%7D%7D%5D&id=210327555&requestMessage=undefined&transaction=setAccount`,
{
onBeforeLoad(win) {
(win as any).chrome = (win as any).chrome || {};
Expand Down
4 changes: 2 additions & 2 deletions packages/extension/cypress/e2e/submit_transaction.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Submit Transaction', () => {
});

it('Submit Transaction', () => {
const url = `http://localhost:3000?submit-transaction&transaction=%7B%22TransactionType%22%3A%22Payment%22%2C%22Destination%22%3A%22rhikRdkFw28csKw9z7fVoBjWncz1HSoQij%22%2C%22Amount%22%3A%22100000%22%7D&id=210329246&requestMessage=undefined&submit=transaction`;
const url = `http://localhost:3000/submit-transaction?transaction=%7B%22TransactionType%22%3A%22Payment%22%2C%22Destination%22%3A%22rhikRdkFw28csKw9z7fVoBjWncz1HSoQij%22%2C%22Amount%22%3A%22100000%22%7D&id=210329246&requestMessage=undefined&submit=transaction`;
navigate(url, PASSWORD);

cy.get('h1[data-testid="page-title"]').should('have.text', 'Confirm Transaction');
Expand Down Expand Up @@ -66,7 +66,7 @@ describe('Submit Transaction', () => {
],
Fee: '199'
});
const url = `http://localhost:3000?submit-transaction&transaction=${transaction}&requestMessage=undefined&submit=transaction`;
const url = `http://localhost:3000/submit-transaction?transaction=${transaction}&requestMessage=undefined&submit=transaction`;
navigate(url, PASSWORD);

cy.get('h1[data-testid="page-title"]').should('have.text', 'Confirm Transaction');
Expand Down
4 changes: 2 additions & 2 deletions packages/extension/cypress/e2e/wallet_management.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ describe('Edit wallet', () => {

// Lock the extension
cy.get('button[aria-label="close"]').click();
cy.contains('button', 'Wallets').parent().children().eq(2).click();
cy.contains('button', 'Wallets').parent().children().eq(3).click();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why has this changed? Some comments for bellow.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"NFTs" button has been added to the menu at position 2

cy.contains('button', 'Lock').click();

// Check if the wallets are properly loaded with the name changed
Expand Down Expand Up @@ -600,7 +600,7 @@ describe('Switch wallet', () => {
cy.contains('Wallet 3').should('be.visible');

// Lock the extension
cy.contains('button', 'Wallets').parent().children().eq(2).click();
cy.contains('button', 'Wallets').parent().children().eq(3).click();
cy.contains('button', 'Lock').click();

// Check if the default wallet is properly loaded
Expand Down
3 changes: 3 additions & 0 deletions packages/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
"react": "^17.0.2",
"react-content-loader": "^6.2.0",
"react-dom": "^17.0.2",
"react-infinite-scroll-component": "^6.1.0",
"react-json-view": "^1.21.3",
"react-lazy-load-image-component": "^1.6.0",
"react-router-dom": "6",
"react-scripts": "4.0.3",
"ripple-keypairs": "^1.1.5",
Expand All @@ -41,6 +43,7 @@
"@types/node": "^12.0.0",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@types/react-lazy-load-image-component": "^1.5.2",
"cypress": "^12.9.0",
"jest-canvas-mock": "^2.4.0",
"ts-loader": "~8.2.0"
Expand Down
32 changes: 32 additions & 0 deletions packages/extension/src/components/atoms/NFTImage/NFTImage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React, { FC } from 'react';

import { CircularProgress } from '@mui/material';
import { LazyLoadImage } from 'react-lazy-load-image-component';

import { GemWallet } from '../index';

interface NFTImageProps {
imageURL?: string;
height?: number;
width?: number;
}

export const NFTImage: FC<NFTImageProps> = ({ imageURL, height = 250, width = 250 }) => {
return imageURL ? (
<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
<LazyLoadImage
alt="NFT"
height={height}
style={{ borderRadius: '4px', boxShadow: '4px 4px 0px black' }}
beforeLoad={() => <CircularProgress />}
effect="blur"
src={imageURL}
width={width}
/>
</div>
) : (
<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
<GemWallet />
</div>
);
};
1 change: 1 addition & 0 deletions packages/extension/src/components/atoms/NFTImage/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './NFTImage';
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React, { FC } from 'react';

import { ListItem, ListItemText } from '@mui/material';

interface NFTListItemProps {
primary: string;
secondary?: string;
}

export const NFTListItem: FC<NFTListItemProps> = ({ primary, secondary }) => {
if (!secondary) return null;

return (
<ListItem style={{ padding: '8px 24px' }}>
<ListItemText primary={primary} secondary={secondary} />
</ListItem>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './NFTListItem';
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { ComponentProps } from 'react';

import Typography from '@mui/material/Typography';

type TruncatedMultiLinesTextProps = ComponentProps<typeof Typography> & {
text?: string;
maxLines?: string;
};

export const TruncatedMultiLinesText = ({
text = '',
maxLines = '4',
sx,
variant = 'body1'
ThibautBremand marked this conversation as resolved.
Show resolved Hide resolved
}: TruncatedMultiLinesTextProps) => {
return (
<Typography
sx={{
overflow: 'hidden',
display: '-webkit-box',
width: '100%',
'-webkit-box-orient': 'vertical',
'-webkit-line-clamp': maxLines /* start showing ellipsis when X line is reached */,
'white-space': 'pre-wrap' /* let the text wrap preserving spaces */,
...sx
}}
variant={variant}
>
{text}
</Typography>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './TruncatedMultiLinesText';
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { ComponentProps } from 'react';

import { Typography } from '@mui/material';

type TruncatedTextProps = ComponentProps<typeof Typography> & {
text?: string;
};

export const TruncatedText = ({
text = '',
sx,
variant = 'body1',
ThibautBremand marked this conversation as resolved.
Show resolved Hide resolved
...rest
}: TruncatedTextProps) => {
return (
<Typography
sx={{
display: 'block',
overflow: 'hidden',
textOverflow: 'ellipsis',
width: '100%',
...sx
}}
{...rest}
variant={variant}
ThibautBremand marked this conversation as resolved.
Show resolved Hide resolved
>
{text}
</Typography>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './TruncatedText';
Loading