Skip to content

Commit

Permalink
fixing lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeybird248 committed Nov 20, 2024
1 parent 990ba5b commit 2039e97
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/screens/Watch/Components/Transcriptions/CaptionLine/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,10 @@ function CaptionLine({ caption = {}, allowEdit, dispatch, fontSize }) {

validateTimeFormat(updatedBeginTime);
validateTimeFormat(updatedEndTime);

dispatch({
type: 'watch/saveCaption',
payload: { caption, text: newText, begin: updatedBeginTime, end: updatedEndTime },
});

setTimeString(prettierTimeStr(updatedBeginTime));
setEndTimeString(prettierTimeStr(updatedEndTime));
// eslint-disable-next-line no-console
Expand All @@ -69,22 +67,23 @@ function CaptionLine({ caption = {}, allowEdit, dispatch, fontSize }) {
} catch (error) {
// eslint-disable-next-line no-console
console.error("Error during save:", error.message);
alert('Please enter a valid time format (HH:MM:SS, MM:SS, or HH:MM:SS.SSS)');
alert('Please enter a valid time format (HH:MM:SS, MM:SS, or HH:MM:SS.SSS)'); // eslint-disable-line no-alert
}
};

const handleBlur = (ref, originalValue, setFullTime) => {
if (ref.current) {
const elementId = ref.current?.id || "";
const currentValue = ref.current.innerText;

if (elementId.includes("time")) {
// time
try {
validateTimeFormat(currentValue);
setFullTime((prev) => {
// eslint-disable-next-line no-console
console.log("Updating time:", currentValue);
// eslint-disable-next-line no-console
console.log(`${prev}`);
return currentValue;
});
ref.current.innerText = prettierTimeStr(currentValue);
Expand Down Expand Up @@ -126,7 +125,6 @@ function CaptionLine({ caption = {}, allowEdit, dispatch, fontSize }) {
console.log("Element ID:", elementId);
// eslint-disable-next-line no-console
console.log("Current time value from input:", currentTime);

if (elementId.includes("time")) {
// time
try {
Expand All @@ -139,11 +137,10 @@ function CaptionLine({ caption = {}, allowEdit, dispatch, fontSize }) {
} else {
handleSave(currentTime, fullEndTime);
}

} catch (error) {
// eslint-disable-next-line no-console
console.error("Invalid time format during keydown:", error.message);
alert('Please enter a valid time format (HH:MM:SS, MM:SS, or HH:MM:SS.SSS)');
alert('Please enter a valid time format (HH:MM:SS, MM:SS, or HH:MM:SS.SSS)'); // eslint-disable-line no-alert
}
} else if (elementId.includes("textarea")) {
// text
Expand Down

0 comments on commit 2039e97

Please sign in to comment.