Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const useStyles = makeStyles<StyledLinearProgress>()((_theme, props) => ({
},
bar: {
borderRadius: 5,
backgroundColor: props.barColor ?? '#fff',
backgroundColor: props.barColor ?? 'rgb(44, 164, 239)',
},
}))

Expand Down
126 changes: 75 additions & 51 deletions packages/maskbook/src/plugins/RedPacket/SNSAdaptor/NftList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,79 @@ import { List, ListItem, ListProps, Skeleton, Typography } from '@mui/material'
import classnames from 'classnames'
import type { FC, HTMLProps } from 'react'

const useStyles = makeStyles()({
list: {
display: 'grid',
gridTemplateColumns: '1fr 1fr 1fr',
gridGap: 8,
},
nft: {
position: 'relative',
display: 'flex',
width: 120,
height: 185,
flexDirection: 'column',
margin: '0 auto',
borderRadius: 8,
overflow: 'hidden',
boxShadow: '0px 8px 20px rgba(0, 0, 0, 0.04)',
},
loading: {
boxShadow: 'none',
},
claimedBadge: {
position: 'absolute',
left: 0,
right: 0,
top: 36,
margin: 'auto',
height: 70,
width: 70,
borderRadius: '100%',
backgroundColor: 'rgba(255, 95, 95, 0.4)',
color: '#fff',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
fontSize: 12,
pointerEvents: 'none',
},
media: {
height: 160,
width: 120,
},
name: {
fontSize: 12,
textOverflow: 'ellipsis',
overflow: 'hidden',
whiteSpace: 'nowrap',
padding: '2px 2px 6px',
color: MaskColorVar.textSecondary,
},
const useStyles = makeStyles()((theme) => {
const smallQuery = `@media (max-width: ${theme.breakpoints.values.sm}px)`
return {
list: {
display: 'grid',
gridTemplateColumns: '1fr 1fr 1fr',
gridGap: theme.spacing(1),
[smallQuery]: {
gridTemplateColumns: '1fr 1fr',
gridGap: 0,
padding: 0,
},
},
listItem: {
padding: theme.spacing(1),
},
nft: {
position: 'relative',
display: 'flex',
width: 120,
height: 185,
flexDirection: 'column',
margin: '0 auto',
borderRadius: 8,
overflow: 'hidden',
boxShadow: '0px 8px 20px rgba(0, 0, 0, 0.04)',
[smallQuery]: {
width: 90,
height: 140,
},
},
loading: {
boxShadow: 'none',
},
claimedBadge: {
position: 'absolute',
left: 0,
right: 0,
top: 36,
margin: 'auto',
height: 70,
width: 70,
borderRadius: '100%',
backgroundColor: 'rgba(255, 95, 95, 0.4)',
color: '#fff',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
fontSize: 12,
pointerEvents: 'none',
[smallQuery]: {
height: 60,
width: 60,
},
},
media: {
width: 120,
height: 160,
objectFit: 'cover',
[smallQuery]: {
width: 90,
height: 120,
},
},
name: {
fontSize: 12,
textOverflow: 'ellipsis',
overflow: 'hidden',
whiteSpace: 'nowrap',
padding: '2px 2px 6px',
color: MaskColorVar.textSecondary,
},
}
})

interface NftItemProps extends HTMLProps<HTMLDivElement> {
Expand All @@ -74,7 +98,7 @@ export const NftItem: FC<NftItemProps> = ({ contract, tokenId, className, claime
const info = result.value.info
return (
<div className={classnames(className, classes.nft)} {...rest}>
<img className={classes.media} src={info.image} width="120" height="160" alt={info.name} />
<img className={classes.media} src={info.image} alt={info.name} />
<Typography className={classes.name}>{info.name}</Typography>
{claimed && <Typography className={classes.claimedBadge}>Claimed</Typography>}
</div>
Expand All @@ -92,7 +116,7 @@ export const NftList: FC<NftListProps> = ({ contract, statusList, tokenIds, clas
return (
<List className={classnames(className, classes.list)} {...rest}>
{tokenIds.map((tokenId, index) => (
<ListItem key={tokenId}>
<ListItem className={classes.listItem} key={tokenId}>
<NftItem contract={contract} claimed={statusList[index]} tokenId={tokenId} />
</ListItem>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,103 +14,124 @@ import { useAvailabilityNftRedPacket } from './hooks/useAvailabilityNftRedPacket
import { useNftAvailabilityComputed } from './hooks/useNftAvailabilityComputed'
import { NftList } from './NftList'

const useStyles = makeStyles()((theme) => ({
root: {
borderRadius: 10,
border: `solid 1px ${theme.palette.divider}`,
marginBottom: theme.spacing(1.5),
position: 'static !important' as any,
height: 'auto !important',
padding: theme.spacing(2),
backgroundColor: MaskColorVar.lightBackground,
},
primary: {
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
},
secondary: {
fontSize: 12,
},
message: {
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
},
strong: {
overflow: 'hidden',
textOverflow: 'ellipsis',
},
span: {
maxWidth: 350,
display: 'inline-flex',
},
time: {
fontSize: 12,
color: theme.palette.text.secondary,
},
box: {
display: 'flex',
width: '100%',
},
content: {
transform: 'translateY(-4px)',
width: '100%',
padding: theme.spacing(0, '1rem'),
},
section: {
display: 'flex',
width: '100%',
justifyContent: 'space-between',
alignItems: 'center',
marginBottom: theme.spacing(2),
},
icon: {
width: 27,
height: 27,
},
title: {
whiteSpace: 'break-spaces',
fontWeight: 500,
fontSize: 16,
},
info: {
fontSize: 14,
color: theme.palette.mode === 'light' ? '#5B7083' : '#c3cbd2',
},
nftList: {
width: 390,
},
actionButton: {
height: 26,
minHeight: 'auto',
position: 'relative',
},
footer: {
width: '100%',
display: 'flex',
flexWrap: 'wrap',
justifyContent: 'space-between',
marginTop: theme.spacing(2),
},
footerInfo: {
fontSize: 15,
color: theme.palette.mode === 'light' ? '#5B7083' : '#c3cbd2',
'& strong': {
color: theme.palette.text.primary,
const useStyles = makeStyles()((theme) => {
const smallQuery = `@media (max-width: ${theme.breakpoints.values.sm}px)`
return {
root: {
borderRadius: 10,
border: `solid 1px ${theme.palette.divider}`,
marginBottom: theme.spacing(1.5),
position: 'static !important' as any,
height: 'auto !important',
padding: theme.spacing(2),
backgroundColor: MaskColorVar.lightBackground,
[smallQuery]: {
padding: theme.spacing(2, 1.5),
},
},
},
disabledButton: {
color: theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.26)' : 'rgba(255, 255, 255, 0.3)',
boxShadow: 'none',
backgroundColor: theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.12)' : 'rgba(255, 255, 255, 0.12)',
cursor: 'default',
'&:hover': {
backgroundColor: theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.12)' : 'rgba(255, 255, 255, 0.12)',
primary: {
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
},
secondary: {
fontSize: 12,
},
message: {
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
[smallQuery]: {
whiteSpace: 'normal',
},
},
strong: {
overflow: 'hidden',
textOverflow: 'ellipsis',
},
span: {
maxWidth: 350,
display: 'inline-flex',
},
time: {
fontSize: 12,
color: theme.palette.text.secondary,
},
box: {
display: 'flex',
width: '100%',
},
content: {
transform: 'translateY(-4px)',
width: '100%',
paddingLeft: theme.spacing(1),
},
section: {
display: 'flex',
width: '100%',
justifyContent: 'space-between',
alignItems: 'center',
marginBottom: theme.spacing(2),
[smallQuery]: {
marginBottom: 0,
},
},
icon: {
width: 27,
height: 27,
},
title: {
whiteSpace: 'break-spaces',
fontWeight: 500,
fontSize: 16,
},
info: {
fontSize: 14,
color: theme.palette.mode === 'light' ? '#5B7083' : '#c3cbd2',
[smallQuery]: {
fontSize: 13,
},
},
nftList: {
width: 390,
[smallQuery]: {
width: '100%',
},
},
actionButton: {
height: 26,
minHeight: 'auto',
position: 'relative',
},
footer: {
width: '100%',
display: 'flex',
flexWrap: 'wrap',
justifyContent: 'space-between',
marginTop: theme.spacing(2),
[smallQuery]: {
marginTop: theme.spacing(1),
},
},
footerInfo: {
fontSize: 15,
color: theme.palette.mode === 'light' ? '#5B7083' : '#c3cbd2',
'& strong': {
color: theme.palette.text.primary,
},
},
disabledButton: {
color: theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.26)' : 'rgba(255, 255, 255, 0.3)',
boxShadow: 'none',
backgroundColor: theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.12)' : 'rgba(255, 255, 255, 0.12)',
cursor: 'default',
'&:hover': {
backgroundColor: theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.12)' : 'rgba(255, 255, 255, 0.12)',
color: theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.26)' : 'rgba(255, 255, 255, 0.3)',
},
},
},
}))
}
})

export interface NftRedPacketHistoryItemProps {
history: NftRedPacketHistory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useNftRedPacketHistory } from './hooks/useNftRedPacketHistory'
import { NftRedPacketHistoryItem } from './NftRedPacketHistoryItem'

const useStyles = makeStyles()((theme, _, createRef) => {
const smallQuery = `@media (max-width: ${theme.breakpoints.values.sm}px)`
const atBottom = {
ref: createRef(),
} as const
Expand All @@ -22,6 +23,10 @@ const useStyles = makeStyles()((theme, _, createRef) => {
flexDirection: 'column',
margin: '0 auto',
overflow: 'auto',
[smallQuery]: {
width: '100%',
padding: 0,
},
},
placeholder: {
textAlign: 'center',
Expand Down
Loading