import React from 'react';

import Nav from '../component/Nav/Nav';

import {navContent} from "../nav";
import {withFeatureManager} from "../component/FeatureManager";

class NavMainBase extends React.Component {
    state = {
        navMain: false,
    };

    constructor(props) {
        super(props);

        const {isEnabled} = props;

        this.state.navMain = navContent(isEnabled);
    }

    componentDidUpdate(prevProps) {
        if(prevProps.features !== this.props.features) {
            this.setState({
                navMain: navContent(this.props.isEnabled),
            });
        }
    }

    render() {
        return <Nav content={this.state.navMain} notxt={this.props.notxt}/>;
    }
}

export const NavMain = withFeatureManager(NavMainBase);