"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Footer = Footer;
const jsx_runtime_1 = require("react/jsx-runtime");
const ink_1 = require("ink");
const NavigationContext_1 = require("../state/NavigationContext");
const HOME_SHORTCUTS = [
    { key: "Up/Down", label: "Navigate" },
    { key: "Enter", label: "Select" },
    { key: "Type", label: "Filter" },
    { key: "m", label: "My cards" },
    { key: "s", label: "Sync" },
    { key: "q/Esc", label: "Quit" },
];
const BOARD_SHORTCUTS = [
    { key: "Arrows", label: "Navigate" },
    { key: "Enter", label: "View" },
    { key: "n", label: "New card" },
    { key: "L", label: "New list" },
    { key: "Esc", label: "Back" },
    { key: "?", label: "Help" },
];
const CARD_DETAIL_SHORTCUTS = [
    { key: "e", label: "Edit" },
    { key: "l", label: "Labels" },
    { key: "d", label: "Due date" },
    { key: "o", label: "Open" },
    { key: "Esc", label: "Close" },
    { key: "?", label: "Help" },
];
const MY_CARDS_SHORTCUTS = [
    { key: "Up/Down", label: "Navigate" },
    { key: "Enter", label: "View" },
    { key: "Esc", label: "Back" },
];
function Footer() {
    const { state, config } = (0, NavigationContext_1.useNavigation)();
    let shortcuts;
    switch (state.view) {
        case "home":
            shortcuts = HOME_SHORTCUTS;
            break;
        case "board":
            shortcuts = BOARD_SHORTCUTS;
            break;
        case "card-detail":
            shortcuts = CARD_DETAIL_SHORTCUTS;
            break;
        case "my-cards":
            shortcuts = MY_CARDS_SHORTCUTS;
            break;
        default:
            shortcuts = HOME_SHORTCUTS;
    }
    if (state.mode !== "normal") {
        if (state.mode === "edit-desc") {
            shortcuts = [
                { key: "Enter", label: "Save" },
                { key: "Esc", label: "Cancel" },
                { key: "Ctrl+J", label: "New line" },
            ];
        }
        else if (state.mode === "toggle-label" || state.mode === "toggle-member") {
            shortcuts = [
                { key: "1-9", label: "Toggle" },
                { key: "Esc", label: "Close" },
            ];
        }
        else if (state.mode === "toggle-checklist") {
            shortcuts = [
                { key: "1-9/a-z", label: "Select/Toggle" },
                { key: "Left/Right", label: "Page" },
                { key: "i", label: "Add item" },
                { key: "Esc", label: "Back" },
            ];
        }
        else if (state.mode === "view-attachments") {
            shortcuts = [
                { key: "Esc", label: "Close" },
            ];
        }
        else {
            shortcuts = [
                { key: "Enter", label: "Confirm" },
                { key: "Esc", label: "Cancel" },
            ];
        }
    }
    return ((0, jsx_runtime_1.jsx)(ink_1.Box, { borderStyle: "single", borderTop: true, borderBottom: false, borderLeft: false, borderRight: false, paddingX: 1, children: shortcuts.map((s, i) => ((0, jsx_runtime_1.jsxs)(ink_1.Box, { marginRight: 1, children: [(0, jsx_runtime_1.jsxs)(ink_1.Text, { color: config.theme.primary, bold: true, children: ["[", s.key, "]"] }), (0, jsx_runtime_1.jsxs)(ink_1.Text, { color: config.theme.muted, children: [" ", s.label] }), i < shortcuts.length - 1 && (0, jsx_runtime_1.jsx)(ink_1.Text, { color: config.theme.muted, children: " " })] }, s.key))) }));
}
