"use strict";
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
    if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
    return cooked;
};
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
/* eslint-disable react/no-array-index-key */
var React = __importStar(require("react"));
var styled_components_1 = __importDefault(require("@xstyled/styled-components"));
var Modal_1 = require("../Modal");
var Frame_1 = __importDefault(require("../Frame"));
var Clock_1 = __importDefault(require("./Clock"));
var WindowButton_1 = __importDefault(require("./WindowButton"));
var Truncate = styled_components_1.default.span(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n  overflow: hidden;\n  display: -webkit-box;\n  -webkit-line-clamp: 1;\n  -webkit-box-orient: vertical;\n"], ["\n  overflow: hidden;\n  display: -webkit-box;\n  -webkit-line-clamp: 1;\n  -webkit-box-orient: vertical;\n"])));
var TaskBar = function (_a) {
    var list = _a.list;
    var _b = React.useState(false), showList = _b[0], toggleShowList = _b[1];
    var _c = React.useState(false), activeStart = _c[0], toggleActiveStart = _c[1];
    var _d = React.useContext(Modal_1.ModalContext), windows = _d.windows, activeWindow = _d.activeWindow, setActiveWindow = _d.setActiveWindow;
    return (React.createElement(Frame_1.default, { position: "fixed", bottom: 0, left: 0, right: 0, display: "flex", justifyContent: "space-between", height: 28, width: "100%", padding: 2, zIndex: "taskbar" },
        showList && (React.createElement(Frame_1.default, { position: "absolute", bottom: 28, onClick: function () {
                toggleActiveStart(false);
                toggleShowList(false);
            } }, list)),
        React.createElement(WindowButton_1.default, { small: true, icon: "logo", active: activeStart, onClick: function () {
                toggleActiveStart(!activeStart);
                toggleShowList(!showList);
            } }, "Start"),
        React.createElement(Frame_1.default, { boxShadow: "none", width: "100%", paddingLeft: 0, ml: 2, display: "flex" }, windows &&
            windows.map(function (_a, index) {
                var icon = _a.icon, title = _a.title;
                return (React.createElement(WindowButton_1.default, { key: title + "-" + index, icon: icon, active: title === activeWindow, onClick: function () { return setActiveWindow(title); }, small: false },
                    React.createElement(Truncate, null, title)));
            })),
        React.createElement(Clock_1.default, null)));
};
TaskBar.defaultProps = {
    list: undefined,
};
exports.default = TaskBar;
var templateObject_1;
//# sourceMappingURL=TaskBar.js.map