const { connect } = require('preact-redux');
const preact = require('preact');

const actions = require('./../actions');

const AccountTop = require('./account.top');
const Play = require('./play');
const Shop = require('./shop');
const Reshape = require('./reshape');

const addState = connect(
    function receiveState(state) {
        const {
            nav,
        } = state;

        return {
            nav,
        };
    },
);

function Top(args) {
    const {
        nav,
        authenticated,
    } = args;

    if (nav === 'account') return <AccountTop />;
    if (nav === 'play') return <Play />
    if (nav === 'shop') return <Shop />
    if (nav === 'reshape') return <Reshape />

    return false;
}

module.exports = addState(Top);
