Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UX: Allow quick Add Account name based on default name #20168

Merged
merged 2 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading