Skip to content

Commit

Permalink
feat: reload nft collections
Browse files Browse the repository at this point in the history
  • Loading branch information
0xkynz committed Nov 30, 2023
1 parent 7eb35cc commit 3c4293b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
6 changes: 3 additions & 3 deletions packages/admin/src/contracts/cep78/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ export enum MetadataMutability {
}

export enum MintingMode {
Installer,
Public,
ACL,
Installer = '0',
Public = '1',
ACL = '2',
}

export enum BurnMode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ export const useGetAllNftCollections = (
return useQuery(QueryKeys.NFT_COLLECTIONS, () => getNftCollections(query), {
...options,
refetchOnWindowFocus: true,
refetchInterval: 30 * 1000,
});
};
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { MintingMode } from '@mlem-admin/contracts/cep78';
import { DeployStatusEnum } from '@mlem-admin/enums';
import { useGetPublicNftCollections } from '@mlem-admin/hooks/queries/useGetPublicNftCollections';
import { NftCollection } from '@mlem-admin/types/nft-collection';
import { AutocompleteElement } from 'react-hook-form-mui';
Expand All @@ -13,18 +15,39 @@ const SelectNftCollectionsField = ({ name, campaignId }: Props) => {
isLoading,
} = useGetPublicNftCollections();

console.log('nftCollections: ', nftCollections);

return (
<AutocompleteElement
multiple
loading={isLoading}
matchId
label="Nft Collections"
label="Nft Collection"
name={name}
options={nftCollections
.filter(
(nftCollection: NftCollection) =>
.filter((nftCollection: NftCollection) => {
if (nftCollection.mintingMode === MintingMode.Installer) {
return false;
}

if (nftCollection.mintingMode === MintingMode.ACL) {
if (!nftCollection.brokerId) {
return false;
}

console.log(nftCollection.brokerDeployStatus);

if (
nftCollection.brokerDeployStatus !== DeployStatusEnum.COMPLETED
) {
return false;
}
}

return (
!nftCollection.campaignId || nftCollection.campaignId === campaignId
)
);
})
.map((item: NftCollection) => {
return {
id: item.id,
Expand Down

0 comments on commit 3c4293b

Please sign in to comment.