import * as React from "react";
import { useState } from 'react';
import { AppState } from "../store";
import { connect } from "react-redux";
import { Route, Link } from "react-router-dom";


const WonScreen = ({ saveState }) => {
    const [activeIdx, setActiveIdx] = useState(0);
    let actuallyWon = false;
    // const levelSaveState = store.get
    for (let i = 2; i < saveState.levels.length; ++i) {
        let { done } = saveState.levels[i];
        actuallyWon = actuallyWon && done;
    }

    return (
        <div style={{ padding: '1rem' }}>
            <div className="levelItems">
                <h1 className="levelSelectCaption">select level:</h1>
                <Link to={'/levels'}>back</Link>
            </div>

        </div>)
}

const mapStateToProps = (state: AppState, ownprops?) => {
    return {
        ...ownprops,
        saveState: state.saveState
    }
}

const mapDispatchToProps = dispatch => {
    return {
        // openModal: () => dispatch({ type: OPEN_MODAL })
    }
}


export default connect(mapStateToProps, mapDispatchToProps)(WonScreen);

