Skip to content

Commit

Permalink
Adjust search bar label based on the selected account (Foundry376#2252)
Browse files Browse the repository at this point in the history
  • Loading branch information
Phylu authored and exprez135 committed Feb 20, 2021
1 parent 4153c46 commit e0d9843
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
FocusedPerspectiveStore,
WorkspaceStore,
MailboxPerspective,
AccountStore,
} from 'mailspring-exports';
import SearchStore from './search-store';
import TokenizingContenteditable from './tokenizing-contenteditable';
Expand Down Expand Up @@ -306,7 +307,13 @@ class ThreadSearchBar extends Component<

_placeholder = () => {
if (this._initialQueryForPerspective() === '') {
return localized('Search all mailboxes');
const countMailboxes = FocusedPerspectiveStore.current()?.accountIds?.length || 0;
if (countMailboxes == 1) {
const account = AccountStore.accountForId(FocusedPerspectiveStore.current().accountIds[0]);
return localized('Search') + ' ' + account.label;
} else {
return localized('Search all mailboxes');
}
}
return localized(`Search`) + ' ' + this.props.perspective.name || '';
};
Expand Down

0 comments on commit e0d9843

Please sign in to comment.