diff --git a/src/config/tableColumns.js b/src/config/tableColumns.js index b5baf9c2..2b763130 100644 --- a/src/config/tableColumns.js +++ b/src/config/tableColumns.js @@ -524,6 +524,10 @@ export const failInfoColumns = [ name: "target_text", label: "Target Text", }, + { + name: "issue_type", + label: "Issue Type", + }, ]; export const failTranscriptionInfoColumns = [ diff --git a/src/containers/Organization/Video/RightPanel.jsx b/src/containers/Organization/Video/RightPanel.jsx index 1267bca4..abd27a6c 100644 --- a/src/containers/Organization/Video/RightPanel.jsx +++ b/src/containers/Organization/Video/RightPanel.jsx @@ -40,6 +40,7 @@ import { import { ConfirmDialog, ShortcutKeys, + TableDialog, TagsSuggestionList, TimeBoxes, } from "common"; @@ -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(); @@ -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; + } } } @@ -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); @@ -571,6 +616,7 @@ const RightPanel = ({ currentIndex, setCurrentIndex }) => { handleSuperscript={handleSuperscript} showPopOver={showPopOver} showSplit={true} + handleInfoButtonClick={handleInfoButtonClick} /> @@ -765,6 +811,16 @@ const RightPanel = ({ currentIndex, setCurrentIndex }) => { /> )} + {openInfoDialog && ( + setOpenInfoDialog(false)} + message={tableDialogMessage} + response={tableDialogResponse} + columns={tableDialogColumn} + /> + )} + {Boolean(tagSuggestionsAnchorEl) && (