Skip to content

Commit

Permalink
feat: nft redpacket confirm
Browse files Browse the repository at this point in the history
  • Loading branch information
swkatmask committed Jan 3, 2025
1 parent 904493d commit fdc6050
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 189 deletions.
2 changes: 2 additions & 0 deletions .ignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Ignores for rg or ag
patches/
packages/mask/dashboard/assets/images/SetupTutorial.svg

**/locale/*.{po,json}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { makeStyles } from '@masknet/theme'
import type { Web3Helper } from '@masknet/web3-helpers'
import { formatTokenId } from '@masknet/web3-shared-evm'
import { Typography } from '@mui/material'
import { memo } from 'react'
import { memo, type HTMLProps } from 'react'

const useStyles = makeStyles()((theme) => {
return {
Expand Down Expand Up @@ -52,16 +52,15 @@ const useStyles = makeStyles()((theme) => {
}
})

interface NFTCardProps {
interface NFTCardProps extends HTMLProps<HTMLDivElement> {
token: Web3Helper.NonFungibleAssetAll
onRemove: (token: Web3Helper.NonFungibleAssetAll) => void
onRemove?: (token: Web3Helper.NonFungibleAssetAll) => void
}

export const NFTCard = memo(function NFTCard(props: NFTCardProps) {
const { token, onRemove } = props
const { classes } = useStyles()
export const NFTCard = memo(function NFTCard({ token, onRemove, className, ...rest }: NFTCardProps) {
const { classes, cx } = useStyles()
return (
<div className={classes.card}>
<div className={cx(classes.card, className)} {...rest}>
<AssetPreviewer
url={token.metadata?.mediaURL || token.metadata?.imageURL}
classes={{
Expand All @@ -72,7 +71,9 @@ export const NFTCard = memo(function NFTCard(props: NFTCardProps) {
<Typography className={classes.cardName} color="textSecondary">
{formatTokenId(token.tokenId, 2)}
</Typography>
<Icons.Clear size={20} className={classes.removeButton} onClick={() => onRemove(token)} />
{onRemove ?
<Icons.Clear size={20} className={classes.removeButton} />
: null}
</div>
)
})
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export const RedPacketProvider = memo(function RedPacketProvider({ children }: P
const [selectedNfts, setSelectedNfts] = useState<Web3Helper.NonFungibleAssetAll[]>([])
const [myNfts, setMyNfts] = useState<OrderedERC721Token[]>([])
const [selectOption, setSelectOption] = useState<NFTSelectOption>(NFTSelectOption.Partial)
const [collection, setCollection] = useState<NonFungibleCollection<ChainId, SchemaType>>()
const [collection, setCollection] = useState<Web3Helper.NonFungibleCollectionAll>()

const contextValue = useMemo(() => {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ const useStyles = makeStyles()((theme) => {
},

assets: {
display: 'flex',
display: 'grid',
gridTemplateColumns: 'repeat(auto-fill, minmax(86px, 1fr))',
gap: 10,
},
card: {
width: 86,
position: 'relative',
borderRadius: 8,
overflow: 'hidden',
Expand Down
Loading

0 comments on commit fdc6050

Please sign in to comment.