mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 01:10:14 +01:00
* chore: Add EnterToSend, Translation Portuguese Brazilian Update * Inverted selection and corrected translation * fix: removed Trailing spaces not allowed * feat: Refactor key event handler & updated translations * fix: removed return; & updated files translations * fix: duplicate switchs on General.tsx * fix: added again switch * refactor(useTextarea): limit refactoring of handleKeyDown * refactor: correct keyDown handler and add English localization --------- Co-authored-by: Raí Santos <140329135+itzraiss@users.noreply.github.com> Co-authored-by: Raí Santos <raimorningstarchristus@gmail.com>
33 lines
No EOL
914 B
TypeScript
33 lines
No EOL
914 B
TypeScript
import { useRecoilState } from 'recoil';
|
|
import { Switch } from '~/components/ui/Switch';
|
|
import useLocalize from '~/hooks/useLocalize';
|
|
import store from '~/store';
|
|
|
|
export default function SendMessageKeyEnter({
|
|
onCheckedChange,
|
|
}: {
|
|
onCheckedChange?: (value: boolean) => void;
|
|
}) {
|
|
const [enterToSend, setEnterToSend] = useRecoilState<boolean>(store.enterToSend);
|
|
const localize = useLocalize();
|
|
|
|
const handleCheckedChange = (value: boolean) => {
|
|
setEnterToSend(value);
|
|
if (onCheckedChange) {
|
|
onCheckedChange(value);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<div className="flex items-center justify-between">
|
|
<div> {localize('com_nav_enter_to_send')} </div>
|
|
<Switch
|
|
id="enterToSend"
|
|
checked={enterToSend}
|
|
onCheckedChange={handleCheckedChange}
|
|
className="ml-4 mt-2"
|
|
data-testid="enterToSend"
|
|
/>
|
|
</div>
|
|
);
|
|
} |