import { __assign } from "tslib";
import React, { useState, useContext } from "react";
import { Common, Row, Overlay } from "v-eris";
import { useNavigate, useLocation } from "react-router-dom";
import { BuildContext } from "../../components/Build/build";
import { Tools } from "../../components/Tools/tools";
import { Loader } from "../../components/Loader/loader";
import { MeasurementsTools, Tools1, Tools2 } from "../../components/Tools/tools.test";
import { Sidebar } from "../../components/Sidebar/sidebar";
import { Search } from "../../components/Search/search";
import { Templates } from "../../components/Templates/templates";
import { TemplatesTable } from "@components/Templates/templates.table";
export var AppRoute = function () {
    var nav = useNavigate();
    var location = useLocation();
    var qs = Common.parseQuery(location);
    var build = useContext(BuildContext);
    var route = build.routes["admin"];
    var settings = build.settings;
    var _a = useState({}), tools = _a[0], setToolsRef = _a[1];
    var _b = useState(true), sidebarActive = _b[0], setSidebarActive = _b[1];
    var setTools = function (data) {
        var _a;
        console.log(data);
        setToolsRef(__assign(__assign({}, tools), (_a = {}, _a[data.key] = data.value, _a)));
    };
    var templatesList = {
        "aircrafts": [
            { list: [1, 2, 3] }
        ],
    };
    return (React.createElement(Row, { style: { height: "100%" } },
        React.createElement(Search, { active: sidebarActive }),
        React.createElement(Sidebar, { active: sidebarActive, hasSearch: true, onClick: function () { console.log(sidebarActive); setSidebarActive(!sidebarActive); } },
            React.createElement(Templates, { templates: TemplatesTable, value: templatesList })),
        React.createElement(Overlay, { margin: [70, 19], direction: [1, 1], style: { zIndex: 2 } },
            React.createElement(Row, { gap: 12 },
                React.createElement(Tools, { list: MeasurementsTools, simple: true, value: tools, onChange: setTools, cycle: settings.getSecureValue("Measurements:Settings:SwitchType") == "cycle", style: { display: settings.getSecureValue("Measurements:Toggles:TopBar") != "never" ? "flex" : "none" } }),
                React.createElement(Tools, { list: Tools1, value: tools, onChange: setTools }),
                React.createElement(Tools, { list: Tools2, value: tools, onChange: setTools }))),
        React.createElement(Loader, { active: true, container: true })));
};
//# sourceMappingURL=app.route.js.map