From 01a88991aba0c890bdfd4d89d520c33866b319e7 Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Tue, 6 Aug 2024 22:18:07 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=9B=EF=B8=8F=20refactor:=20Add=20keybo?= =?UTF-8?q?ard=20command=20toggles=20&=20only=20trigger=20for=20the=201st?= =?UTF-8?q?=20character=20(#3566)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: Improve handling of key up events in useHandleKeyUp hook to only trigger for first char and fix linter issues * refactor: Update Beta component styling with theme twcss variables * refactor: theming for Settings, add toggle enable/disable keyboard commands --- client/src/components/Nav/Settings.tsx | 90 ++++++++++--------- .../components/Nav/SettingsTabs/Beta/Beta.tsx | 6 +- .../SettingsTabs/Commands/AtCommandSwitch.tsx | 26 ++++++ .../Nav/SettingsTabs/Commands/Commands.tsx | 30 +++++++ .../Commands/PlusCommandSwitch.tsx | 26 ++++++ .../Commands/SlashCommandSwitch.tsx | 26 ++++++ .../src/components/Nav/SettingsTabs/index.ts | 1 + client/src/hooks/Input/useHandleKeyUp.ts | 40 +++++---- client/src/localization/languages/Eng.ts | 12 +++ client/src/mobile.css | 22 ++++- client/src/store/settings.ts | 5 ++ packages/data-provider/src/config.ts | 4 + 12 files changed, 224 insertions(+), 64 deletions(-) create mode 100644 client/src/components/Nav/SettingsTabs/Commands/AtCommandSwitch.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Commands/Commands.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Commands/PlusCommandSwitch.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Commands/SlashCommandSwitch.tsx diff --git a/client/src/components/Nav/Settings.tsx b/client/src/components/Nav/Settings.tsx index b01c9b811a..f69fb3b7da 100644 --- a/client/src/components/Nav/Settings.tsx +++ b/client/src/components/Nav/Settings.tsx @@ -1,17 +1,10 @@ import * as Tabs from '@radix-ui/react-tabs'; -import { MessageSquare } from 'lucide-react'; +import { MessageSquare, Command } from 'lucide-react'; import { SettingsTabValues } from 'librechat-data-provider'; import type { TDialogProps } from '~/common'; -import { - Button, - Dialog, - DialogPanel, - DialogTitle, - Transition, - TransitionChild, -} from '@headlessui/react'; +import { Dialog, DialogPanel, DialogTitle, Transition, TransitionChild } from '@headlessui/react'; import { GearIcon, DataIcon, SpeechIcon, UserIcon, ExperimentIcon } from '~/components/svg'; -import { General, Chat, Speech, Beta, Data, Account } from './SettingsTabs'; +import { General, Chat, Speech, Beta, Commands, Data, Account } from './SettingsTabs'; import { useMediaQuery, useLocalize } from '~/hooks'; import { cn } from '~/utils'; @@ -30,7 +23,7 @@ export default function Settings({ open, onOpenChange }: TDialogProps) { leaveFrom="opacity-100" leaveTo="opacity-0" > -