Skip to content

Commit

Permalink
fix: recovery issues (#10451)
Browse files Browse the repository at this point in the history
  • Loading branch information
UncleBill committed Aug 17, 2023
1 parent b16618e commit 66fb216
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 29 deletions.
6 changes: 4 additions & 2 deletions packages/backup-format/src/utils/backupPreview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ export function getBackupSummary(json: NormalizedBackup.Data): BackupSummary {
.sort((p) => (p.nickname.unwrapOr(false) ? -1 : 0))
.map((p) => p.nickname.unwrapOr(p.identifier.rawPublicKey).trim()),
)
const contacts = [...json.profiles.values()].filter((profile) => {
return !ownerProfiles.includes(profile.identifier.toText()) && profile.linkedPersona.some
})
return {
// Names or publicKeys */
personas,
accounts: sumBy(ownerPersonas, (persona) => persona.linkedProfiles.size),
posts: json.posts.size,
contacts: [...json.profiles.values()].filter((profile) => !ownerProfiles.includes(profile.identifier.toText()))
.length,
contacts: contacts.length,
relations: json.relations.length,
files,
wallets: json.wallets.map((wallet) => wallet.address),
Expand Down
2 changes: 1 addition & 1 deletion packages/dashboard/src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@
"identity_words": "Identity Words",
"private_key": "Private Key",
"local_backup": "Local Backup",
"incorrect_verification_code": "Incorrect verification code.",
"incorrect_verification_code": "Invalid verification code.",
"wallet_set_payment_password_successfully": "Set payment password successfully.",
"wallet_open_mask_wallet": "Open Mask Wallet"
}
2 changes: 1 addition & 1 deletion packages/mask/shared-ui/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@
"popups_wallet_settings_auto_unlock_time_title": "Auto-lock",
"popups_wallet_settings_change_payment_password": "Change Payment Password",
"popups_wallet_settings_show_private_key": "Show Private Key",
"popups_wallet_settings_rename_tips": "Wallet name must between 3 to 20 characters.",
"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",
"popups_wallet_settings_are_you_sure_remove_wallet": "Are you sure to Romove this wallet?",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function WalletRenameDrawer({ wallet, ...rest }: WalletRenameDrawerProps) {
const [{ loading }, handleClick] = useAsyncFn(async () => {
if (!name || !wallet) return
const _name = name.trim()
if (_name.length > 20 || _name.length < 3) {
if (_name.length > 18 || _name.length < 3) {
setError(t('popups_wallet_settings_rename_tips'))
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ const CreateWallet = memo(function CreateWallet() {
placeholder={t('popups_wallet_enter_your_wallet_name')}
error={!!errorMessage || !!errors.name?.message}
helperText={errorMessage || errors.name?.message}
inputProps={{
maxLength: 18,
}}
/>
)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export function useSetWalletNameForm(defaultName?: string) {
return zod.object({
name: zod
.string()
.min(1)
.max(12)
.min(3, t('popups_wallet_settings_rename_tips'))
.max(18, t('popups_wallet_settings_rename_tips'))
.refine((name) => {
return name.trim().length !== 0
}, t('wallet_name_length_error'))
Expand Down
47 changes: 25 additions & 22 deletions packages/theme/src/Components/PhoneNumberField/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const useStyles = makeStyles()((theme) => ({
borderRadius: 8,
boxSizing: 'border-box',
marginBottom: theme.spacing(1.5),
backgroundColor: theme.palette.maskColor.bottom,
},
itemText: {
fontSize: 14,
Expand All @@ -52,19 +53,22 @@ const useStyles = makeStyles()((theme) => ({
padding: theme.spacing(2),
borderRadius: 24,
backgroundColor: theme.palette.maskColor.bottom,
backgroundImage: 'none',
boxShadow:
theme.palette.mode === 'light'
? '0px 4px 30px 0px rgba(0, 0, 0, 0.10)'
: '0px 4px 30px 0px rgba(255, 255, 255, 0.15)',
},
autocompletePaper: {
boxShadow: 'none',
backgroundColor: theme.palette.maskColor.bottom,
},
listbox: {
border: 'none',
boxShadow: 'none',
maxHeight: 320,
marginTop: theme.spacing(1),
backgroundColor: theme.palette.maskColor.bottom,
'&::-webkit-scrollbar': {
display: 'none',
},
Expand Down Expand Up @@ -188,29 +192,28 @@ export function PhoneNumberField({ value, error, placeholder, onBlur, onChange }
<Autocomplete<DialingRecord>
open
options={countries}
classes={{ listbox: classes.listbox, paper: classes.autocompletePaper }}
renderInput={(params) => {
return (
<MaskTextField
placeholder="Search Area"
value={keyword}
autoFocus
fullWidth
InputProps={{
ref: params.InputProps.ref,
style: { height: 40, borderRadius: 8, padding: 8 },
inputProps: { ...params.inputProps, style: { paddingLeft: 4 } },
startAdornment: <Icons.Search size={18} />,
endAdornment: keyword ? (
<Icons.Close size={18} onClick={() => setKeyword('')} />
) : null,
}}
onChange={(event) => {
setKeyword(event.currentTarget.value)
}}
/>
)
classes={{
listbox: classes.listbox,
paper: classes.autocompletePaper,
}}
renderInput={(params) => (
<MaskTextField
placeholder="Search Area"
value={keyword}
autoFocus
fullWidth
InputProps={{
ref: params.InputProps.ref,
style: { height: 40, borderRadius: 8, padding: 8 },
inputProps: { ...params.inputProps, style: { paddingLeft: 4 } },
startAdornment: <Icons.Search size={18} />,
endAdornment: keyword ? (
<Icons.Close size={18} onClick={() => setKeyword('')} />
) : null,
}}
onChange={(event) => setKeyword(event.currentTarget.value)}
/>
)}
renderTags={() => null}
getOptionLabel={(option) => option.country_region}
PopperComponent={PopperComponent as unknown as typeof Popper}
Expand Down

0 comments on commit 66fb216

Please sign in to comment.