@letanure/resend-cli
Version:
A command-line interface for Resend email API
29 lines • 3.17 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Alert } from '@inkjs/ui';
import { Box, Text } from 'ink';
import { useDryRun } from '../../contexts/DryRunProvider.js';
const getNavigationInstructions = (context) => {
switch (context) {
case 'root-menu':
return (_jsxs(Text, { dimColor: true, children: ["Use ", _jsx(Text, { color: "yellow", children: "\u2191/\u2193" }), " to navigate, ", _jsx(Text, { color: "yellow", children: "Enter/\u2192" }), " to select,", ' ', _jsx(Text, { color: "yellow", children: "q/ESC" }), " to quit"] }));
case 'menu':
return (_jsxs(Text, { dimColor: true, children: ["Use ", _jsx(Text, { color: "yellow", children: "\u2191/\u2193" }), " to navigate, ", _jsx(Text, { color: "yellow", children: "Enter/\u2192" }), " to select,", ' ', _jsx(Text, { color: "yellow", children: "q/ESC/\u2190" }), " to go back"] }));
case 'form':
return (_jsxs(Text, { dimColor: true, children: [_jsx(Text, { color: "yellow", children: "Tab/\u2193" }), " Next field \u00B7 ", _jsx(Text, { color: "yellow", children: "Shift+Tab/\u2191" }), " Previous field \u00B7", ' ', _jsx(Text, { color: "yellow", children: "Enter" }), " Submit \u00B7 ", _jsx(Text, { color: "yellow", children: "Esc/\u2190" }), " Cancel"] }));
case 'form-single':
return (_jsxs(Text, { dimColor: true, children: [_jsx(Text, { color: "yellow", children: "Enter" }), " Submit \u00B7 ", _jsx(Text, { color: "yellow", children: "Esc/\u2190" }), " Cancel"] }));
case 'result':
return (_jsxs(Text, { dimColor: true, children: ["Press ", _jsx(Text, { color: "yellow", children: "Esc/\u2190" }), " to go back"] }));
case 'error-retry':
return (_jsxs(Text, { dimColor: true, children: ["Press ", _jsx(Text, { color: "yellow", children: "Enter/r" }), " to retry \u2022 ", _jsx(Text, { color: "yellow", children: "Esc/\u2190" }), " to go back"] }));
case 'none':
return null;
default:
return (_jsxs(Text, { dimColor: true, children: ["Use ", _jsx(Text, { color: "yellow", children: "\u2191/\u2193" }), " to navigate, ", _jsx(Text, { color: "yellow", children: "Enter/\u2192" }), " to select", ' ', _jsx(Text, { color: "yellow", children: "q" }), "/", _jsx(Text, { color: "yellow", children: "ESC/\u2190" }), " to go back"] }));
}
};
export const Layout = ({ headerText, footerText, showNavigationInstructions, navigationContext = 'menu', children, }) => {
const { isDryRun } = useDryRun();
return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { bold: true, color: "blue", children: headerText }) }), isDryRun && (_jsx(Box, { marginBottom: 1, children: _jsx(Alert, { variant: "warning", children: "DRY RUN MODE: Operations will be validated but not executed." }) })), children, _jsxs(Box, { marginTop: 1, children: [showNavigationInstructions && _jsx(Box, { marginBottom: 1, children: getNavigationInstructions(navigationContext) }), _jsx(Text, { dimColor: true, children: footerText })] })] }));
};
//# sourceMappingURL=layout.js.map