import React, { Component } from "react"; import PropTypes from "prop-types"; import { observer } from "mobx-react"; import { observable, action } from "mobx"; import { AlertStore } from "Stores/AlertStore"; import { Settings } from "Stores/Settings"; import { Tab } from "Components/Modal/Tab"; import { Configuration } from "./Configuration"; import { Help } from "./Help"; const TabNames = Object.freeze({ Configuration: "configuration", Help: "help" }); const MainModalContent = observer( class MainModalContent extends Component { static propTypes = { alertStore: PropTypes.instanceOf(AlertStore).isRequired, settingsStore: PropTypes.instanceOf(Settings).isRequired, onHide: PropTypes.func.isRequired, openTab: PropTypes.oneOf(Object.values(TabNames)), expandAllOptions: PropTypes.bool.isRequired }; static defaultProps = { openTab: TabNames.Configuration }; constructor(props) { super(props); this.tab = observable( { current: props.openTab, setTab(newTab) { this.current = newTab; } }, { setTab: action.bound } ); } render() { const { alertStore, settingsStore, onHide, expandAllOptions } = this.props; return (
{this.tab.current === TabNames.Help ? ( ) : null} {this.tab.current === TabNames.Configuration ? ( ) : null}
Version: {alertStore.info.version}
); } } ); export { MainModalContent, TabNames };