[Glitch] Fix search popout including full-text search instructions when full-text search is disabled

Port 6c4c72497a to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
th-downstream
Claire 1 year ago
parent 64e661b930
commit 807c0591e1

@ -106,7 +106,7 @@ class Search extends PureComponent {
handleKeyDown = (e) => { handleKeyDown = (e) => {
const { selectedOption } = this.state; const { selectedOption } = this.state;
const options = this._getOptions().concat(this.defaultOptions); const options = searchEnabled ? this._getOptions().concat(this.defaultOptions) : this._getOptions();
switch(e.key) { switch(e.key) {
case 'Escape': case 'Escape':
@ -362,15 +362,19 @@ class Search extends PureComponent {
</> </>
)} )}
<h4><FormattedMessage id='search_popout.options' defaultMessage='Search options' /></h4> {searchEnabled && (
<>
<h4><FormattedMessage id='search_popout.options' defaultMessage='Search options' /></h4>
<div className='search__popout__menu'> <div className='search__popout__menu'>
{this.defaultOptions.map(({ key, label, action }, i) => ( {this.defaultOptions.map(({ key, label, action }, i) => (
<button key={key} onMouseDown={action} className={classNames('search__popout__menu__item', { selected: selectedOption === (options.length + i) })}> <button key={key} onMouseDown={action} className={classNames('search__popout__menu__item', { selected: selectedOption === (options.length + i) })}>
{label} {label}
</button> </button>
))} ))}
</div> </div>
</>
)}
</div> </div>
</div> </div>
); );

Loading…
Cancel
Save