mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 12:29:06 +01:00
UX: Allow quick Add Account name based on default name (#20168)
* UX: Allow quick Add Account name * do not allow account names with just spaces --------- Co-authored-by: Howard Braham <howrad@gmail.com>
This commit is contained in:
parent
811d25c636
commit
f584f56d9c
@ -39,11 +39,12 @@ export const CreateAccount = ({ onActionComplete }) => {
|
|||||||
const defaultAccountName = t('newAccountNumberName', [newAccountNumber]);
|
const defaultAccountName = t('newAccountNumberName', [newAccountNumber]);
|
||||||
|
|
||||||
const [newAccountName, setNewAccountName] = useState('');
|
const [newAccountName, setNewAccountName] = useState('');
|
||||||
|
const trimmedAccountName = newAccountName.trim();
|
||||||
|
|
||||||
const { isValidAccountName, errorMessage } = getAccountNameErrorMessage(
|
const { isValidAccountName, errorMessage } = getAccountNameErrorMessage(
|
||||||
accounts,
|
accounts,
|
||||||
{ t },
|
{ t },
|
||||||
newAccountName,
|
trimmedAccountName ?? defaultAccountName,
|
||||||
defaultAccountName,
|
defaultAccountName,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -58,7 +59,7 @@ export const CreateAccount = ({ onActionComplete }) => {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await onCreateAccount(newAccountName || defaultAccountName);
|
await onCreateAccount(trimmedAccountName || defaultAccountName);
|
||||||
onActionComplete(true);
|
onActionComplete(true);
|
||||||
trackEvent({
|
trackEvent({
|
||||||
category: MetaMetricsEventCategory.Accounts,
|
category: MetaMetricsEventCategory.Accounts,
|
||||||
|
@ -38,7 +38,7 @@ export default class EditableLabel extends Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.props.onSubmit(this.state.value);
|
await this.props.onSubmit(this.state.value.trim());
|
||||||
this.setState({ isEditing: false });
|
this.setState({ isEditing: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user