Skip to content

Commit

Permalink
UX: Allow quick Add Account name based on default name (#20168)
Browse files Browse the repository at this point in the history
* UX: Allow quick Add Account name

* do not allow account names with just spaces

---------

Co-authored-by: Howard Braham <[email protected]>
  • Loading branch information
darkwing and HowardBraham authored Jul 27, 2023
1 parent 811d25c commit f584f56
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions ui/components/multichain/create-account/create-account.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);

Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion ui/components/ui/editable-label/editable-label.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}

Expand Down

0 comments on commit f584f56

Please sign in to comment.