Android_Retail/src/Pages/BookingScreen/Components/UtillComponents/ShortcutKeyHelper.jsx

75 lines
2.4 KiB
React
Raw Normal View History

2026-01-27 18:27:29 +05:30
import React, { useState } from 'react';
import { List, Typography, Tooltip } from 'antd';
2026-01-27 18:27:29 +05:30
import { FaKeyboard } from 'react-icons/fa';
import { DefaultModal } from '../../../../Components/Modal/DefaultModal';
2026-01-27 18:27:29 +05:30
const { Title, Text } = Typography;
2026-02-05 15:55:58 +05:30
const ShortcutKeyHelper = ({ }) => {
2026-01-27 18:27:29 +05:30
const [isModalOpen, setIsModalOpen] = useState(false);
const shortcuts = [
{ key: 'Alt + Z', description: 'Customer' },
{ key: 'Alt + A', description: 'Extra Charge' },
{ key: 'Alt + N', description: 'Quick Add' },
{ key: 'Alt + R', description: 'Reprint' },
{ key: 'Alt + S', description: 'Split Payment' },
{ key: 'F4', description: 'Quick Pay' },
{ key: 'Alt + W', description: 'Hold and Recall' },
{ key: 'Ctrl + Q', description: 'Qty Change' },
{ key: 'Ctrl + E', description: 'Price Change' },
{ key: 'Ctrl + Y', description: 'Weight / Amount' },
{ key: 'Ctrl + B', description: 'Packing' },
{ key: 'Alt + P', description: 'Change Total Amount' },
2026-02-05 15:53:37 +05:30
{ key: 'Ctrl + I', description: 'Customer Rate History' },
2026-01-27 18:27:29 +05:30
];
return (
<>
<Tooltip title="Keyboard Shortcuts">
<div
onClick={() => setIsModalOpen(true)}
style={{
cursor: 'pointer',
display: 'flex',
alignItems: 'center',
gap: '5px',
padding: '5px 10px',
borderRadius: '4px',
2026-02-05 15:55:58 +05:30
fontSize: '18px',
2026-01-27 18:27:29 +05:30
}}
>
<FaKeyboard />
{/* <span>Shortcuts</span> */}
</div>
</Tooltip>
<DefaultModal
2026-01-27 18:27:29 +05:30
title={
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
<FaKeyboard />
Keyboard Shortcuts
2026-01-27 18:27:29 +05:30
</div>
}
open={isModalOpen}
handleCancel={() => setIsModalOpen(false)}
2026-01-27 18:27:29 +05:30
footer={null}
width={500}
>
<List
dataSource={shortcuts}
renderItem={(item) => (
<List.Item>
<div style={{ display: 'flex', justifyContent: 'space-between', width: '100%' }}>
<Text strong style={{ fontFamily: 'monospace', backgroundColor: '#f5f5f5', padding: '2px 6px', borderRadius: '3px' }}>
{item.key}
</Text>
<Text>{item.description}</Text>
</div>
</List.Item>
)}
/>
</DefaultModal>
2026-01-27 18:27:29 +05:30
</>
);
};
export default ShortcutKeyHelper;