Skip to content

Commit

Permalink
Merge pull request #1217 from scroll-tech/remove-mintable-badge-batch…
Browse files Browse the repository at this point in the history
…-check

fix: remove batch badge eligibility check
  • Loading branch information
Holybasil authored Jul 31, 2024
2 parents a142341 + eb60b3e commit 964e8f0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 26 deletions.
17 changes: 2 additions & 15 deletions src/pages/canvas/Dashboard/ActionBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,6 @@ const ActionBox = () => {
changeReferDialog,
changeBadgesDialogVisible,
upgradableBadges,
mintableBadges,
pickMintableBadgesLoading,
pickUpgradableBadgesLoading,
} = useCanvasStore()

Expand Down Expand Up @@ -211,8 +209,8 @@ const ActionBox = () => {
}
},
visible: !othersWalletAddress,
withBadge: !!mintableBadges.length || !!upgradableBadges.length,
loading: pickMintableBadgesLoading || pickUpgradableBadgesLoading,
withBadge: !!upgradableBadges.length,
loading: pickUpgradableBadgesLoading,
menu: {
anchorEl: badgesAnchorEl,
open: badgesOpen,
Expand All @@ -226,15 +224,6 @@ const ActionBox = () => {
changeCustomizeDisplayDialogVisible(true)
},
},
{
key: "mint",
label: "Mint eligible badges",
extra: mintableBadges.length ? <BadgeCount>{mintableBadges.length > 99 ? "99+" : mintableBadges.length}</BadgeCount> : null,
onClick: () => {
handleCloseMenu()
changeBadgesDialogVisible(BadgesDialogType.MINT)
},
},
...(upgradableBadges.length
? [
{
Expand Down Expand Up @@ -326,9 +315,7 @@ const ActionBox = () => {
shareOpen,
handleCopyLink,
copied,
mintableBadges.length,
upgradableBadges.length,
pickMintableBadgesLoading,
pickUpgradableBadgesLoading,
])

Expand Down
2 changes: 0 additions & 2 deletions src/pages/canvas/Dashboard/BadgeDetailDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ const BadgeDetailDialog = () => {
isBadgeUpgrading,
changeIsBadgeMinting,
changeIsBadgeUpgrading,
pickMintableBadges,
changeSelectedBadge,
upgradeBadgeAndRefreshUserBadges,
} = useCanvasStore()
Expand Down Expand Up @@ -113,7 +112,6 @@ const BadgeDetailDialog = () => {
// const result: any = await testAsyncFunc("0x11cfb299dda2ae8b1fccf9a055394de9a7f953e8b8f115295dc0f2325e8b2130")
if (result) {
await queryVisibleBadges(provider, walletCurrentAddress)
await pickMintableBadges(provider, walletCurrentAddress, false)
alertWarning(
<>
{selectedBadge.name} minted successfully!<br></br>
Expand Down
11 changes: 2 additions & 9 deletions src/pages/canvas/Dashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ const Dashboard = props => {
badgesDialogVisible,
mintableBadges,
upgradableBadges,
pickMintableBadges,
pickUpgradableBadges,
pickMintableBadgesLoading,
pickUpgradableBadgesLoading,
} = useCanvasStore()

Expand All @@ -59,10 +57,7 @@ const Dashboard = props => {
}

useEffect(() => {
// recheck badge eligibility when openning badges dialog
if (badgesDialogVisible === BadgesDialogType.MINT) {
pickMintableBadges(publicProvider, walletCurrentAddress, true)
} else if (badgesDialogVisible === BadgesDialogType.UPGRADE) {
if (badgesDialogVisible === BadgesDialogType.UPGRADE) {
pickUpgradableBadges(publicProvider)
}
}, [badgesDialogVisible])
Expand Down Expand Up @@ -112,8 +107,6 @@ const Dashboard = props => {
changeProfileDetailLoading(true)
const signer = await provider?.getSigner(0)
await fetchCurrentCanvasDetail(signer, walletAddress, profileAddress)
// initially check eligibility
pickMintableBadges(provider, walletAddress, true)
pickUpgradableBadges(provider)
} catch (e) {
alertWarning(e.message)
Expand Down Expand Up @@ -201,7 +194,7 @@ const Dashboard = props => {
<ReferDialog />
<BadgesDialog
badges={badgesDialogVisible === BadgesDialogType.MINT ? mintableBadges : upgradableBadges}
loading={pickMintableBadgesLoading || pickUpgradableBadgesLoading}
loading={pickUpgradableBadgesLoading}
/>
<BadgeDetailDialog />
</>
Expand Down
1 change: 1 addition & 0 deletions src/stores/canvasStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ const useCanvasStore = create<CanvasStore>()((set, get) => ({
})
},

// not in use
pickMintableBadges: async (provider, walletCurrentAddress, refresh) => {
set({
pickMintableBadgesLoading: true,
Expand Down

0 comments on commit 964e8f0

Please sign in to comment.