From 237a0de8b686f2703b8827641d55e152f86de949 Mon Sep 17 00:00:00 2001 From: Marco Beretta <81851188+berry-13@users.noreply.github.com> Date: Wed, 17 Jul 2024 16:08:13 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=84=20feat:=20chat=20direction=20(LTR-?= =?UTF-8?q?RTL)=20(#3260)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: chat direction * fix: FileRow * feat: smooth trigger transition --- .../components/Chat/Input/AudioRecorder.tsx | 10 ++- client/src/components/Chat/Input/ChatForm.tsx | 15 ++++- .../Chat/Input/Files/AttachFile.tsx | 12 +++- .../components/Chat/Input/Files/FileRow.tsx | 10 ++- .../src/components/Chat/Input/SendButton.tsx | 62 ++++++++++--------- .../src/components/Chat/Input/StopButton.tsx | 11 +++- client/src/components/Nav/Settings.tsx | 20 +++--- .../{Messages/Messages.tsx => Chat/Chat.tsx} | 10 ++- .../Nav/SettingsTabs/Chat/ChatDirection.tsx | 31 ++++++++++ .../{Messages => Chat}/EnterToSend.tsx | 0 .../{Messages => Chat}/ForkSettings.tsx | 0 .../{Messages => Chat}/SaveDraft.tsx | 0 .../{Messages => Chat}/ShowCodeSwitch.tsx | 0 .../src/components/Nav/SettingsTabs/index.ts | 2 +- client/src/components/ui/TextareaAutosize.tsx | 6 +- client/src/hooks/Input/useTextarea.ts | 2 +- client/src/localization/languages/Ar.ts | 5 -- client/src/localization/languages/De.ts | 5 -- client/src/localization/languages/Eng.ts | 3 +- client/src/localization/languages/Es.ts | 5 -- client/src/localization/languages/Fr.ts | 5 -- client/src/localization/languages/It.ts | 5 -- client/src/localization/languages/Jp.ts | 5 -- client/src/localization/languages/Ko.ts | 5 -- client/src/localization/languages/Ru.ts | 5 -- client/src/localization/languages/Zh.ts | 5 -- .../localization/languages/ZhTraditional.ts | 5 -- .../localization/prompts/instructions/It.md | 4 -- client/src/store/settings.ts | 1 + client/src/style.css | 3 +- packages/data-provider/src/config.ts | 4 +- 31 files changed, 145 insertions(+), 111 deletions(-) rename client/src/components/Nav/SettingsTabs/{Messages/Messages.tsx => Chat/Chat.tsx} (73%) create mode 100644 client/src/components/Nav/SettingsTabs/Chat/ChatDirection.tsx rename client/src/components/Nav/SettingsTabs/{Messages => Chat}/EnterToSend.tsx (100%) rename client/src/components/Nav/SettingsTabs/{Messages => Chat}/ForkSettings.tsx (100%) rename client/src/components/Nav/SettingsTabs/{Messages => Chat}/SaveDraft.tsx (100%) rename client/src/components/Nav/SettingsTabs/{Messages => Chat}/ShowCodeSwitch.tsx (100%) diff --git a/client/src/components/Chat/Input/AudioRecorder.tsx b/client/src/components/Chat/Input/AudioRecorder.tsx index dd088ea3c8..1fbb3cc61b 100644 --- a/client/src/components/Chat/Input/AudioRecorder.tsx +++ b/client/src/components/Chat/Input/AudioRecorder.tsx @@ -4,16 +4,19 @@ import { ListeningIcon, Spinner } from '~/components/svg'; import { useLocalize, useSpeechToText } from '~/hooks'; import { useChatFormContext } from '~/Providers'; import { globalAudioId } from '~/common'; +import { cn } from '~/utils'; export default function AudioRecorder({ textAreaRef, methods, ask, + isRTL, disabled, }: { textAreaRef: React.RefObject; methods: ReturnType; ask: (data: { text: string }) => void; + isRTL: boolean; disabled: boolean; }) { const localize = useLocalize(); @@ -77,7 +80,12 @@ export default function AudioRecorder({ - - - {localize('com_nav_send_message')} - - - - ); - }), + forwardRef( + (props: { disabled: boolean; isRTL: boolean }, ref: React.ForwardedRef) => { + const localize = useLocalize(); + return ( + + + + + + + {localize('com_nav_send_message')} + + + + ); + }, + ), ); const SendButton = React.memo( forwardRef((props: SendButtonProps, ref: React.ForwardedRef) => { const data = useWatch({ control: props.control }); - return ; + return ; }), ); diff --git a/client/src/components/Chat/Input/StopButton.tsx b/client/src/components/Chat/Input/StopButton.tsx index 125ca1ea25..28ac9bbff5 100644 --- a/client/src/components/Chat/Input/StopButton.tsx +++ b/client/src/components/Chat/Input/StopButton.tsx @@ -1,6 +1,13 @@ -export default function StopButton({ stop, setShowStopButton }) { +import { cn } from '~/utils'; + +export default function StopButton({ stop, setShowStopButton, isRTL }) { return ( -
+