Skip to content

Commit

Permalink
Merge pull request #135 from AI4Bharat/test
Browse files Browse the repository at this point in the history
Test
  • Loading branch information
aparna-aa authored Jul 8, 2024
2 parents 57ce926 + 09c5422 commit a01339e
Show file tree
Hide file tree
Showing 11 changed files with 81 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/app/progress/progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default function ProgressPage () {
<Grid item xs={12} sm={12} md={12} lg={12} xl={12} sx={{ p: 2 }}>
<Paper variant="outlined" sx={{ minWidth: 275, borderRadius: "5px" ,backgroundColor:'ButtonHighlight', textAlign:'center'}}>
<CardContent>
<Typography variant="h4">{userDetails?.organization.title}</Typography>
<Typography variant="h4">{userDetails?.organization?.title}</Typography>
</CardContent>
</Paper>
</Grid>
Expand Down
4 changes: 2 additions & 2 deletions src/app/ui/pages/chat/AnnotatePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ const AnnotatePage = () => {
}}
>
<Button
value="Back to Project"
value="Back to Previous Page"
startIcon={<ArrowBackIcon />}
variant="contained"
color="primary"
Expand All @@ -699,7 +699,7 @@ const AnnotatePage = () => {
navigate(-1);
}}
>
Back to Project
Back to Previous Page
</Button>
</Box>
</Grid>
Expand Down
9 changes: 3 additions & 6 deletions src/app/ui/pages/chat/InstructionDrivenChatPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -91,6 +92,7 @@ const InstructionDrivenChatPage = ({
const handleClose = () => {
setOpen(false);
};



const renderSnackBar = () => {
Expand Down Expand Up @@ -522,7 +524,7 @@ const InstructionDrivenChatPage = ({
{translate("modal.language")}
</Typography>
<Typography variant="subtitle1" id="child-modal-description">
{info.meta_info_language}
{ChatLang[info.meta_info_language]}
</Typography>

<Button variant="outlined" onClick={handleClose}>
Expand Down Expand Up @@ -569,11 +571,6 @@ const InstructionDrivenChatPage = ({
{translate("typography.instructions")}
</Typography>

{/* <Tooltip title="Hint and Metadata">
<IconButton onClick={handleOpen}>
<TipsAndUpdatesIcon color="primary.dark" fontSize="large" />
</IconButton>
</Tooltip> */}

<Tooltip
title={
Expand Down
4 changes: 2 additions & 2 deletions src/app/ui/pages/chat/ReviewPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ const ReviewPage = () => {
}}
>
<Button
value="Back to Project"
value="Back to Previous Page"
startIcon={<ArrowBackIcon />}
variant="contained"
color="primary"
Expand All @@ -973,7 +973,7 @@ const ReviewPage = () => {
//window.location.reload();
}}
>
Back to Project
Back to Previous Page
</Button>
</Box>
</Grid>
Expand Down
4 changes: 2 additions & 2 deletions src/app/ui/pages/chat/SuperCheckerPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ const SuperCheckerPage = () => {
}}
>
<Button
value="Back to Project"
value="Back to Previous Page"
startIcon={<ArrowBackIcon />}
variant="contained"
color="primary"
Expand All @@ -799,7 +799,7 @@ const SuperCheckerPage = () => {
//window.location.reload();
}}
>
Back to Project
Back to Previous Page
</Button>
</Box>
</Grid>
Expand Down
16 changes: 12 additions & 4 deletions src/components/Chat/TextArea.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -125,7 +133,7 @@ export default function Textarea({
width={grid_size}
className={class_name}
>
{globalTransliteration ? (
{globalTransliteration==="true"? (
<IndicTransliterate
renderComponent={(props) => (
<textarea
Expand Down
11 changes: 9 additions & 2 deletions src/components/Project/BasicSettings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import CustomizedSnackbars from "../common/Snackbar";
import Spinner from "../common/Spinner";
import {fetchLanguages} from "@/Lib/Features/fetchLanguages";
import GetSaveButtonAPI from "@/app/actions/api/Projects/getSaveButtonAPI";
import getWorkspaceDetails from "@/Lib/Features/getWorkspaceDetails";
import getWorkspaceDetails, { fetchWorkspaceDetails } from "@/Lib/Features/getWorkspaceDetails";
import { FetchLoggedInUserData } from "@/Lib/Features/getLoggedInData";


Expand Down Expand Up @@ -42,7 +42,14 @@ const BasicSettings = (props) => {

const isManager = workspaceManagers?.some(manager => manager.id === loggedInUserData.id);


const getWorkspaceDetails = ()=>{
dispatch(fetchWorkspaceDetails(ProjectDetails?.workspace_id));
}


useEffect(()=>{
getWorkspaceDetails();
},[]);
console.log(loggedInUserData.id);
const getLoggedInUserData = () => {
dispatch(FetchLoggedInUserData("me"));
Expand Down
30 changes: 26 additions & 4 deletions src/components/Project/TaskTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import { fetchFindAndReplaceWordsInAnnotation } from "@/Lib/Features/projects/ge
import { setTaskFilter } from "@/Lib/Features/projects/getTaskFilter";
import FindAndReplaceDialog from "./FindAndReplaceDialog";
import LoginAPI from "@/app/actions/api/user/Login";
import ChatLang from "@/utils/Chatlang";
// import LoginAPI from "../../../../redux/actions/api/UserManagement/Login";


Expand Down Expand Up @@ -102,7 +103,15 @@ const TaskTable = (props) => {
const ProjectDetails = useSelector((state) => state.getProjectDetails?.data);
const userDetails = useSelector((state) => state.getLoggedInData?.data);
const savedFilters = JSON.parse(localStorage.getItem('filters'));

const columnsCheck = [
{ name: 'id', label: 'ID', defaultChecked: true },
{ name: 'instructionData', label: 'Instruction Data', defaultChecked: true },
{ name: 'language', label: 'Language', defaultChecked: true },
{ name: 'status', label: 'Status', defaultChecked: true },
{ name: 'otherColumn1', label: 'Other Column 1', defaultChecked: false },
{ name: 'otherColumn2', label: 'Other Column 2', defaultChecked: false },
// Add other columns as needed
];

const filterData = {
Status: ((ProjectDetails.project_stage == 2||ProjectDetails.project_stage == 3) || ProjectDetails?.annotation_reviewers?.some((reviewer) => reviewer.id === userDetails?.id))
Expand Down Expand Up @@ -435,7 +444,12 @@ const TaskTable = (props) => {
row.push(
...Object.keys(el.data)
.filter((key) => !excludeCols.includes(key))
.map((key) => el.data[key])
.map((key) => {
if (key === "meta_info_language") {
return ChatLang[el.data[key]] || el.data[key];
}
return el.data[key];
})
);
props.type === "annotation" &&
taskList[0].annotation_status &&
Expand Down Expand Up @@ -497,17 +511,25 @@ const TaskTable = (props) => {
const annotatorEmail = taskList[0]?.hasOwnProperty("annotator_mail")
const email = props.type === "review" && annotatorEmail ? "Annotator Email" : "";
let colList = ["id", ...(!!email ? [email] : [])];
console.log(colList,taskList[0]);
colList.push(
...Object.keys(taskList[0].data).filter(
(el) => !excludeCols.includes(el)
)
);
taskList[0].task_status && colList.push("status");
colList.push("actions");
var defaultCheckedCols = ["id", "instruction_data", "meta_info_language", "status","actions"]
const metaInfoMapping = {
meta_info_language: "language",
meta_info_domain: "domain",
meta_info_intent: "intent"
};
const cols = colList.map((col) => {
return {
name: col,
label: snakeToTitleCase(col),
label: metaInfoMapping[col] ? snakeToTitleCase(metaInfoMapping[col]) : snakeToTitleCase(col),
defaultChecked: defaultCheckedCols.includes(col),
options: {
filter: false,
sort: false,
Expand All @@ -517,7 +539,7 @@ const TaskTable = (props) => {
};
});
setColumns(cols);
setSelectedColumns(colList);
setSelectedColumns(ProjectDetails?.project_type=="InstructionDrivenChat"?colList.filter(col => defaultCheckedCols.includes(col)):colList);
setTasks(data);
} else {
setTasks([]);
Expand Down
7 changes: 5 additions & 2 deletions src/components/common/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -830,9 +830,12 @@ const handleopenproject=(id,type)=>{
const [language, setLanguage] = useState(localStorage.getItem("language") || "");

useEffect(() => {
localStorage.setItem("globalTransliteration", globalTransliteration);
localStorage.setItem("language", language);
}, [language, globalTransliteration]);
}, [language]);
useEffect(() => {
localStorage.setItem("globalTransliteration", globalTransliteration);
}, [ globalTransliteration]);


return (
<Grid container direction="row" style={{ zIndex: 1 }}>
Expand Down
15 changes: 12 additions & 3 deletions src/components/common/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,25 @@ const Search = (props) => {
dispatch(setSearchProjectCard(value));
};

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(globalTransliteration,localStorage.getItem("globalTransliteration"));
}, [searchValue]);


return (
<Grid container justifyContent="end" sx={{marginTop:"20px"}}>
<Grid className="search">
<Grid className="searchIcon">
<SearchIcon fontSize="small" />
</Grid>
{globalTransliteration ?
{globalTransliteration=="true" ?
<IndicTransliterate
renderComponent={(props) => (
<textarea
Expand Down
7 changes: 7 additions & 0 deletions src/utils/Chatlang.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const ChatLang ={
1: "English",
2: "Indic language in Indic script",
3: "Indic language in Latin script",
4: "Indic/English Latin script",
}
export default ChatLang;

0 comments on commit a01339e

Please sign in to comment.