From ed65abdb6d196ac363ae2c6bd9f759dd60ac75f5 Mon Sep 17 00:00:00 2001 From: sagarika-padmanaban Date: Fri, 5 Jul 2024 20:02:49 +0530 Subject: [PATCH 1/2] added new changes --- src/app/ui/pages/chat/AnnotatePage.jsx | 4 +-- .../pages/chat/InstructionDrivenChatPage.js | 9 ++---- src/app/ui/pages/chat/ReviewPage.jsx | 4 +-- src/app/ui/pages/chat/SuperCheckerPage.jsx | 4 +-- src/components/Chat/TextArea.jsx | 16 +++++++--- src/components/Project/BasicSettings.jsx | 11 +++++-- src/components/Project/TaskTable.jsx | 30 ++++++++++++++++--- src/components/common/Header.jsx | 7 +++-- src/components/common/Search.jsx | 15 ++++++++-- src/utils/Chatlang.js | 7 +++++ 10 files changed, 80 insertions(+), 27 deletions(-) create mode 100644 src/utils/Chatlang.js diff --git a/src/app/ui/pages/chat/AnnotatePage.jsx b/src/app/ui/pages/chat/AnnotatePage.jsx index 3c25536e..c509f10d 100644 --- a/src/app/ui/pages/chat/AnnotatePage.jsx +++ b/src/app/ui/pages/chat/AnnotatePage.jsx @@ -688,7 +688,7 @@ const AnnotatePage = () => { }} > diff --git a/src/app/ui/pages/chat/InstructionDrivenChatPage.js b/src/app/ui/pages/chat/InstructionDrivenChatPage.js index 2103b70d..739441dd 100644 --- a/src/app/ui/pages/chat/InstructionDrivenChatPage.js +++ b/src/app/ui/pages/chat/InstructionDrivenChatPage.js @@ -28,6 +28,7 @@ import { gruvboxDark } from "react-syntax-highlighter/dist/esm/styles/prism"; import PatchAnnotationAPI from "@/app/actions/api/Dashboard/PatchAnnotations"; import GetTaskAnnotationsAPI from "@/app/actions/api/Dashboard/GetTaskAnnotationsAPI"; import { Block } from "@mui/icons-material"; +import ChatLang from "@/utils/Chatlang"; const useStyles = makeStyles((theme) => ({ tooltip: { @@ -91,6 +92,7 @@ const InstructionDrivenChatPage = ({ const handleClose = () => { setOpen(false); }; + const renderSnackBar = () => { @@ -522,7 +524,7 @@ const InstructionDrivenChatPage = ({ {translate("modal.language")} - {info.meta_info_language} + {ChatLang[info.meta_info_language]} diff --git a/src/app/ui/pages/chat/SuperCheckerPage.jsx b/src/app/ui/pages/chat/SuperCheckerPage.jsx index cfd96d48..b96ebea7 100644 --- a/src/app/ui/pages/chat/SuperCheckerPage.jsx +++ b/src/app/ui/pages/chat/SuperCheckerPage.jsx @@ -787,7 +787,7 @@ const SuperCheckerPage = () => { }} > diff --git a/src/components/Chat/TextArea.jsx b/src/components/Chat/TextArea.jsx index a8e6ff79..5ddebcbc 100644 --- a/src/components/Chat/TextArea.jsx +++ b/src/components/Chat/TextArea.jsx @@ -36,10 +36,18 @@ export default function Textarea({ /* eslint-disable react-hooks/exhaustive-deps */ const [text, setText] = useState(""); - const targetLang = localStorage.getItem("language") || "en"; - const globalTransliteration = - localStorage.getItem("globalTransliteration") === "true" ? true : false; + const [targetLang, setTargetLang] = useState( localStorage.getItem("language")); + const [globalTransliteration, setGlobalTransliteration] = useState(localStorage.getItem("globalTransliteration")); + useEffect(() => { + const storedGlobalTransliteration = localStorage.getItem("globalTransliteration"); + const storedLanguage = localStorage.getItem("language") ; + setGlobalTransliteration(storedGlobalTransliteration); + setTargetLang(storedLanguage); + console.log(typeof(globalTransliteration),typeof(localStorage.getItem("globalTransliteration"))); + }, [text]); + + useEffect(() => { if (text != "") { handleOnchange(text); @@ -125,7 +133,7 @@ export default function Textarea({ width={grid_size} className={class_name} > - {globalTransliteration ? ( + {globalTransliteration==="true"? ( (