mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 01:47:00 +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 [newAccountName, setNewAccountName] = useState('');
|
||||
const trimmedAccountName = newAccountName.trim();
|
||||
|
||||
const { isValidAccountName, errorMessage } = getAccountNameErrorMessage(
|
||||
accounts,
|
||||
{ t },
|
||||
newAccountName,
|
||||
trimmedAccountName ?? defaultAccountName,
|
||||
defaultAccountName,
|
||||
);
|
||||
|
||||
@ -58,7 +59,7 @@ export const CreateAccount = ({ onActionComplete }) => {
|
||||
event.preventDefault();
|
||||
|
||||
try {
|
||||
await onCreateAccount(newAccountName || defaultAccountName);
|
||||
await onCreateAccount(trimmedAccountName || defaultAccountName);
|
||||
onActionComplete(true);
|
||||
trackEvent({
|
||||
category: MetaMetricsEventCategory.Accounts,
|
||||
|
@ -38,7 +38,7 @@ export default class EditableLabel extends Component {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.props.onSubmit(this.state.value);
|
||||
await this.props.onSubmit(this.state.value.trim());
|
||||
this.setState({ isEditing: false });
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user