Skip to content

Commit

Permalink
Merge pull request #711 from AI4Bharat/cl_ui
Browse files Browse the repository at this point in the history
Cl UI
  • Loading branch information
ishvindersethi22 authored Sep 13, 2023
2 parents 3d557ba + 240e9c7 commit 92614bc
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ const AudioTranscriptionLandingPage = () => {
const [NextData, setNextData] = useState("");
const [showNotes, setShowNotes] = useState(false);
const [reviewNotesValue, setReviewNotesValue] = useState(null);
// const [annotationtext,setannotationtext] = useState('')
// const [reviewtext,setreviewtext] = useState('')
const [speakerBox, setSpeakerBox] = useState("");
const [annotations, setAnnotations] = useState([]);
const [stdTranscription, setStdTranscription] = useState("");
Expand All @@ -79,6 +81,8 @@ const AudioTranscriptionLandingPage = () => {
const [filterMessage, setFilterMessage] = useState(null);
const [disableBtns, setDisableBtns] = useState(false);
const [disableUpdataButton, setDisableUpdataButton] = useState(false);
const [annotationtext, setannotationtext] = useState('')
const [reviewtext, setreviewtext] = useState('')
const [taskData, setTaskData] = useState()
const [snackbar, setSnackbarInfo] = useState({
open: false,
Expand Down Expand Up @@ -592,13 +596,15 @@ const AudioTranscriptionLandingPage = () => {
const newDelta1 = reviewNotesRef.current.value != "" ? JSON.parse(reviewNotesRef.current.value) : "";
annotationNotesRef.current.getEditor().setContents(newDelta2);
reviewNotesRef.current.getEditor().setContents(newDelta1);
setannotationtext(annotationNotesRef.current.getEditor().getText())
setreviewtext(reviewNotesRef.current.getEditor().getText())
}
}, [AnnotationsTaskDetails]);

const resetNotes = () => {
setShowNotes(false);
annotationNotesRef.current.value = "";
reviewNotesRef.current.value = "";
annotationNotesRef.current.getEditor().setContents([]);
reviewNotesRef.current.getEditor().setContents([]);
};

useEffect(() => {
Expand Down Expand Up @@ -683,12 +689,12 @@ const AudioTranscriptionLandingPage = () => {
endIcon={showNotes ? <ArrowRightIcon /> : <ArrowDropDownIcon />}
variant="contained"
color={
reviewNotesRef.current?.value !== "" ? "success" : "primary"
reviewtext.trim().length === 0 ? "primary" : "success"
}
onClick={handleCollapseClick}
// style={{ marginBottom: "20px" }}
>
Notes {reviewNotesRef.current?.value !== "" && "*"}
Notes {reviewtext.trim().length === 0 ? "" : "*"}
</Button>


Expand Down Expand Up @@ -758,7 +764,7 @@ const AudioTranscriptionLandingPage = () => {
display: showNotes ? "block" : "none",
paddingBottom: "16px",
overflow: "auto",
height: "max-content"
height: "178px"
}}
>
<ReactQuill
Expand Down Expand Up @@ -855,4 +861,4 @@ const AudioTranscriptionLandingPage = () => {
</>
);
};
export default AudioTranscriptionLandingPage;
export default AudioTranscriptionLandingPage;
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ const ReviewAudioTranscriptionLandingPage = () => {
const [showNotes, setShowNotes] = useState(false);
const [annotationNotesValue, setAnnotationNotesValue] = useState(null);
const [disableSkip, setdisableSkip] = useState(false);
const [annotationtext,setannotationtext] = useState('')
const [reviewtext,setreviewtext] = useState('')
const [supercheckertext,setsupercheckertext] = useState('')
const [filterMessage, setFilterMessage] = useState(null);
const [disableBtns, setDisableBtns] = useState(false);
const [disableButton, setDisableButton] = useState(false);
Expand Down Expand Up @@ -658,6 +661,10 @@ const ReviewAudioTranscriptionLandingPage = () => {
annotationNotesRef.current.getEditor().setContents(newDelta2);
reviewNotesRef.current.getEditor().setContents(newDelta1);
superCheckerNotesRef.current.getEditor().setContents(newDelta3);
setannotationtext(annotationNotesRef.current.getEditor().getText())
setreviewtext(reviewNotesRef.current.getEditor().getText())
setsupercheckertext(superCheckerNotesRef.current.getEditor().getText())

} else {
let reviewerAnnotations = annotations.filter(
(annotation) => annotation.annotation_type === 2
Expand All @@ -678,10 +685,16 @@ const ReviewAudioTranscriptionLandingPage = () => {
(annotation) =>
annotation.parent_annotation === correctAnnotation.id
)?.supercheck_notes ?? "";
const newDelta1 = reviewNotesRef.current.value != "" ? JSON.parse(reviewNotesRef.current.value) : "";
const newDelta2 = annotationNotesRef.current.value != "" ? JSON.parse(annotationNotesRef.current.value) : "";
const newDelta3 = superCheckerNotesRef.current.value != "" ? JSON.parse(superCheckerNotesRef.current.value) : "";
annotationNotesRef.current.getEditor().setContents(newDelta2);
superCheckerNotesRef.current.getEditor().setContents(newDelta3);
reviewNotesRef.current.getEditor().setContents(newDelta1);
setannotationtext(annotationNotesRef.current.getEditor().getText())
setreviewtext(reviewNotesRef.current.getEditor().getText())
setsupercheckertext(superCheckerNotesRef.current.getEditor().getText())

} else {
reviewNotesRef.current.value =
reviewerAnnotations[0].review_notes ?? "";
Expand All @@ -701,6 +714,10 @@ const ReviewAudioTranscriptionLandingPage = () => {
annotationNotesRef.current.getEditor().setContents(newDelta2);
reviewNotesRef.current.getEditor().setContents(newDelta1);
superCheckerNotesRef.current.getEditor().setContents(newDelta3);
setannotationtext(annotationNotesRef.current.getEditor().getText())
setreviewtext(reviewNotesRef.current.getEditor().getText())
setsupercheckertext(superCheckerNotesRef.current.getEditor().getText())

}
} else {
let normalAnnotation = annotations.find(
Expand All @@ -717,6 +734,10 @@ const ReviewAudioTranscriptionLandingPage = () => {
annotationNotesRef.current.getEditor().setContents(newDelta2);
reviewNotesRef.current.getEditor().setContents(newDelta1);
superCheckerNotesRef.current.getEditor().setContents(newDelta3);
setannotationtext(annotationNotesRef.current.getEditor().getText())
setreviewtext(reviewNotesRef.current.getEditor().getText())
setsupercheckertext(superCheckerNotesRef.current.getEditor().getText())

}
}
}
Expand All @@ -729,10 +750,9 @@ const ReviewAudioTranscriptionLandingPage = () => {

const resetNotes = () => {
setShowNotes(false);
reviewNotesRef.current.value = "";
reviewNotesRef.current.getEditor().setContents([]);
};


useEffect(() => {
resetNotes();
}, [taskId]);
Expand Down Expand Up @@ -814,16 +834,17 @@ const ReviewAudioTranscriptionLandingPage = () => {
endIcon={showNotes ? <ArrowRightIcon /> : <ArrowDropDownIcon />}
variant="contained"
color={
annotationNotesRef.current?.value !== "" ||
superCheckerNotesRef.current?.value !== ""
? "success"
: "primary"
annotationtext.trim().length === 0 &&
supercheckertext.trim().length === 0
? "primary"
: "success"
}
onClick={handleCollapseClick}
>
Notes{" "}
{annotationNotesRef.current?.value !== "" ||
(superCheckerNotesRef.current?.value !== "" && "*")}
{annotationtext.trim().length === 0 &&
supercheckertext.trim().length === 0 ? "" : "*"}

</Button>

{/* <Alert severity="warning" showIcon style={{marginBottom: '1%'}}>
Expand Down Expand Up @@ -901,7 +922,7 @@ const ReviewAudioTranscriptionLandingPage = () => {
style={{
display: showNotes ? "block" : "none",
paddingBottom: "16px",
height: filterMessage === ""?"max-content":"175px", overflow: "auto"
height: "max-content", overflow: "auto"
}}
>
<ReactQuill
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const SuperCheckerAudioTranscriptionLandingPage = () => {
const [playing, setPlaying] = useState(false);
const [currentTime, setCurrentTime] = useState(0);
const [currentIndex, setCurrentIndex] = useState(-1);
const [annotationtext,setannotationtext] = useState('');
const [currentSubs, setCurrentSubs] = useState();
const [loadtime, setloadtime] = useState(new Date());
const [textBox, settextBox] = useState("");
Expand All @@ -72,6 +73,8 @@ const SuperCheckerAudioTranscriptionLandingPage = () => {
fontSize: "Normal"
});
const [disableSkip, setdisableSkip] = useState(false);
const [reviewtext,setreviewtext] = useState('');
const [supercheckertext,setsupercheckertext] = useState('');
const[taskDetailList,setTaskDetailList] = useState("")
const [snackbar, setSnackbarInfo] = useState({
open: false,
Expand All @@ -97,6 +100,7 @@ const SuperCheckerAudioTranscriptionLandingPage = () => {
const timeSpentIntervalRef = useRef(null);
const reviewNotesRef = useRef(null);
const superCheckerNotesRef = useRef(null);


// useEffect(() => {
// let intervalId;
Expand Down Expand Up @@ -569,6 +573,8 @@ const SuperCheckerAudioTranscriptionLandingPage = () => {
const newDelta1 = reviewNotesRef.current.value != "" ? JSON.parse(reviewNotesRef.current.value) : "";
reviewNotesRef.current.getEditor().setContents(newDelta1);
superCheckerNotesRef.current.getEditor().setContents(newDelta3);
setreviewtext(reviewNotesRef.current.getEditor().getText())
setsupercheckertext(superCheckerNotesRef.current.getEditor().getText())
} else {
let reviewerAnnotations = annotations.filter(
(value) => value?.annotation_type === 2
Expand All @@ -590,6 +596,8 @@ const SuperCheckerAudioTranscriptionLandingPage = () => {
const newDelta1 = reviewNotesRef.current.value != "" ? JSON.parse(reviewNotesRef.current.value) : "";
reviewNotesRef.current.getEditor().setContents(newDelta1);
superCheckerNotesRef.current.getEditor().setContents(newDelta3);
setreviewtext(reviewNotesRef.current.getEditor().getText())
setsupercheckertext(superCheckerNotesRef.current.getEditor().getText())
} else {
let superCheckerAnnotation = annotations.find(
(annotation) =>
Expand All @@ -603,6 +611,8 @@ const SuperCheckerAudioTranscriptionLandingPage = () => {
const newDelta1 = reviewNotesRef.current.value != "" ? JSON.parse(reviewNotesRef.current.value) : "";
reviewNotesRef.current.getEditor().setContents(newDelta1);
superCheckerNotesRef.current.getEditor().setContents(newDelta3);
setreviewtext(reviewNotesRef.current.getEditor().getText())
setsupercheckertext(superCheckerNotesRef.current.getEditor().getText())
}
}
}
Expand All @@ -616,8 +626,8 @@ const SuperCheckerAudioTranscriptionLandingPage = () => {

const resetNotes = () => {
setShowNotes(false);
superCheckerNotesRef.current.value = "";
reviewNotesRef.current.value = "";
reviewNotesRef.current.getEditor().setContents([]);
superCheckerNotesRef.current.getEditor().setContents([]);
};
const modules = {
toolbar: [
Expand Down Expand Up @@ -654,7 +664,7 @@ const SuperCheckerAudioTranscriptionLandingPage = () => {
};

return (
<>
<>
{loading && <Spinner />}
{renderSnackBar()}
<Grid container direction={"row"} className={classes.parentGrid}>
Expand Down Expand Up @@ -700,11 +710,11 @@ const SuperCheckerAudioTranscriptionLandingPage = () => {
endIcon={showNotes ? <ArrowRightIcon /> : <ArrowDropDownIcon />}
variant="contained"
color={
reviewNotesRef.current?.value !== "" ? "success" : "primary"
reviewtext.trim().length === 0 ? "primary" : "success"
}
onClick={handleCollapseClick}
>
Notes {reviewNotesRef.current?.value !== "" && "*"}
Notes {reviewtext.trim().length === 0 ? "" : "*"}
</Button>


Expand All @@ -731,7 +741,7 @@ const SuperCheckerAudioTranscriptionLandingPage = () => {
display: showNotes ? "block" : "none",
paddingBottom: "16px",
overflow:"auto",
height:"max-content"
height:"100px"
}}
>
{/* <Alert severity="warning" showIcon style={{marginBottom: '1%'}}>
Expand Down Expand Up @@ -795,7 +805,7 @@ const SuperCheckerAudioTranscriptionLandingPage = () => {
display: showStdTranscript ? "block" : "none",
paddingBottom: "16px",
overflow: "auto",
height: "max-content"
height: "100px"
}}
>
{stdTranscriptionSettings.enableTransliteration ? (
Expand Down Expand Up @@ -866,4 +876,4 @@ const SuperCheckerAudioTranscriptionLandingPage = () => {
</>
);
};
export default SuperCheckerAudioTranscriptionLandingPage;
export default SuperCheckerAudioTranscriptionLandingPage;
4 changes: 3 additions & 1 deletion src/ui/pages/container/Label-Studio/LSF.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,8 @@ export default function LSF() {
const reviewNotesRef = useRef(null);
const { taskId } = useParams();
const [taskData, setTaskData] = useState([]);
const [annotationtext,setannotationtext] = useState('')
const [reviewtext,setreviewtext] = useState('')
const [showTagsInput, setShowTagsInput] = useState(false);
const [selectedTag, setSelectedTag] = useState("");
const [alertData, setAlertData] = useState({
Expand Down Expand Up @@ -1056,7 +1058,7 @@ export default function LSF() {
endIcon={showNotes ? <ArrowRightIcon /> : <ArrowDropDownIcon />}
variant="contained"
color={
reviewNotesRef.current?.value !== "" ? "success" : "primary"
reviewtext.trim().length === 0 ? "primary" : "success"
}
onClick={handleCollapseClick}
// style={{ marginBottom: "20px" }}
Expand Down
Loading

0 comments on commit 92614bc

Please sign in to comment.