1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 01:39:44 +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:
David Walsh 2023-07-26 20:03:30 -05:00 committed by GitHub
parent 811d25c636
commit f584f56d9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -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,

View File

@ -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 });
}