emv
Version:
EMV / Chip and PIN CLI and library for PC/SC card readers
29 lines • 2.14 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Box, Text } from 'ink';
import SelectInput from 'ink-select-input';
import { Header, Footer, CardBox } from '../components/index.js';
export function SelectedAppScreen({ app, onVerifyPin, onExplore, onBack, }) {
const items = [
{ label: '🔐 Verify PIN', value: 'pin' },
{ label: '🔍 Explore Card Data', value: 'explore' },
{ label: '← Back to Applications', value: 'back' },
];
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Header, {}), _jsxs(CardBox, { title: "Selected Application", children: [_jsxs(Text, { children: [_jsxs(Text, { color: "cyan", bold: true, children: ["Name:", ' '] }), _jsx(Text, { children: app.label ?? 'Unknown' })] }), _jsxs(Text, { children: [_jsxs(Text, { color: "cyan", bold: true, children: ["AID:", ' '] }), _jsx(Text, { color: "yellow", children: app.aid })] }), app.priority !== undefined && (_jsxs(Text, { children: [_jsxs(Text, { color: "cyan", bold: true, children: ["Priority:", ' '] }), _jsx(Text, { children: app.priority })] }))] }), _jsx(CardBox, { title: "Actions", children: _jsx(SelectInput, { items: items, onSelect: (item) => {
switch (item.value) {
case 'pin':
onVerifyPin();
break;
case 'explore':
onExplore();
break;
case 'back':
onBack();
break;
}
}, itemComponent: ({ isSelected, label }) => isSelected ? (_jsxs(Text, { color: "cyan", bold: true, children: ['▸ ', label] })) : (_jsxs(Text, { children: [' ', label] })) }) }), _jsx(Footer, { hints: [
{ keys: '↑↓', description: 'Navigate' },
{ keys: 'Enter', description: 'Select' },
{ keys: 'q', description: 'Quit' },
] })] }));
}
//# sourceMappingURL=SelectedAppScreen.js.map