Skip to content

Commit

Permalink
fix: fix spinner display in NFT tab (#30427)
Browse files Browse the repository at this point in the history
## **Description**

Fix spinner display in NFt tab.

No functional changes

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/30427?quickstart=1)

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to nft tab
2. Spinner should be centered

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
  • Loading branch information
sahar-fehri authored Feb 19, 2025
1 parent 2abb96a commit a19a398
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
28 changes: 19 additions & 9 deletions ui/components/app/assets/nfts/nft-grid/nft-grid.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import React from 'react';
import { useSelector } from 'react-redux';
import { Hex } from '@metamask/utils';
import { Display } from '../../../../../helpers/constants/design-system';
import {
AlignItems,
Display,
JustifyContent,
} from '../../../../../helpers/constants/design-system';
import { Box } from '../../../../component-library';
import Spinner from '../../../../ui/spinner';
import { getNftImageAlt } from '../../../../../helpers/utils/nfts';
Expand Down Expand Up @@ -99,15 +103,21 @@ export default function NftGrid({
</Box>
);
})}
{nftsStillFetchingIndication ? (
<Box className="nfts-tab__fetching">
<Spinner
color="var(--color-warning-default)"
className="loading-overlay__spinner"
/>
</Box>
) : null}
</Box>
{nftsStillFetchingIndication ? (
<Box
className="nfts-tab__fetching"
justifyContent={JustifyContent.center}
alignItems={AlignItems.center}
display={Display.Flex}
marginTop={4}
>
<Spinner
color="var(--color-warning-default)"
className="loading-overlay__spinner"
/>
</Box>
) : null}
</Box>
);
}
8 changes: 7 additions & 1 deletion ui/components/app/assets/nfts/nfts-tab/nfts-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,13 @@ export default function NftsTab() {

if (!hasAnyNfts && nftsStillFetchingIndication) {
return (
<Box className="nfts-tab__loading">
<Box
className="nfts-tab__loading"
justifyContent={JustifyContent.center}
alignItems={AlignItems.center}
display={Display.Flex}
marginTop={4}
>
<Spinner
color="var(--color-warning-default)"
className="loading-overlay__spinner"
Expand Down

0 comments on commit a19a398

Please sign in to comment.