var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    }
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
import * as React from 'react';
import { connect } from 'react-redux';
import { keyDown, keyUp, appClick } from '../actions/ui';
import { BrowserRouter as Router, Route, Redirect, Switch, } from 'react-router-dom';
import Hardware from './Hardware';
import Software from './Software';
import ThreeD from './threed/ThreeD';
var App = /** @class */ (function (_super) {
    __extends(App, _super);
    function App() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.onBodyKeyDown = function (e) {
            _this.props.keyDown(e.key);
        };
        _this.onBodyKeyUp = function (e) {
            _this.props.keyUp(e.key);
        };
        _this.onClick = function (e) {
            _this.props.appClick(e.clientX, e.clientY);
        };
        return _this;
    }
    App.prototype.componentDidMount = function () {
        document.body.addEventListener('keydown', this.onBodyKeyDown);
        document.body.addEventListener('keyup', this.onBodyKeyUp);
    };
    App.prototype.componentWillUnmount = function () {
        document.body.removeEventListener('keydown', this.onBodyKeyDown);
        document.body.removeEventListener('keyup', this.onBodyKeyUp);
    };
    App.prototype.render = function () {
        return (React.createElement("div", { onClick: this.onClick },
            React.createElement(Router, null,
                React.createElement(Switch, null,
                    React.createElement(Route, { path: "/software", component: Software }),
                    React.createElement(Route, { path: "/hardware", component: Hardware }),
                    React.createElement(Route, { path: "/3d", component: ThreeD }),
                    React.createElement(Route, { render: function () { return React.createElement(Redirect, { to: "/3d" }); } })))));
    };
    return App;
}(React.Component));
var mapStateToProps = function () { return ({}); };
var mapDispatchToProps = { keyDown: keyDown, keyUp: keyUp, appClick: appClick };
export default connect(mapStateToProps, mapDispatchToProps)(App);
//# sourceMappingURL=App.js.map