From e85c8cf84efa1beeb0c003abcb3d176ce3bc96a9 Mon Sep 17 00:00:00 2001 From: shats Date: Fri, 3 Oct 2025 12:56:09 +0700 Subject: [PATCH] =?UTF-8?q?feat:=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BD=D1=82=D0=B5=D0=BA?= =?UTF-8?q?=D1=81=D1=82=D0=B0=20=D0=B4=D0=BB=D1=8F=20=D1=83=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BE=D1=82=D0=BA?= =?UTF-8?q?=D1=80=D1=8B=D1=82=D0=B8=D0=B5=D0=BC=20Command=20Palette=20?= =?UTF-8?q?=D0=B8=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D0=B8=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=B5=D1=91=20=D0=BE=D1=82=D0=BA=D1=80=D1=8B=D1=82=D0=B8=D1=8F?= =?UTF-8?q?=20=D1=87=D0=B5=D1=80=D0=B5=D0=B7=20=D0=BA=D0=BB=D0=B8=D0=BA.?= =?UTF-8?q?=20=D0=A3=D0=BB=D1=83=D1=87=D1=88=D0=B5=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=B2=D0=B7=D0=B0=D0=B8=D0=BC=D0=BE=D0=B4=D0=B5=D0=B9=D1=81?= =?UTF-8?q?=D1=82=D0=B2=D0=B8=D1=8F=20=D1=81=20=D0=BF=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D0=B5=D0=BC=20=D0=B8?= =?UTF-8?q?=20=D1=83=D0=BF=D1=80=D0=BE=D1=89=D0=B5=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=B4=D0=BE=D1=81=D1=82=D1=83=D0=BF=D0=B0=20=D0=BA=20=D1=84?= =?UTF-8?q?=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=BE=D0=BD=D0=B0=D0=BB=D1=83=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D0=BD=D0=BE=D0=B9=20=D0=BF?= =?UTF-8?q?=D0=B0=D0=BB=D0=B8=D1=82=D1=80=D1=8B.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/CommandPalette.jsx | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/frontend/src/components/CommandPalette.jsx b/frontend/src/components/CommandPalette.jsx index 10d8001..24ea182 100644 --- a/frontend/src/components/CommandPalette.jsx +++ b/frontend/src/components/CommandPalette.jsx @@ -17,6 +17,9 @@ import { * Command Palette - глобальный поиск по командам (Ctrl+K) * Простой подход со встроенным backdrop (как в HistoryModal) */ +// Создаем контекст для управления открытием/закрытием Command Palette +const CommandPaletteContext = { open: null }; + function CommandPalette() { const [isOpen, setIsOpen] = useState(false) const [searchTerm, setSearchTerm] = useState('') @@ -24,6 +27,14 @@ function CommandPalette() { const navigate = useNavigate() const inputRef = useRef(null) + // Сохраняем функцию открытия в контекст + useEffect(() => { + CommandPaletteContext.open = () => setIsOpen(true); + return () => { + CommandPaletteContext.open = null; + }; + }, []) + // Список команд const commands = [ { icon: IconHome, label: 'Главная', description: 'Панель управления', action: () => navigate('/dashboard'), keywords: ['главная', 'панель', 'dashboard'] }, @@ -185,4 +196,27 @@ function CommandPalette() { ) } +/** + * Кнопка для открытия Command Palette через клик + */ +export function KeyboardShortcutsButton({ className = '' }) { + const handleClick = (e) => { + e.preventDefault(); + if (CommandPaletteContext.open) { + CommandPaletteContext.open(); + } + }; + + return ( + + + + ); +} + export default CommandPalette