From 24bad2100f4fc03411a79267e1fa843ec96d5af2 Mon Sep 17 00:00:00 2001 From: zhouhanseng Date: Tue, 28 Dec 2021 15:04:04 +0800 Subject: [PATCH 01/13] fix: text too long mask 467 --- .../src/plugins/ITO/SNSAdaptor/PoolInList.tsx | 7 ++++- .../ITO/SNSAdaptor/StyledLinearProgress.tsx | 12 ++------ .../RedPacket/SNSAdaptor/RedPacket/index.tsx | 2 +- .../SNSAdaptor/RedPacket/useStyles.ts | 3 ++ .../SNSAdaptor/RedPacketConfirmDialog.tsx | 6 +++- .../SNSAdaptor/RedPacketInHistoryList.tsx | 29 +++++++++++++------ 6 files changed, 38 insertions(+), 21 deletions(-) diff --git a/packages/mask/src/plugins/ITO/SNSAdaptor/PoolInList.tsx b/packages/mask/src/plugins/ITO/SNSAdaptor/PoolInList.tsx index 173a39d5ba0b..fc6bf2f68fa6 100644 --- a/packages/mask/src/plugins/ITO/SNSAdaptor/PoolInList.tsx +++ b/packages/mask/src/plugins/ITO/SNSAdaptor/PoolInList.tsx @@ -124,6 +124,11 @@ const useStyles = makeStyles()((theme) => { border: '1px solid rgba(224, 224, 224, 1)', color: theme.palette.text.secondary, }, + ellipsis: { + maxWidth: 350, + textOverflow: 'ellipsis', + overflow: 'hidden', + }, } }) @@ -244,7 +249,7 @@ export function PoolInList(props: PoolInListProps) { - + {title} diff --git a/packages/mask/src/plugins/ITO/SNSAdaptor/StyledLinearProgress.tsx b/packages/mask/src/plugins/ITO/SNSAdaptor/StyledLinearProgress.tsx index cdb59c724fbb..561d533b596a 100644 --- a/packages/mask/src/plugins/ITO/SNSAdaptor/StyledLinearProgress.tsx +++ b/packages/mask/src/plugins/ITO/SNSAdaptor/StyledLinearProgress.tsx @@ -1,23 +1,17 @@ import { LinearProgress, LinearProgressProps } from '@mui/material' import { makeStyles } from '@masknet/theme' -interface StyledLinearProgress extends LinearProgressProps { - barColor?: string - backgroundColor?: string -} -const useStyles = makeStyles()((_theme, props) => ({ +const useStyles = makeStyles()((_theme) => ({ root: { height: 8, borderRadius: 5, - backgroundColor: props.backgroundColor ?? 'rgba(255, 255, 255, 0.3)', }, bar: { borderRadius: 5, - backgroundColor: props.barColor ?? 'rgb(44, 164, 239)', }, })) -export function StyledLinearProgress(props: StyledLinearProgress) { - const { classes } = useStyles(props) +export function StyledLinearProgress(props: LinearProgressProps) { + const { classes } = useStyles() return } diff --git a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacket/index.tsx b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacket/index.tsx index eca7b922266e..c2e4cb32e76a 100644 --- a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacket/index.tsx +++ b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacket/index.tsx @@ -211,7 +211,7 @@ export function RedPacket(props: RedPacketProps) { ) : null}
-
+
{payload.sender.message} diff --git a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacket/useStyles.ts b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacket/useStyles.ts index 704407003403..3837dad3f35e 100644 --- a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacket/useStyles.ts +++ b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacket/useStyles.ts @@ -158,5 +158,8 @@ to { connectWallet: { marginTop: 16, }, + fullWidthBox: { + width: '100%', + }, } }) diff --git a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketConfirmDialog.tsx b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketConfirmDialog.tsx index e9c49799aa5d..0fe82651d204 100644 --- a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketConfirmDialog.tsx +++ b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketConfirmDialog.tsx @@ -58,6 +58,10 @@ const useStyles = makeStyles()((theme) => ({ color: theme.palette.mode === 'light' ? '#7B8192' : '#6F767C', }, }, + ellipsis: { + textOverflow: 'ellipsis', + overflow: 'hidden', + }, })) export interface ConfirmRedPacketFormProps { @@ -80,7 +84,7 @@ export function RedPacketConfirmDialog(props: ConfirmRedPacketFormProps) { return ( - + {settings?.message} diff --git a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketInHistoryList.tsx b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketInHistoryList.tsx index 654a37834c79..7acdb3a09324 100644 --- a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketInHistoryList.tsx +++ b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketInHistoryList.tsx @@ -93,13 +93,14 @@ const useStyles = makeStyles()((theme) => { flexWrap: 'wrap', }, }, - div: {}, + div: { + maxWidth: 350, + }, icon: { width: 27, height: 27, }, title: { - whiteSpace: 'break-spaces', fontWeight: 500, fontSize: 16, }, @@ -112,10 +113,17 @@ const useStyles = makeStyles()((theme) => { }, actionButton: { height: 26, + background: theme.palette.mode === 'light' ? '#000' : '#fff', + color: theme.palette.mode === 'light' ? '#fff' : '#000', minHeight: 'auto', [smallQuery]: { marginTop: theme.spacing(1), }, + '&:hover': { + background: theme.palette.mode === 'light' ? '#000' : '#fff', + color: theme.palette.mode === 'light' ? '#fff' : '#000', + opacity: 0.8, + }, }, footer: { width: '100%', @@ -165,6 +173,9 @@ const useStyles = makeStyles()((theme) => { color: theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.26)' : 'rgba(255, 255, 255, 0.3)', }, }, + fullWidthBox: { + width: '100%', + }, } }) @@ -257,11 +268,13 @@ export function RedPacketInHistoryList(props: RedPacketInHistoryListProps) {
- - {history.sender.message === '' - ? t('plugin_red_packet_best_wishes') - : history.sender.message} - +
+ + {history.sender.message === '' + ? t('plugin_red_packet_best_wishes') + : history.sender.message} + +
{t('plugin_red_packet_history_duration', { startTime: dateTimeFormat(new Date(history.creation_time)), @@ -330,8 +343,6 @@ export function RedPacketInHistoryList(props: RedPacketInHistoryListProps) { ) : null}
From 1f1d924b28dad2198c87f4dfbf58ad7294dc199c Mon Sep 17 00:00:00 2001 From: zhouhanseng Date: Tue, 28 Dec 2021 17:06:15 +0800 Subject: [PATCH 02/13] chore: button status MASK-519 --- .../mask/src/plugins/ITO/SNSAdaptor/ITO.tsx | 36 +++++++++++-------- .../RedPacket/SNSAdaptor/RedPacket/index.tsx | 21 +++++------ .../RedPacket/SNSAdaptor/RedPacketNft.tsx | 2 +- 3 files changed, 34 insertions(+), 25 deletions(-) diff --git a/packages/mask/src/plugins/ITO/SNSAdaptor/ITO.tsx b/packages/mask/src/plugins/ITO/SNSAdaptor/ITO.tsx index cbe658dd28ee..cbc2b734c2da 100644 --- a/packages/mask/src/plugins/ITO/SNSAdaptor/ITO.tsx +++ b/packages/mask/src/plugins/ITO/SNSAdaptor/ITO.tsx @@ -585,7 +585,6 @@ export function ITO(props: ITO_Props) { @@ -635,16 +634,8 @@ export function ITO(props: ITO_Props) { className={classes.actionButton}> {t('plugin_ito_region_ban')} - ) : total_remaining.isZero() && !isBuyer && !canWithdraw ? ( - undefined} - variant="contained" - size="large" - className={classes.actionButton}> - {t('plugin_ito_status_out_of_stock')} - - ) : loadingTradeInfo || loadingAvailability ? ( + ) : (noRemain || listOfStatus.includes(ITO_Status.expired)) && !canWithdraw ? null : loadingTradeInfo || + loadingAvailability ? ( undefined} @@ -765,9 +756,26 @@ export function ITO(props: ITO_Props) { ) : undefined}
) : listOfStatus.includes(ITO_Status.started) ? ( - - {t('plugin_ito_enter')} - + + + + {t('plugin_ito_share')} + + + + + {t('plugin_ito_enter')} + + + ) : null} diff --git a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacket/index.tsx b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacket/index.tsx index c2e4cb32e76a..7cf1464191ec 100644 --- a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacket/index.tsx +++ b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacket/index.tsx @@ -105,7 +105,7 @@ export function RedPacket(props: RedPacketProps) { const state = canClaim ? claimState : refundState if (state.type === TransactionStateType.UNKNOWN) return if (!availability || !token) return - if (state.type === TransactionStateType.HASH) { + if (state.type === TransactionStateType.CONFIRMED) { setTransactionDialog({ open: true, shareLink: shareLink!.toString(), @@ -119,7 +119,6 @@ export function RedPacket(props: RedPacketProps) { }) : '', }) - } else if (state.type === TransactionStateType.CONFIRMED) { resetClaimCallback() resetRefundCallback() revalidateAvailability() @@ -227,14 +226,16 @@ export function RedPacket(props: RedPacketProps) {
- + {listOfStatus.includes(RedPacketStatus.expired) || listOfStatus.includes(RedPacketStatus.empty) ? null : ( + + )} ) } diff --git a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketNft.tsx b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketNft.tsx index 97121ec708ae..d76a1dfa428d 100644 --- a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketNft.tsx +++ b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketNft.tsx @@ -418,7 +418,7 @@ export function RedPacketNft({ payload }: RedPacketNftProps) {
- ) : ( + ) : availability.isClaimedAll || availability.isCompleted ? null : (