"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HelpScreen = HelpScreen;
const jsx_runtime_1 = require("react/jsx-runtime");
const ink_1 = require("ink");
const NavigationContext_1 = require("../state/NavigationContext");
const ALL_SHORTCUTS = [
    { section: "Navigation", items: [
            { key: "Up / Down", desc: "Navigate items in a list" },
            { key: "Left / Right", desc: "Switch between lists (Board view)" },
            { key: "1-9", desc: "Jump to list by number" },
            { key: "Enter", desc: "Select / Open details" },
            { key: "Esc", desc: "Go back / Cancel" },
            { key: "Tab", desc: "Cycle through lists" },
            { key: "g / G", desc: "Jump to first / last card" },
        ] },
    { section: "Card Actions", items: [
            { key: "n", desc: "Create new card in current list" },
            { key: "e", desc: "Edit card name" },
            { key: "D", desc: "Edit card description (multi-line)" },
            { key: "m", desc: "Move card to a different list" },
            { key: "d", desc: "Set / update due date" },
            { key: "l", desc: "Toggle labels on card" },
            { key: "M", desc: "Toggle members on card" },
            { key: "c", desc: "Toggle checklist items" },
            { key: "C", desc: "Create new checklist on card" },
            { key: "A", desc: "Add attachment (URL or URL | description)" },
            { key: "a", desc: "View all attachments" },
            { key: "x", desc: "Archive card" },
            { key: "o", desc: "Open card in browser" },
            { key: "Delete", desc: "Delete card (with confirmation)" },
        ] },
    { section: "List Actions", items: [
            { key: "L", desc: "Create new list on current board" },
        ] },
    { section: "Global", items: [
            { key: "b", desc: "Switch board (from Board view)" },
            { key: "s", desc: "Sync cache" },
            { key: "Ctrl+R", desc: "Force refresh board" },
            { key: "?", desc: "Toggle this help screen" },
            { key: "q", desc: "Quit" },
        ] },
];
function HelpScreen({ onClose }) {
    const { config } = (0, NavigationContext_1.useNavigation)();
    (0, ink_1.useInput)((_input, key) => {
        if (key.escape || _input === "?" || _input === "q") {
            onClose();
        }
    });
    return ((0, jsx_runtime_1.jsxs)(ink_1.Box, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [(0, jsx_runtime_1.jsx)(ink_1.Text, { bold: true, color: config.theme.primary, children: "Keyboard Shortcuts" }), (0, jsx_runtime_1.jsx)(ink_1.Text, { color: config.theme.muted, children: "Press ? or Esc to close" }), (0, jsx_runtime_1.jsx)(ink_1.Text, { children: " " }), ALL_SHORTCUTS.map((section) => ((0, jsx_runtime_1.jsxs)(ink_1.Box, { flexDirection: "column", marginBottom: 1, children: [(0, jsx_runtime_1.jsx)(ink_1.Text, { bold: true, underline: true, color: config.theme.secondary, children: section.section }), section.items.map((item) => ((0, jsx_runtime_1.jsxs)(ink_1.Box, { children: [(0, jsx_runtime_1.jsx)(ink_1.Box, { width: 16, children: (0, jsx_runtime_1.jsx)(ink_1.Text, { color: config.theme.primary, bold: true, children: item.key }) }), (0, jsx_runtime_1.jsx)(ink_1.Text, { children: item.desc })] }, item.key)))] }, section.section)))] }));
}
