Skip to content

Commit

Permalink
fix: manor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AMIRKHANEF committed Oct 26, 2024
1 parent dc0fbd2 commit b34be93
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Thumbnail from './Thumbnail';
const UNAVAILABLE_HEIGHT = 320;
const LIST_HEIGHT = innerHeight - UNAVAILABLE_HEIGHT;

function NftList ({ apis, itemsDetail, nfts }: ItemsListProps): React.ReactElement {
function NftList ({ apis, nfts }: ItemsListProps): React.ReactElement {
const { t } = useTranslation();

return (
Expand All @@ -38,7 +38,6 @@ function NftList ({ apis, itemsDetail, nfts }: ItemsListProps): React.ReactEleme
<Thumbnail
api={apis[nftInfo.chainName]}
itemInformation={nftInfo}
itemsDetail={itemsDetail}
key={index}
/>
))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export const IPFS_GATEWAYS = [

export const MAX_RETRY_ATTEMPTS = IPFS_GATEWAYS.length;
export const INITIAL_BACKOFF_TIME = 1000; // 1 second
export const MAX_BACKOFF_TIME = 10000; // 10 seconds

export const SUPPORTED_NFT_CHAINS = {
'Kusama Asset Hub': { name: 'kusamaassethub', prefix: 2 },
Expand Down
35 changes: 18 additions & 17 deletions packages/extension-polkagate/src/fullscreen/nft/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { ApiPromise } from '@polkadot/api';
import type { Chain } from '@polkadot/extension-chains/types';
import type { BN } from '@polkadot/util';

export interface ItemInformation {
export interface ItemOnChainInfo {
collectionId?: string;
chainName: string; // polkadot, kusama or westend asset hubs
itemId?: string;
Expand All @@ -19,6 +19,23 @@ export interface ItemInformation {
items?: number;
}

export interface ItemMetadata {
animation_url?: string | null;
name?: string | undefined;
description?: string | undefined;
image?: string | null | undefined;
attributes?: Attribute[] | undefined;
tags?: string[] | undefined;
metadataLink?: string;
imageContentType?: string;
animationContentType?: string;
mediaUri?: string;
}

export interface ItemInformation extends ItemOnChainInfo, ItemMetadata {
noData?: boolean;
}

export interface FilterSectionProps {
items: ItemInformation[] | null | undefined;
setItemsToShow: React.Dispatch<React.SetStateAction<ItemInformation[] | null | undefined>>;
Expand All @@ -33,24 +50,10 @@ export interface CheckboxButtonProps {

interface Attribute { label: string; value: string }

export interface ItemMetadata {
animation_url?: string | null;
name?: string | undefined;
description?: string | undefined;
image?: string | null | undefined;
attributes: Attribute[] | undefined;
tags: string[] | undefined;
metadataLink: string;
imageContentType?: string;
animationContentType?: string;
mediaUri?: string;
}

export type ItemsDetail = Record<string, ItemMetadata | null | undefined>;

export interface ThumbnailProps {
itemInformation: ItemInformation | undefined;
itemsDetail: ItemsDetail;
api: ApiPromise | undefined;
}

Expand All @@ -69,7 +72,6 @@ export interface FullscreenNftModalProps {

export interface DetailsProp {
api: ApiPromise | undefined;
details: ItemMetadata | null;
itemInformation: ItemInformation;
show: boolean;
setShowDetail: React.Dispatch<React.SetStateAction<boolean>>;
Expand All @@ -91,7 +93,6 @@ export interface DetailProp {

export interface ItemsListProps {
nfts: ItemInformation[] | null | undefined;
itemsDetail: ItemsDetail;
apis: Record<string, ApiPromise | undefined>;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/extension-polkagate/src/util/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -838,4 +838,4 @@ export interface FastestConnectionType {

export type RecentChainsType = Record<string, string[]>;

export type NftItemsContextType = Record<string, ItemInformation[]>;
export type NftItemsType= Record<string, ItemInformation[]>;

0 comments on commit b34be93

Please sign in to comment.