diff --git a/src/containers/Organization/Project/TaskList.jsx b/src/containers/Organization/Project/TaskList.jsx
index 496f073b..a2afadd5 100644
--- a/src/containers/Organization/Project/TaskList.jsx
+++ b/src/containers/Organization/Project/TaskList.jsx
@@ -165,6 +165,7 @@ const TaskList = () => {
const [searchedCol, setSearchedCol] = useState({});
const [searchedColumn, setSearchedColumn] = useState({});
const [columnDisplay, setColumnDisplay] = useState(false);
+ const [reOpenTaskId, setReOpenTaskId]= useState(null);
//Data from Redux
const { total_count: totalCount, tasks_list: taskList } = useSelector(
@@ -176,6 +177,51 @@ const TaskList = () => {
(state) => state.getPreviewData?.data
);
+ const reopenActionColumn = {
+ name: "Action",
+ label: "Actions",
+ options: {
+ filter: false,
+ sort: false,
+ align: "center",
+ setCellHeaderProps: () => ({
+ className: tableClasses.cellHeaderProps,
+ }),
+ customBodyRender: (_value, tableMeta) => {
+ const { tableData: data, rowIndex } = tableMeta;
+ const selectedTask = data[rowIndex];
+
+ return (
+
+
+
+ );
+ },
+ },
+ };
+
useEffect(() => {
const { progress, success, apiType, data } = apiStatus;
if (!progress) {
@@ -250,7 +296,7 @@ const TaskList = () => {
if (apiType === "REOPEN_TASK" && data.response) {
dispatch(setSnackBar({ open: false }));
handleDialogOpen("tableDialog");
- setTableDialogColumn(reopenTableColumns);
+ setTableDialogColumn([...reopenTableColumns,reopenActionColumn]);
setTableDialogMessage(data.message);
setTableDialogResponse(data.response);
}
@@ -669,6 +715,7 @@ const TaskList = () => {
case "Reopen":
const reopenObj = new ReopenTaskAPI(id);
dispatch(APITransport(reopenObj));
+ setReOpenTaskId(id)
break;
default:
diff --git a/src/containers/Organization/Video/RightPanel.jsx b/src/containers/Organization/Video/RightPanel.jsx
index 52e5571d..1267bca4 100644
--- a/src/containers/Organization/Video/RightPanel.jsx
+++ b/src/containers/Organization/Video/RightPanel.jsx
@@ -115,7 +115,9 @@ const RightPanel = ({ currentIndex, setCurrentIndex }) => {
if (!progress && success && apiType === "SAVE_TRANSCRIPT") {
if (!autoSave) {
- dispatch(setSnackBar({ open: false }));
+ setTimeout(() => {
+ dispatch(setSnackBar({ open: false }));
+ }, 1000);
}
if (complete) {
diff --git a/src/containers/Organization/Video/components/Metronome.jsx b/src/containers/Organization/Video/components/Metronome.jsx
index f9c192c6..8e1cb2c4 100644
--- a/src/containers/Organization/Video/components/Metronome.jsx
+++ b/src/containers/Organization/Video/components/Metronome.jsx
@@ -28,6 +28,7 @@ const findIndex = (subs, startTime) => {
export default React.memo(
function Component({ render, playing }) {
+ const taskDetails = useSelector((state) => state.getTaskDetails.data);
const classes = VideoLandingStyle();
const dispatch = useDispatch();
@@ -52,6 +53,7 @@ export default React.memo(
const onMouseDown = useCallback(
(event) => {
if (event.button !== 0) return;
+ if (taskDetails.task_type.includes("VOICEOVER")){return}
const clickTime = getEventTime(event);
setIsDroging(true);
setDrogStartTime(clickTime);
@@ -61,6 +63,7 @@ export default React.memo(
const onMouseMove = useCallback(
(event) => {
+ if (taskDetails.task_type.includes("VOICEOVER")){return}
if (isDroging) {
if (playing) player.pause();
setDrogEndTime(getEventTime(event));
@@ -70,6 +73,7 @@ export default React.memo(
);
const onDocumentMouseUp = useCallback(() => {
+ if (taskDetails.task_type.includes("VOICEOVER")){return}
if (isDroging) {
if (
drogStartTime > 0 &&
diff --git a/src/containers/Organization/Video/components/SubtitleBoxes.jsx b/src/containers/Organization/Video/components/SubtitleBoxes.jsx
index 2959d059..1050cd71 100644
--- a/src/containers/Organization/Video/components/SubtitleBoxes.jsx
+++ b/src/containers/Organization/Video/components/SubtitleBoxes.jsx
@@ -7,7 +7,6 @@ import React, {
} from "react";
import isEqual from "lodash/isEqual";
import DT from "duration-time-conversion";
-import { useParams } from "react-router-dom";
import { useDispatch, useSelector } from "react-redux";
import {
copySubs,
@@ -34,7 +33,6 @@ import C from "redux/constants";
import {
APITransport,
FetchTranscriptPayloadAPI,
- SaveTranscriptAPI,
setSubtitles,
} from "redux/actions";
@@ -48,6 +46,8 @@ function magnetically(time, closeTime) {
let lastTarget = null;
let lastSub = null;
+let previousTarget = null;
+let nextTarget = null;
let lastType = "";
let lastX = 0;
let lastIndex = -1;
@@ -57,7 +57,6 @@ let isDroging = false;
export default memo(
function ({ render, currentTime }) {
- const { taskId } = useParams();
const classes = VideoLandingStyle();
const dispatch = useDispatch();
@@ -103,20 +102,6 @@ export default memo(
// eslint-disable-next-line
}, [subtitles, currentIndex, isPlaying(player)]);
- const saveTranscript = async (taskType, subs = subtitles) => {
- const reqBody = {
- task_id: taskId,
- offset: currentPage,
- limit: limit,
- payload: {
- payload: subs,
- },
- };
-
- const obj = new SaveTranscriptAPI(reqBody, taskType);
- dispatch(APITransport(obj));
- };
-
const removeSub = useCallback(
(sub) => {
const index = hasSub(sub);
@@ -137,25 +122,32 @@ export default memo(
[limit, currentPage]
);
- const updateSub = (sub, obj) => {
- const index = hasSub(sub);
- const copySub = [...subtitles];
+ const updateSub = useCallback(
+ (sub, obj) => {
+ const index = hasSub(sub);
+ const copySub = [...subtitles];
- if (index < 0) return;
+ if (index <= 0) return;
+ if (taskDetails.task_type.includes("VOICEOVER")){return}
- Object.assign(sub, obj);
+ Object.assign(sub, obj);
- copySub[index] = sub;
- dispatch(setSubtitles(copySub, C.SUBTITLES));
- };
+ copySub[index] = sub;
+ dispatch(setSubtitles(copySub, C.SUBTITLES));
+ },
+ // eslint-disable-next-line
+ [subtitles]
+ );
- const onMouseDown = (sub, event, type) => {
- lastSub = sub;
+ const onMouseDown = (index, event, type) => {
+ previousTarget = $subsRef.current.children[index - 1];
+ lastSub = subtitles[index];
+ nextTarget = $subsRef.current.children[index + 1];
if (event.button !== 0) return;
isDroging = true;
lastType = type;
lastX = event.pageX;
- lastIndex = subtitles.indexOf(sub);
+ lastIndex = index;
lastTarget = $subsRef.current.children[lastIndex];
lastWidth = parseFloat(lastTarget.style.width);
};
@@ -189,7 +181,14 @@ export default memo(
lastSub.endTime + timeDiff,
next ? next.startTime : null
);
+
+ const nextCardStartTime = endTime;
+ const previousCardEndTime = startTime;
+
const width = (endTime - startTime) * 10 * gridGap;
+ const nextCardWidth = (next.endTime - nextCardStartTime) * 10 * gridGap;
+ const previousCardWidth =
+ (previousCardEndTime - previou?.startTime?previou.startTime:0) * 10 * gridGap;
if (lastType === "left") {
if (startTime >= 0 && lastSub.endTime - startTime >= 0.2) {
@@ -199,6 +198,12 @@ export default memo(
updateSub(lastSub, { start_time });
}
+ if(index > 0 && startTime < DT.t2d(previou.end_time) && startTime !== DT.t2d(previou.end_time)) {
+ updateSub(lastSub, { start_time });
+ updateSub(previou, { end_time: start_time });
+ previousTarget.style.width = `${previousCardWidth}px`;
+ }
+
if (index === 0) {
updateSub(lastSub, { start_time });
}
@@ -209,11 +214,26 @@ export default memo(
if (endTime >= 0 && endTime - lastSub.startTime >= 0.2) {
const end_time = DT.d2t(endTime);
- if (index >= 0 && index !== subtitles.length - 1 && endTime <= DT.t2d(next.start_time)) {
+ if (
+ index >= 0 &&
+ index !== subtitles.length - 1 &&
+ endTime <= DT.t2d(next.start_time)
+ ) {
+ updateSub(lastSub, { end_time });
+ }
+
+ if (
+ index >= 0 &&
+ index !== subtitles.length - 1 &&
+ endTime > DT.t2d(next.start_time) &&
+ endTime !== DT.t2d(next.start_time)
+ ) {
updateSub(lastSub, { end_time });
+ updateSub(next, { start_time: end_time });
+ nextTarget.style.width = `${nextCardWidth}px`;
}
- if(index === subtitles.length - 1 && endTime < lastSub.endTime) {
+ if (index === subtitles.length - 1 && endTime < lastSub.endTime) {
updateSub(lastSub, { end_time });
}
} else {
@@ -372,13 +392,13 @@ export default memo(
left: 0,
width: 10,
}}
- onMouseDown={(event) => onMouseDown(sub, event, "left")}
+ onMouseDown={(event) => onMouseDown(key, event, "left")}
>
onMouseDown(sub, event)}
+ onMouseDown={(event) => onMouseDown(key, event)}
>
{taskDetails.task_type.includes("TRANSCRIPTION") ||
@@ -394,7 +414,7 @@ export default memo(
right: 0,
width: 10,
}}
- onMouseDown={(event) => onMouseDown(sub, event, "right")}
+ onMouseDown={(event) => onMouseDown(key, event, "right")}
>
{sub.duration}
diff --git a/src/redux/actions/api/Project/ReopenTask.js b/src/redux/actions/api/Project/ReopenTask.js
index 19401440..a82f353e 100644
--- a/src/redux/actions/api/Project/ReopenTask.js
+++ b/src/redux/actions/api/Project/ReopenTask.js
@@ -3,14 +3,15 @@ import ENDPOINTS from "../../../../config/apiendpoint";
import C from "../../../constants";
export default class ReopenTaskAPI extends API {
- constructor(id, timeout = 2000) {
+ constructor(id, delete_voiceover_and_reopen=false, timeout = 2000) {
super("POST", timeout, false);
this.type = C.REOPEN_TASK;
+ this.delete_and_reopen=delete_voiceover_and_reopen;
this.id = id;
this.endpoint = `${super.apiEndPointAuto()}${
ENDPOINTS.task
- }${id}/reopen_translation_task/`;
+ }${id}/reopen_translation_task/?delete_voiceover_and_reopen=${delete_voiceover_and_reopen}`;
}
processResponse(res) {