Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/webapp' into koni/dev/issue-2086
Browse files Browse the repository at this point in the history
  • Loading branch information
lw-cdm committed Nov 1, 2023
2 parents f73ff8d + 790119b commit 2b9306c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,9 @@ export default class KoniState {
}

public subscribeNftCollection () {
return this.dbService.stores.nftCollection.subscribeNftCollection(this.activeChainSlugs);
const getChains = () => this.activeChainSlugs;

return this.dbService.stores.nftCollection.subscribeNftCollection(getChains);
}

resetNft (newAddress: string): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { liveQuery } from 'dexie';
import BaseStoreWithChain from './BaseStoreWithChain';

export default class NftCollectionStore extends BaseStoreWithChain<NftCollection> {
subscribeNftCollection (chains?: string[]) {
return liveQuery(() => this.getNftCollection(chains));
subscribeNftCollection (getChains: () => string[] | undefined) {
return liveQuery(() => this.getNftCollection(getChains()));
}

getNftCollection (chainList?: string[]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import { NftCollection, NftItem } from '@subwallet/extension-base/background/Kon
import { EmptyList, Layout, PageWrapper } from '@subwallet/extension-koni-ui/components';
import { BaseModal } from '@subwallet/extension-koni-ui/components/Modal/BaseModal';
import NoContent, { PAGE_TYPE } from '@subwallet/extension-koni-ui/components/NoContent';
import { IMPORT_NFT_MODAL } from '@subwallet/extension-koni-ui/constants';
import { DataContext } from '@subwallet/extension-koni-ui/contexts/DataContext';
import { ScreenContext } from '@subwallet/extension-koni-ui/contexts/ScreenContext';
import { useGetNftByAccount, useNotification, useSetCurrentPage, useTranslation } from '@subwallet/extension-koni-ui/hooks';
import { reloadCron } from '@subwallet/extension-koni-ui/messaging';
import { NftGalleryWrapper } from '@subwallet/extension-koni-ui/Popup/Home/Nfts/component/NftGalleryWrapper';
import { INftCollectionDetail } from '@subwallet/extension-koni-ui/Popup/Home/Nfts/utils';
import { ThemeProps } from '@subwallet/extension-koni-ui/types';
import { ActivityIndicator, Button, ButtonProps, Icon, ModalContext, SwList } from '@subwallet/react-ui';
import { ActivityIndicator, Button, ButtonProps, Icon, ModalContext, SwList, useExcludeModal } from '@subwallet/react-ui';
import CN from 'classnames';
import { ArrowClockwise, Image, Plus, PlusCircle } from 'phosphor-react';
import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react';
Expand All @@ -39,7 +40,7 @@ const rightIcon = (
/>
);

const IMPORT_NFT_MODAL = 'import-nft-modal';
const modalId = IMPORT_NFT_MODAL;

function Component ({ className = '' }: Props): React.ReactElement<Props> {
useSetCurrentPage('/home/nfts/collections');
Expand All @@ -56,6 +57,9 @@ function Component ({ className = '' }: Props): React.ReactElement<Props> {

const dataContext = useContext(DataContext);
const { isWebUI } = useContext(ScreenContext);

useExcludeModal(modalId);

const { nftCollections, nftItems } = useGetNftByAccount();
const [loading, setLoading] = React.useState<boolean>(false);
const notify = useNotification();
Expand Down Expand Up @@ -189,11 +193,11 @@ function Component ({ className = '' }: Props): React.ReactElement<Props> {
}, [emptyButtonProps, isWebUI, t]);

const openImportModal = useCallback(() => {
activeModal(IMPORT_NFT_MODAL);
activeModal(modalId);
}, [activeModal]);

const closeImportModal = useCallback(() => {
inactiveModal(IMPORT_NFT_MODAL);
inactiveModal(modalId);
setImportNftKey(`importNftKey-${Date.now()}`);
}, [inactiveModal]);

Expand Down Expand Up @@ -283,7 +287,7 @@ function Component ({ className = '' }: Props): React.ReactElement<Props> {

<BaseModal
className={CN('import-nft-modal', className)}
id={IMPORT_NFT_MODAL}
id={modalId}
onCancel={closeImportModal}
title={t('Import NFT')}
>
Expand Down
8 changes: 7 additions & 1 deletion packages/extension-koni-ui/src/constants/modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,18 @@ export const WALLET_CONNECT_LIST_MODAL = 'wallet-connect-list-modal';
export const CONFIRMATION_MODAL = 'confirmation-modal';
export const BUY_TOKEN_MODAL = 'buy-token-modal';

/* Token */

export const IMPORT_NFT_MODAL = 'import-nft-modal';

/* Token */

/* Extension */

export const DISCONNECT_EXTENSION_MODAL = 'disconnect-extension-modal';
export const SELECT_EXTENSION_MODAL = 'select-extension-modal';

/* */
/* Extension */

/* Earning */

Expand Down

0 comments on commit 2b9306c

Please sign in to comment.