Skip to content

Commit

Permalink
fix: bugfix for wallet backup (#10841)
Browse files Browse the repository at this point in the history
  • Loading branch information
nuanyang233 committed Sep 24, 2023
1 parent 7431529 commit da59783
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 21 deletions.
4 changes: 3 additions & 1 deletion packages/mask/shared-ui/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@
"popups_wallet_settings_show_private_key": "Show Private Key",
"popups_wallet_settings_backup_wallet": "Backup Wallet",
"popups_wallet_settings_enter_payment_password": "Enter Payment Password",
"popups_wallet_settings_export_private_key_title": "Select the wallet to export the private key",
"popups_wallet_settings_export_private_key_title": "Click on the down-arrow icon to see the private key.",
"popups_wallet_settings_rename_tips": "Wallet name must between 3 to 18 characters.",
"popups_wallet_settings_name_exists": "The wallet name already exists.",
"popups_wallet_settings_remove_wallet": "Remove Wallet",
Expand Down Expand Up @@ -800,6 +800,7 @@
"popups_wallet_name_mnemonic": "Mnemonic",
"popups_wallet_name_json_file": "Json File",
"popups_wallet_name_private_key": "Private Key",
"popups_wallet_name_keystore": "Keystore",
"popups_wallet_name_mnemonic_placeholder": "Enter 12 or 24 mnemonic words.",
"popups_wallet_name_origin_password": "Original Password",
"popups_wallet_tab_assets": "Tokens",
Expand Down Expand Up @@ -959,6 +960,7 @@
"popups_backup_password_set_successfully": "Backup password set successfully",
"popups_export_private_key_tips": "This export is only for exporting private key. We do not export any other data. If you need more data, please go to Settings: <a> Global Backup </a>",
"popups_export_json_file_tips": "This file has been encrypted and stored with your current password. Your current password is needed to decrypt this file when using it to import wallet.",
"popups_export_keystore_tips": "This JSON file is encrypted with your current payment password. The same password is required for decryption when importing this wallet.",
"popups_log_out_tips": "After logging out, your associated social accounts will no longer decrypt past encrypted messages. If you need to reuse your account, you can recover your account with your identity, private key, local or cloud backup.",
"popups_log_out_with_smart_pay_tips_one": "Please note: This Persona {{persona}} is the management account of above listed SmartPay wallet. You cannot use SmartPay wallet to interact with blockchain after logging out persona.",
"popups_log_out_with_smart_pay_tips_other": "Please note: This Persona {{persona}} is the management account of above listed SmartPay wallets. You cannot use SmartPay wallet to interact with blockchain after logging out persona.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useNavigate } from 'react-router-dom'
import { useEverSeen } from '@masknet/shared-base-ui'
import { useMutation, useQueryClient, type InfiniteData } from '@tanstack/react-query'
import { Icons } from '@masknet/icons'
import { makeStyles, usePopupCustomSnackbar } from '@masknet/theme'
import { ActionButton, makeStyles, usePopupCustomSnackbar } from '@masknet/theme'
import { Box, Typography, Link, useTheme, ButtonBase as Button, Avatar } from '@mui/material'
import {
formatPersonaFingerprint,
Expand Down Expand Up @@ -54,18 +54,6 @@ const useStyles = makeStyles()((theme) => ({
fontSize: 12,
color: theme.palette.maskColor.second,
},
addButton: {
display: 'flex',
padding: '8px 12px',
justifyContent: 'center',
alignItems: 'center',
borderRadius: '99px',
background: theme.palette.maskColor.main,
color: theme.palette.maskColor.white,
fontSize: '12px',
lineHeight: '16px',
fontWeight: 700,
},
}))

interface ContactCardProps {
Expand Down Expand Up @@ -223,9 +211,13 @@ export const ContactCard = memo<ContactCardProps>(function ContactCard({
<Icons.ArrowRight />
</Button>
) : (
<Button className={classes.addButton} onClick={() => onAdd(friendInfo)} disabled={isLoading}>
<ActionButton
variant="roundedContained"
onClick={() => onAdd(friendInfo)}
loading={isLoading}
disabled={isLoading}>
{t('popups_encrypted_friends_add_friends')}
</Button>
</ActionButton>
)}
</Box>
<ConnectedAccounts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ const ExportPrivateKey = memo(function ExportPrivateKey() {
<MaskTabList onChange={onChange} aria-label="persona-tabs" classes={{ root: classes.tabs }}>
<Tab label={t('popups_wallet_name_mnemonic')} value={TabType.Mnemonic} />
<Tab label={t('popups_wallet_name_private_key')} value={TabType.PrivateKey} />
<Tab label={t('popups_wallet_name_json_file')} value={TabType.JsonFile} />
<Tab label={t('popups_wallet_name_keystore')} value={TabType.JsonFile} />
</MaskTabList>
) : (
<MaskTabList onChange={onChange} aria-label="persona-tabs" classes={{ root: classes.tabs }}>
<Tab label={t('popups_wallet_name_private_key')} value={TabType.PrivateKey} />
<Tab label={t('popups_wallet_name_json_file')} value={TabType.JsonFile} />
<Tab label={t('popups_wallet_name_keystore')} value={TabType.JsonFile} />
</MaskTabList>
)
}
Expand Down Expand Up @@ -145,7 +145,9 @@ const ExportPrivateKey = memo(function ExportPrivateKey() {
maxHeight="450px"
overflow="auto"
data-hide-scrollbar>
{wallet?.mnemonicId ? (
{wallet?.mnemonicId &&
walletGroup?.groups[wallet.mnemonicId] &&
walletGroup?.groups[wallet.mnemonicId].length > 1 ? (
walletGroup?.groups[wallet.mnemonicId].map((x, index) => (
<PrivateKeyDisplay wallet={x} key={index} />
))
Expand All @@ -158,7 +160,7 @@ const ExportPrivateKey = memo(function ExportPrivateKey() {
<Box className={classes.iconWrapper}>
<Icons.EncryptedFiles size={36} />
</Box>
<Typography color={theme.palette.maskColor.danger}>{t('popups_export_json_file_tips')}</Typography>
<Typography color={theme.palette.maskColor.danger}>{t('popups_export_keystore_tips')}</Typography>
</TabPanel>
</Box>

Expand Down
4 changes: 3 additions & 1 deletion packages/theme/src/Theme/component-changes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,12 @@ export const Button = (mode: PaletteMode, colors: MaskColor) => ({
['&:hover']: {
background: colors.maskColor.danger,
boxShadow: `0 8px 25px ${alpha(colors.maskColor.danger, 0.3)}`,
color: colors.maskColor.white,
},
[`&.${buttonClasses.disabled}`]: {
background: alpha(colors.maskColor.danger, 0.5),
opacity: 0.6,
opacity: 0.5,
color: colors.maskColor.white,
},
},
},
Expand Down

0 comments on commit da59783

Please sign in to comment.