Skip to content

Commit

Permalink
fix: detail
Browse files Browse the repository at this point in the history
  • Loading branch information
Holybasil committed Nov 28, 2024
1 parent a710b4c commit 2df19e8
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 36 deletions.
4 changes: 2 additions & 2 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ REACT_APP_ETHEREUM_YEAR_BADGE_API_URI = "https://genesis-nft-backend-git-sepolia
REACT_APP_BADGE_REGISTRY_URL="https://badge-registry.canvas.scroll.cat/badge-registry"
REACT_APP_BADGE_INDEXER_URL="https://canvas-indexer.scroll.cat"
REACT_APP_ETHEREUM_YEAR_BADGE_ADDRESS = "0xB59B6466B21a089c93B14030AF88b164905a58fd"
REACT_APP_SCR_HOLDING_BADGE_ADDRESS="0xef071708e09becfeac1e3d8afa1602bb6eb57922"
REACT_APP_SCR_HOLDING_BADGE_ADDRESS="0xeF071708e09BECFEac1e3d8AfA1602BB6eB57922"


[context.sepolia.environment]
Expand Down Expand Up @@ -237,7 +237,7 @@ REACT_APP_ETHEREUM_YEAR_BADGE_API_URI = "https://genesis-nft-backend-git-sepolia
REACT_APP_BADGE_REGISTRY_URL="https://badge-registry.canvas.scroll.cat/badge-registry"
REACT_APP_BADGE_INDEXER_URL="https://canvas-indexer.scroll.cat"
REACT_APP_ETHEREUM_YEAR_BADGE_ADDRESS = "0xB59B6466B21a089c93B14030AF88b164905a58fd"
REACT_APP_SCR_HOLDING_BADGE_ADDRESS="0xef071708e09becfeac1e3d8afa1602bb6eb57922"
REACT_APP_SCR_HOLDING_BADGE_ADDRESS="0xeF071708e09BECFEac1e3d8AfA1602BB6eB57922"


[context.mainnet.environment]
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useValidateENSSubdomain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const useValidateENSSubdomain = value => {
const controller = useRef<any>()

useEffect(() => {
if (preValue) {
if (preValue !== undefined) {
handleValidateName(value)
}
}, [value])
Expand Down
5 changes: 3 additions & 2 deletions src/pages/canvas/Dashboard/ENSSubdomainDialog/ClaimENS.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useMemo } from "react"
import Img from "react-cool-img"

import { Box, Stack, SvgIcon, Typography } from "@mui/material"

Expand All @@ -11,6 +10,7 @@ import useCanvasProfileStore, { ENSSubdomainDialogTypeEnum } from "@/stores/canv
import usePerkStore from "@/stores/perksStore"
import { truncateAddress } from "@/utils"

import BadgeImage from "../../components/BadgeImage"
import PerksButton from "../../components/PerksButton"

const ClaimENS = () => {
Expand Down Expand Up @@ -114,7 +114,8 @@ const ClaimENS = () => {
</Typography>
<Stack direction="row" gap={["1.6rem", "2.4rem"]} justifyContent="center">
{perk.imageURL.map((imageURL, index) => (
<Img
<BadgeImage
key={imageURL}
src={imageURL}
alt=""
style={{ width: isMobile ? "5.6rem" : "10rem", height: isMobile ? "5.6rem" : "10rem" }}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/canvas/Dashboard/PerksDialog/PerkItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ const PerkItem = props => {
<Stack direction="row" gap="1.6rem" justifyContent="center">
{imageURL.map((url, index) => (
<BadgeImage
key={url}
src={url}
alt={`required-badge-${index}`}
placeholder={BadgePlaceholderSvg}
width={isMobile ? "48px" : "64px"}
height={isMobile ? "48px" : "64px"}
style={{ width: isMobile ? "4.8rem" : "6.4rem", height: isMobile ? "4.8rem" : "6.4rem" }}
/>
))}
</Stack>
Expand Down
56 changes: 28 additions & 28 deletions src/pages/canvas/mint-scr/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const MintScr = () => {
const alertWarning = useSnackbar()
const [scrAmount, setSCRAmount] = useState("")
const [mintLoading, setMintLoading] = useState(false)
const [burnLoading, setBurnLoading] = useState(false)
// const [burnLoading, setBurnLoading] = useState(false)

const handleChangeSCRAmount = e => {
setSCRAmount(sanitizeNumericalString(e.target.value))
Expand Down Expand Up @@ -49,30 +49,30 @@ const MintScr = () => {
}
}

const handleBurnToken = async () => {
if (chainId !== CHAIN_ID.L2) {
alertWarning("please switch to L2")
return
}
try {
setBurnLoading(true)
const signer = await provider?.getSigner(0)
const tokenInterface = new ethers.Contract(SCR_TOKEN_ADDRESS, ERC20ABI, signer)
const amount = amountToBN(scrAmount)
const tx = await tokenInterface.burn(walletCurrentAddress, amount)
const txReceipt = await tx.wait()
if (txReceipt?.status === 1) {
alertWarning(`Burned ${scrAmount} SCR successfully`, "success")
setSCRAmount("")
}
} catch (e) {
if (!isUserRejected(e)) {
alertWarning(e.message)
}
} finally {
setBurnLoading(false)
}
}
// const handleBurnToken = async () => {
// if (chainId !== CHAIN_ID.L2) {
// alertWarning("please switch to L2")
// return
// }
// try {
// setBurnLoading(true)
// const signer = await provider?.getSigner(0)
// const tokenInterface = new ethers.Contract(SCR_TOKEN_ADDRESS, ERC20ABI, signer)
// const amount = amountToBN(scrAmount)
// const tx = await tokenInterface.burn(walletCurrentAddress, amount)
// const txReceipt = await tx.wait()
// if (txReceipt?.status === 1) {
// alertWarning(`Burned ${scrAmount} SCR successfully`, "success")
// setSCRAmount("")
// }
// } catch (e) {
// if (!isUserRejected(e)) {
// alertWarning(e.message)
// }
// } finally {
// setBurnLoading(false)
// }
// }
return (
<Stack direction="column" justifyContent="center" alignItems="center" sx={{ width: "100%", height: `calc(100vh - ${NORMAL_HEADER_HEIGHT})` }}>
<TextField
Expand All @@ -85,12 +85,12 @@ const MintScr = () => {
onChange={handleChangeSCRAmount}
/>
<Stack sx={{ width: "25rem", mt: "2rem" }} gap="2rem">
<PerksButton loading={mintLoading} onClick={handleMintToken}>
<PerksButton loading={mintLoading} disabled={!scrAmount} onClick={handleMintToken}>
Mint
</PerksButton>
<PerksButton loading={burnLoading} onClick={handleBurnToken}>
{/* <PerksButton loading={burnLoading} onClick={handleBurnToken}>
Burn
</PerksButton>
</PerksButton> */}
</Stack>
</Stack>
)
Expand Down
1 change: 0 additions & 1 deletion src/stores/perksStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const usePerkStore = create<EnsSubdomainStore>()(set => ({
generatePerks: async props => {
const { walletCurrentAddress, userBadges, ensClaimed } = props

// console.log(userBadges, "userBadges")
const perkList = [
{
id: "claim-ens-subdomain",
Expand Down

0 comments on commit 2df19e8

Please sign in to comment.