const preact = require('preact');
const { Component } = require('preact');
const { connect } = require('preact-redux');
const linkState = require('linkstate').default;

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

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

        return {
            games
        };
    },
);

function AcpGameList(args) {
    const {
        games,
    } = args;

    if (!games) return false;

    return (
        <table>
            <tbody>
            {games.map((g, i) => <tr key={i}><td>{JSON.stringify(g)}</td></tr>)}
            </tbody>
        </table>
    )
}

module.exports = addState(AcpGameList);
