Skip to content

Commit 27d31a5

Browse files
authored
fix: adjust redpacket ui (#12001)
* fix: mf-6521 adjust texts in custom cover view * fix: mf-6522 limit select file types * fix: mf-6525 redpacket message wrap * fix: mf-6525 redpacket message wrap * fix: mf-6524 max button color * fixup! fix: mf-6521 adjust texts in custom cover view * fix: progress bar * fix: increase max file size to 1.5MB
1 parent 6af193a commit 27d31a5

File tree

29 files changed

+226
-49
lines changed

29 files changed

+226
-49
lines changed

packages/plugins/RedPacket/src/SiteAdaptor/components/RedPacketEnvelope.tsx

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ const useStyles = makeStyles()((theme) => ({
5050
color: theme.palette.maskColor.white,
5151
background: 'linear-gradient(180deg, rgba(0, 0, 0, 0.10) 0%, rgba(102, 102, 102, 0.10) 100%)',
5252
backdropFilter: 'blur(5px)',
53+
wordBreak: 'break-all',
54+
whiteSpace: 'normal',
5355
display: 'flex',
5456
alignItems: 'center',
5557
overflow: 'hidden',
@@ -98,21 +100,29 @@ const useStyles = makeStyles()((theme) => ({
98100
fontWeight: 700,
99101
},
100102
bar: {
101-
width: 78,
102-
height: 7,
103+
width: 80,
104+
height: 9,
103105
borderRadius: 999,
104-
border: '1px solid rgba(255, 255, 255, 0.28)',
105106
position: 'relative',
107+
overflow: 'hidden',
108+
},
109+
outline: {
110+
position: 'absolute',
111+
left: 0,
112+
right: 0,
113+
top: 0,
114+
bottom: 0,
115+
borderRadius: 999,
116+
border: '1px solid rgba(255, 255, 255, 0.28)',
106117
},
107118
progress: {
108119
position: 'absolute',
120+
left: 0,
121+
right: 0,
122+
top: 0,
123+
bottom: 0,
109124
backgroundColor: 'rgba(255, 255, 255, 0.78)',
110-
borderRadius: '999px 0 0 999px',
111-
left: -1,
112-
top: -1,
113-
bottom: -1,
114125
'&[data-fulfilled]': {
115-
right: -1,
116126
borderRadius: '999px',
117127
},
118128
},
@@ -221,6 +231,7 @@ export function RedPacketEnvelope({
221231
</Typography>
222232
: <>
223233
<div className={classes.bar}>
234+
<div className={classes.outline}></div>
224235
<div
225236
className={classes.progress}
226237
style={{ width: `${Math.min(1, claimed / shares) * 100}%` }}

packages/plugins/RedPacket/src/SiteAdaptor/components/RouterDialog.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export function RouterDialog(props: InjectedDialogProps) {
8787
[RoutePaths.History]: <Trans>History</Trans>,
8888
[RoutePaths.HistoryDetail]: <Trans>Claim Details</Trans>,
8989
[RoutePaths.NftHistory]: <Trans>History</Trans>,
90+
[RoutePaths.CustomCover]: <Trans>Add a Custom Cover</Trans>,
9091
}
9192
const titleTailMap: Record<string, ReactNode> = {
9293
[RoutePaths.CreateErc20RedPacket]: (

packages/plugins/RedPacket/src/SiteAdaptor/views/CustomCover.tsx

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { ImageEditorModal, UploadDropArea, useUnmountedRef } from '@masknet/shared'
1+
import { t, Trans } from '@lingui/macro'
2+
import { Icons } from '@masknet/icons'
3+
import { formatFileSize, ImageEditorModal, UploadDropArea, useUnmountedRef } from '@masknet/shared'
4+
import { makeStyles, useCustomSnackbar } from '@masknet/theme'
5+
import { FireflyConfig, FireflyRedPacket } from '@masknet/web3-providers'
26
import { Box, Button, DialogActions, Typography } from '@mui/material'
37
import { useEffect, useMemo, useState } from 'react'
4-
import { MAX_FILE_SIZE } from '../../constants.js'
5-
import { makeStyles, useCustomSnackbar } from '@masknet/theme'
6-
import { Icons } from '@masknet/icons'
7-
import { t, Trans } from '@lingui/macro'
88
import { useNavigate } from 'react-router-dom'
9-
import { FireflyConfig, FireflyRedPacket } from '@masknet/web3-providers'
10-
import { useRedPacket } from '../contexts/RedPacketContext.js'
119
import { useAsyncFn } from 'react-use'
10+
import { MAX_FILE_SIZE } from '../../constants.js'
11+
import { useRedPacket } from '../contexts/RedPacketContext.js'
1212

1313
const useStyles = makeStyles()((theme) => ({
1414
container: {
@@ -136,12 +136,18 @@ export function CustomCover() {
136136
: <UploadDropArea
137137
maxFileSize={MAX_FILE_SIZE}
138138
onSelectFile={setBlob}
139+
accept="image/png, image/jpeg, image/gif, image/bmp, image/webp"
139140
subtitle={
140141
<>
141142
<Typography className={classes.tips}>
142-
Supported formats: JPEG, PNG, GIF Size limit: 1MB
143+
<Trans>
144+
Supported formats: JPEG, PNG, GIF
145+
<br /> Size limit: {formatFileSize(MAX_FILE_SIZE)}
146+
</Trans>
147+
</Typography>
148+
<Typography className={classes.tips}>
149+
<Trans>Recommended dimensions: 1016 × 672 px</Trans>
143150
</Typography>
144-
<Typography className={classes.tips}>Recommended dimensions: 1016 × 672 px</Typography>
145151
</>
146152
}
147153
/>
@@ -154,7 +160,7 @@ export function CustomCover() {
154160
<Button variant="contained" disabled={!blob || saving} fullWidth onClick={save}>
155161
{saving ?
156162
<Trans>Saving</Trans>
157-
: <Trans>Save</Trans>}
163+
: <Trans>Confirm</Trans>}
158164
</Button>
159165
</DialogActions>
160166
</>

packages/plugins/RedPacket/src/SiteAdaptor/views/Erc20RedPacketConfirm.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ import { useCreateFTRedpacketCallback } from '../hooks/useCreateFTRedpacketCallb
2525
import { useHandleCreateOrSelect } from '../hooks/useHandleCreateOrSelect.js'
2626

2727
const useStyles = makeStyles()((theme) => ({
28+
message: {
29+
fontSize: 24,
30+
fontWeight: 700,
31+
overflow: 'hidden',
32+
display: '-webkit-box',
33+
WebkitBoxOrient: 'vertical',
34+
WebkitLineClamp: 2,
35+
},
2836
link: {
2937
display: 'inline-flex',
3038
marginLeft: theme.spacing(0.5),
@@ -67,13 +75,6 @@ const useStyles = makeStyles()((theme) => ({
6775
color: theme.palette.text.primary,
6876
padding: 12,
6977
},
70-
ellipsis: {
71-
fontSize: 24,
72-
fontWeight: 700,
73-
textOverflow: 'ellipsis',
74-
overflow: 'hidden',
75-
whiteSpace: 'nowrap',
76-
},
7778
controller: {
7879
position: 'sticky',
7980
bottom: 0,
@@ -137,7 +138,7 @@ export function Erc20RedPacketConfirm() {
137138
return (
138139
<>
139140
<div className={classes.settings}>
140-
<Typography variant="h4" color="textPrimary" align="center" className={classes.ellipsis}>
141+
<Typography variant="h4" color="textPrimary" align="center" className={classes.message}>
141142
{settings?.message}
142143
</Typography>
143144
<div className={classes.field}>

packages/plugins/RedPacket/src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const enum RoutePaths {
3838
Terms = '/terms',
3939
}
4040

41-
export const MAX_FILE_SIZE = 1 * 1024 * 1024
41+
export const MAX_FILE_SIZE = 1.5 * 1024 * 1024
4242
export const DURATION = 60 * 60 * 24
4343

4444
export const nftDefaultChains = [ChainId.Mainnet, ChainId.BSC, ChainId.Polygon]

packages/plugins/RedPacket/src/locale/en-US.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/plugins/RedPacket/src/locale/en-US.po

Lines changed: 23 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/plugins/RedPacket/src/locale/ja-JP.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/plugins/RedPacket/src/locale/ja-JP.po

Lines changed: 23 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/plugins/RedPacket/src/locale/ko-KR.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)