import variables from 'modules/variables'; import { PureComponent } from 'react'; import { MdSettings, MdOutlineShoppingBasket, MdOutlineExtension, MdRefresh, MdClose, } from 'react-icons/md'; import Tab from './Tab'; import Button from '../../settings/Button'; import ErrorBoundary from '../../../ErrorBoundary'; class Tabs extends PureComponent { constructor(props) { super(props); this.state = { currentTab: this.props.children[0].props.label, currentName: this.props.children[0].props.name, }; } onClick = (tab, name) => { if (name !== this.state.currentName) { variables.stats.postEvent('tab', `Opened ${name}`); } this.setState({ currentTab: tab, currentName: name, }); }; hideReminder() { localStorage.setItem('showReminder', false); document.querySelector('.reminder-info').style.display = 'none'; } render() { const navbarButtons = [ { tab: 'settings', icon: , }, { tab: 'addons', icon: , }, { tab: 'marketplace', icon: , }, ]; const reminderInfo = (
{variables.getMessage('modals.main.settings.reminder.title')} this.hideReminder()}>
{variables.getMessage('modals.main.settings.reminder.message')}
); return (
    {this.props.children.map((tab, index) => ( this.onClick(nextTab, tab.props.name)} navbarTab={this.props.navbar || false} /> ))} {reminderInfo}
{navbarButtons.map(({ tab, icon }) => (
{this.props.children.map((tab) => { if (tab.props.label !== this.state.currentTab) { return undefined; } return {tab.props.children}; })}
); } } export default Tabs;