Hide searchbar for core internal modules

This commit is contained in:
Felix Linker
2020-12-29 16:36:43 +01:00
parent d3766d9e17
commit 3dd4675a0b
3 changed files with 7 additions and 5 deletions

View File

@@ -23,6 +23,7 @@ export default class AvailableModulesMenu extends TranslatedComponent {
static propTypes = { static propTypes = {
onSelect: PropTypes.func.isRequired, onSelect: PropTypes.func.isRequired,
diffDetails: PropTypes.func, diffDetails: PropTypes.func,
hideSearch: PropTypes.bool,
m: PropTypes.object, m: PropTypes.object,
warning: PropTypes.func, warning: PropTypes.func,
slotDiv: PropTypes.object slotDiv: PropTypes.object
@@ -196,7 +197,7 @@ export default class AvailableModulesMenu extends TranslatedComponent {
* @returns {React.Component} Search component if available * @returns {React.Component} Search component if available
*/ */
_showSearch() { _showSearch() {
if (this.props.modules instanceof Array) { if (this.props.hideSearch) {
return; return;
} }
return ( return (

View File

@@ -25,11 +25,12 @@ const HARDPOINT_SLOT_LABELS = {
export default class Slot extends TranslatedComponent { export default class Slot extends TranslatedComponent {
static propTypes = { static propTypes = {
currentMenu: PropTypes.any, currentMenu: PropTypes.any,
hideSearch: PropTypes.bool,
m: PropTypes.instanceOf(Module), m: PropTypes.instanceOf(Module),
warning: PropTypes.func, warning: PropTypes.func,
drag: PropTypes.func, drag: PropTypes.func,
drop: PropTypes.func, drop: PropTypes.func,
dropClass: PropTypes.string dropClass: PropTypes.string,
}; };
/** /**
@@ -188,7 +189,7 @@ export default class Slot extends TranslatedComponent {
render() { render() {
let language = this.context.language; let language = this.context.language;
let translate = language.translate; let translate = language.translate;
let { currentMenu, m, dropClass, dragOver, warning } = this.props; let { currentMenu, m, dropClass, dragOver, warning, hideSearch } = this.props;
const { menuIndex } = this.state; const { menuIndex } = this.state;
// TODO: implement touch dragging // TODO: implement touch dragging
@@ -209,7 +210,7 @@ export default class Slot extends TranslatedComponent {
</div> </div>
{selected && menuIndex === 0 && {selected && menuIndex === 0 &&
<AvailableModulesMenu <AvailableModulesMenu
m={m} m={m} hideSearch={hideSearch}
onSelect={(item) => { onSelect={(item) => {
m.setItem(item); m.setItem(item);
this.context.closeMenu(); this.context.closeMenu();

View File

@@ -91,7 +91,7 @@ export default class StandardSlotSection extends SlotSection {
*/ */
_mkSlot(m, warning) { _mkSlot(m, warning) {
const { currentMenu } = this.props; const { currentMenu } = this.props;
return <Slot key={m.getSlot()} m={m} warning={warning} return <Slot key={m.getSlot()} m={m} warning={warning} hideSearch={true}
currentMenu={currentMenu} currentMenu={currentMenu}
/>; />;
} }