"use strict";
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 });
exports.ActionPanel = void 0;
const react_1 = __importStar(require("react"));
const ink_1 = require("ink");
const ink_divider_1 = __importDefault(require("ink-divider"));
class ActionPanel extends react_1.Component {
    render() {
        if (!this.props.selected) {
            return (react_1.default.createElement(ink_1.Box, { flexDirection: 'column' },
                react_1.default.createElement(ink_1.Text, { bold: true }, "Commands"),
                react_1.default.createElement(ink_divider_1.default, null),
                react_1.default.createElement(ink_1.Text, null, "(up/down): select packages and services"),
                react_1.default.createElement(ink_1.Text, null, "(l): show events log"),
                react_1.default.createElement(ink_1.Text, null, "(q): stop all services and quit"),
                react_1.default.createElement(ink_1.Text, null, "(escape): leave services running and only quit")));
        }
        const isPackage = this.props.packages.some((p) => p.name === this.props.selected);
        const selectedNode = isPackage
            ? this.props.packages.find((p) => p.name === this.props.selected)
            : this.props.services.find((p) => p.name === this.props.selected);
        if (isPackage) {
            const pkg = selectedNode;
            return (react_1.default.createElement(ink_1.Box, { flexDirection: 'column' },
                react_1.default.createElement(ink_1.Text, { bold: true }, pkg.name),
                react_1.default.createElement(ink_divider_1.default, null),
                react_1.default.createElement(ink_1.Text, null,
                    "version: ",
                    pkg.version),
                react_1.default.createElement(ink_1.Text, null,
                    "compilation status: ",
                    pkg.compilationStatus,
                    " "),
                react_1.default.createElement(ink_1.Text, null, "last compilation took: "),
                react_1.default.createElement(ink_1.Text, null, "using typescript version: 3.7.5"),
                react_1.default.createElement(ink_divider_1.default, null),
                react_1.default.createElement(ink_1.Text, null, "(e): show compilation errors"),
                react_1.default.createElement(ink_1.Text, null, "(b): recompile package"),
                react_1.default.createElement(ink_1.Text, null, "(t): run packages tests"),
                react_1.default.createElement(ink_1.Text, null, "(escape): close menu")));
        }
        const service = selectedNode;
        return (react_1.default.createElement(ink_1.Box, { flexDirection: 'column' },
            react_1.default.createElement(ink_1.Text, { bold: true }, service.name),
            react_1.default.createElement(ink_divider_1.default, null),
            react_1.default.createElement(ink_1.Text, null,
                "version: ",
                service.version),
            react_1.default.createElement(ink_1.Text, null,
                "allocated port: ",
                service.port),
            react_1.default.createElement(ink_1.Text, null,
                "compilation status: ",
                service.compilationStatus),
            react_1.default.createElement(ink_1.Text, null,
                "start status: ",
                service.status),
            react_1.default.createElement(ink_1.Text, null, "last compilation took:"),
            react_1.default.createElement(ink_1.Text, null, "using typescript version: 3.7.5"),
            react_1.default.createElement(ink_1.Text, null, "last start took: "),
            react_1.default.createElement(ink_1.Text, null, "using serverless version: 1.61.1"),
            react_1.default.createElement(ink_divider_1.default, null),
            react_1.default.createElement(ink_1.Text, null, "(l): show service logs"),
            react_1.default.createElement(ink_1.Text, null, "(e): show compilation errors"),
            react_1.default.createElement(ink_1.Text, null, "(s): stop service"),
            react_1.default.createElement(ink_1.Text, null, "(r): restart service"),
            react_1.default.createElement(ink_1.Text, null, "(b): recompile service"),
            react_1.default.createElement(ink_1.Text, null, "(d): enable/disable service"),
            react_1.default.createElement(ink_1.Text, null, "(t): run service tests"),
            react_1.default.createElement(ink_1.Text, null, "(p): package service"),
            react_1.default.createElement(ink_1.Text, null, "($): deploy service"),
            react_1.default.createElement(ink_1.Text, null, "(escape): close menu")));
    }
}
exports.ActionPanel = ActionPanel;
//# sourceMappingURL=action-panel.js.map