mirror of
https://github.com/sipeed/NanoKVM-USB.git
synced 2026-11-10 01:14:16 -06:00
feat: add keyboard shortcuts menu and update translations
This commit is contained in:
@@ -4,9 +4,7 @@ import { KeyboardIcon } from 'lucide-react';
|
||||
|
||||
import { Paste } from './paste.tsx';
|
||||
import { VirtualKeyboard } from './virtual-keyboard.tsx';
|
||||
import { CtrlAltDel } from './ctrl-alt-del';
|
||||
import { CtrlD } from './ctrl-d.tsx';
|
||||
import { WinTab } from './win-tab.tsx';
|
||||
import { KeyboardShortcutsMenu } from './shortcuts-menu.tsx';
|
||||
|
||||
export const Keyboard = () => {
|
||||
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
||||
@@ -14,10 +12,8 @@ export const Keyboard = () => {
|
||||
const content = (
|
||||
<>
|
||||
<Paste />
|
||||
<CtrlAltDel />
|
||||
<CtrlD />
|
||||
<WinTab />
|
||||
<VirtualKeyboard />
|
||||
<KeyboardShortcutsMenu />
|
||||
</>
|
||||
);
|
||||
|
||||
|
||||
36
browser/src/components/menu/keyboard/shortcuts-menu.tsx
Normal file
36
browser/src/components/menu/keyboard/shortcuts-menu.tsx
Normal file
@@ -0,0 +1,36 @@
|
||||
import { useState } from 'react';
|
||||
import { SendHorizonal } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Popover } from 'antd';
|
||||
|
||||
import { CtrlAltDel } from './ctrl-alt-del';
|
||||
import { CtrlD } from './ctrl-d.tsx';
|
||||
import { WinTab } from './win-tab.tsx';
|
||||
|
||||
export const KeyboardShortcutsMenu = () => {
|
||||
const { t } = useTranslation();
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<Popover
|
||||
content={
|
||||
<div className="flex flex-col gap-1">
|
||||
<CtrlAltDel />
|
||||
<CtrlD />
|
||||
<WinTab />
|
||||
</div>
|
||||
}
|
||||
trigger="click"
|
||||
placement="rightTop"
|
||||
align={{ offset: [14, 0] }}
|
||||
open={open}
|
||||
onOpenChange={setOpen}
|
||||
arrow={false}
|
||||
>
|
||||
<div className="flex h-[30px] cursor-pointer items-center space-x-1 rounded px-3 text-neutral-300 hover:bg-neutral-700/60">
|
||||
<SendHorizonal size={18} />
|
||||
<span>{t('keyboard.shortcuts')}</span>
|
||||
</div>
|
||||
</Popover>
|
||||
);
|
||||
};
|
||||
@@ -37,6 +37,7 @@ const be = {
|
||||
keyboard: {
|
||||
paste: 'Plakken',
|
||||
virtualKeyboard: 'Virtueel klavier',
|
||||
shortcuts: 'Sneltoetsen',
|
||||
ctrlAltDel: 'Ctrl + Alt + Delete',
|
||||
ctrlD: 'Ctrl + D',
|
||||
winTab: 'Win + Tab',
|
||||
|
||||
@@ -37,6 +37,7 @@ const de = {
|
||||
keyboard: {
|
||||
paste: 'Einfügen',
|
||||
virtualKeyboard: 'Virtuelle Tastatur',
|
||||
shortcuts: 'Tastenkürzel',
|
||||
ctrlAltDel: 'Strg + Alt + Entfernen',
|
||||
ctrlD: 'Strg + D',
|
||||
winTab: 'Win + Tab',
|
||||
|
||||
@@ -37,6 +37,7 @@ const en = {
|
||||
keyboard: {
|
||||
paste: 'Paste',
|
||||
virtualKeyboard: 'Keyboard',
|
||||
shortcuts: 'Shortcuts',
|
||||
ctrlAltDel: 'Ctrl + Alt + Delete',
|
||||
ctrlD: 'Ctrl + D',
|
||||
winTab: 'Win + Tab',
|
||||
|
||||
@@ -37,6 +37,7 @@ const nl = {
|
||||
keyboard: {
|
||||
paste: 'Plakken',
|
||||
virtualKeyboard: 'Virtueel toetsenbord',
|
||||
shortcuts: 'Sneltoetsen',
|
||||
ctrlAltDel: 'Ctrl + Alt + Delete',
|
||||
ctrlD: 'Ctrl + D',
|
||||
winTab: 'Win + Tab',
|
||||
|
||||
@@ -37,6 +37,7 @@ const ru = {
|
||||
keyboard: {
|
||||
paste: 'Вставить текст',
|
||||
virtualKeyboard: 'Виртуальная клавиатура',
|
||||
shortcuts: 'Сочетания клавиш',
|
||||
ctrlAltDel: 'Ctrl + Alt + Delete',
|
||||
ctrlD: 'Ctrl + D',
|
||||
winTab: 'Win + Tab',
|
||||
|
||||
@@ -35,6 +35,7 @@ const zh = {
|
||||
keyboard: {
|
||||
paste: '粘贴',
|
||||
virtualKeyboard: '虚拟键盘',
|
||||
shortcuts: '快捷键',
|
||||
ctrlAltDel: 'Ctrl + Alt + Delete',
|
||||
ctrlD: 'Ctrl + D',
|
||||
winTab: 'Win + Tab',
|
||||
|
||||
Reference in New Issue
Block a user