Skip to content

Commit

Permalink
Merge pull request #511 from AI4Bharat/badsentances_display_for_trans…
Browse files Browse the repository at this point in the history
…cription

display bad sentances on transcription complete
  • Loading branch information
AlpanaMajhi authored Nov 29, 2023
2 parents ac8f8e3 + 92a8148 commit af6b3a8
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 14 deletions.
4 changes: 4 additions & 0 deletions src/config/tableColumns.js
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,10 @@ export const failInfoColumns = [
name: "target_text",
label: "Target Text",
},
{
name: "issue_type",
label: "Issue Type",
},
];

export const failTranscriptionInfoColumns = [
Expand Down
84 changes: 70 additions & 14 deletions src/containers/Organization/Video/RightPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {
import {
ConfirmDialog,
ShortcutKeys,
TableDialog,
TagsSuggestionList,
TimeBoxes,
} from "common";
Expand All @@ -52,11 +53,14 @@ import C from "redux/constants";
import {
APITransport,
FetchTranscriptPayloadAPI,
FetchTaskFailInfoAPI,
SaveTranscriptAPI,
setSnackBar,
setSubtitles,
} from "redux/actions";

import { failInfoColumns } from "config";

const RightPanel = ({ currentIndex, setCurrentIndex }) => {
const { taskId } = useParams();
const classes = VideoLandingStyle();
Expand Down Expand Up @@ -110,23 +114,59 @@ const RightPanel = ({ currentIndex, setCurrentIndex }) => {
const [complete, setComplete] = useState(false);
const [autoSave, setAutoSave] = useState(false);

const [openInfoDialog, setOpenInfoDialog] = useState(false);
const [tableDialogMessage, setTableDialogMessage] = useState("");
const [tableDialogResponse, setTableDialogResponse] = useState([]);
const [tableDialogColumn, setTableDialogColumn] = useState([]);

useEffect(() => {
const { progress, success, apiType } = apiStatus;
const { progress, success, apiType, data } = apiStatus;

if (!progress) {
if (success) {
switch (apiType) {
case "SAVE_TRANSCRIPT":
if (!autoSave) {
setTimeout(() => {
dispatch(setSnackBar({ open: false }));
}, 1000);
}
if (complete) {
setTimeout(() => {
navigate(
`/my-organization/${assignedOrgId}/project/${taskData?.project}`
);
setComplete(false);
}, 2000);
}
break;

if (!progress && success && apiType === "SAVE_TRANSCRIPT") {
if (!autoSave) {
setTimeout(() => {
dispatch(setSnackBar({ open: false }));
}, 1000);
}
case "GET_TASK_FAIL_INFO":
setOpenInfoDialog(true);
setTableDialogColumn(failInfoColumns.filter((col)=>col.name!='target_text'));
setTableDialogMessage(data.message);
setTableDialogResponse(data.data);
break;

if (complete) {
setTimeout(() => {
navigate(
`/my-organization/${assignedOrgId}/project/${taskData?.project}`
);
setComplete(false);
}, 2000);
default:
break;
}
} else {
switch (apiType) {
case "SAVE_TRANSCRIPT":
setOpenConfirmDialog(false);

if (complete) {
setOpenInfoDialog(true);
setTableDialogColumn(failInfoColumns.filter((col)=>col.name!='target_text'));
setTableDialogMessage(data.message);
setTableDialogResponse(data.data);
}
break;

default:
break;
}
}
}

Expand Down Expand Up @@ -278,6 +318,11 @@ const RightPanel = ({ currentIndex, setCurrentIndex }) => {
}
};

const handleInfoButtonClick = async () => {
const apiObj = new FetchTaskFailInfoAPI(taskId);
dispatch(APITransport(apiObj));
};

const onMergeClick = useCallback(
(index) => {
const selectionStart = getSelectionStart(index);
Expand Down Expand Up @@ -571,6 +616,7 @@ const RightPanel = ({ currentIndex, setCurrentIndex }) => {
handleSuperscript={handleSuperscript}
showPopOver={showPopOver}
showSplit={true}
handleInfoButtonClick={handleInfoButtonClick}
/>
</Grid>

Expand Down Expand Up @@ -765,6 +811,16 @@ const RightPanel = ({ currentIndex, setCurrentIndex }) => {
/>
)}

{openInfoDialog && (
<TableDialog
openDialog={openInfoDialog}
handleClose={() => setOpenInfoDialog(false)}
message={tableDialogMessage}
response={tableDialogResponse}
columns={tableDialogColumn}
/>
)}

{Boolean(tagSuggestionsAnchorEl) && (
<TagsSuggestionList
tagSuggestionsAnchorEl={tagSuggestionsAnchorEl}
Expand Down

0 comments on commit af6b3a8

Please sign in to comment.