Skip to content

Commit

Permalink
fixed lint issues. (bible-technology#177)
Browse files Browse the repository at this point in the history
refactor

new project refactor

refactor

file refactor
  • Loading branch information
samueljd authored and Kalisa11 committed Oct 10, 2023
1 parent ddd1daa commit 9339fbf
Show file tree
Hide file tree
Showing 48 changed files with 741 additions and 2,250 deletions.
4 changes: 2 additions & 2 deletions app/newproject/page.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import ProtectedRoute from '@/components/Protected';
import NewWebProject from '@/components/Projects/NewWebProject';
import NewProject from '@/components/Projects/NewProject';

const newproject = () => (
<ProtectedRoute>
<NewWebProject call="new" />
<NewProject call="new" />
</ProtectedRoute>
);

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@
},
"optionalDependencies": {
"bufferutil": "^4.0.6",
"react-icons": "4.10.1",
"scripture-resources-rcl": "5.1.0",
"utf-8-validate": "^5.0.9",
"react-icons": "4.10.1"
"utf-8-validate": "^5.0.9"
},
"overrides": {
"react": "$react",
Expand All @@ -204,4 +204,4 @@
"word-aligner": "$word-aligner",
"@mui/lab": "$@mui/lab"
}
}
}
10 changes: 0 additions & 10 deletions renderer/src/components/EditorPage/BookMarks/Bookmarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,6 @@ export default function Bookmarks() {
}).finally(() => setIsLoading(false));
};

// useEffect(() => {
// console.log('tempChapter', tempChapter, chapter);
// timeout(2000).then(async () => {
// setIsLoading(true);
// onChangeChapter(tempChapter);
// onChangeVerse('1');
// }).then(() => setIsLoading(false));
// // eslint-disable-next-line react-hooks/exhaustive-deps
// }, [tempChapter]);

return (
<>
<div className="bg-gray-800 uppercase text-white text-xs p-2 tracking-wider">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ const { t } = useTranslation();
if (window?.navigator?.onLine) {
await checkandDownloadObsImages(window?.navigator?.onLine);
}
// else {
// console.log('No internet connection');
// }
})();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
Expand Down
4 changes: 0 additions & 4 deletions renderer/src/components/EditorPage/ObsEditor/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ const loadWebData = async (file, projectName, username) => {
const filePath = `${newPath}/${username}/resources/${projectName}/content/${file}.md`;
const { data } = await sbStorageDownload(filePath);
const parsedData = readBlobAsync(data);
console.log({ filePath, data, parsedData });

if (parsedData) {
return parsedData;
Expand Down Expand Up @@ -151,12 +150,10 @@ const core = (fs, num, projectName, username) => {
};

const webCore = async (num, projectName, username) => {
console.log({ num, projectName, username });
const stories = [];
// eslint-disable-next-line prefer-const
let id = 1; let footer = false;
const data = await loadWebData(num.toString().padStart(2, 0), projectName, username);
console.log({ data });
const allLines = data.split(/\r\n|\n/);
// Reading line by line
allLines.forEach((line) => {
Expand Down Expand Up @@ -230,7 +227,6 @@ const webCore = async (num, projectName, username) => {
}
}
});
console.log({ stories });
return stories;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ function MultiComboBox({
.toLowerCase()
.replace(/\s+/g, '')
.includes(query.toLowerCase().replace(/\s+/g, '')));
// console.log({ options, selectedOption });

useEffect(() => {
if (selectedOption === null && options.length > 0) {
Expand Down
40 changes: 2 additions & 38 deletions renderer/src/components/EditorPage/Scribex/Editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ReferenceContext } from '@/components/context/ReferenceContext';
import { ProjectContext } from '@/components/context/ProjectContext';
import EmptyScreen from '@/components/Loading/EmptySrceen';
import {
insertVerseNumber, insertChapterNumber, insertFootnote, insertXRef,
insertVerseNumber, insertChapterNumber, insertFootnote, insertXRef,
} from '@/util/cursorUtils';
import RecursiveBlock from './RecursiveBlock';

Expand Down Expand Up @@ -134,45 +134,9 @@ export default function Editor(props) {
if (insertVerseRChapter === 'Cross Reference') {
insertXRef(caretPosition, newVerChapNumber, selectedText);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [triggerVerseInsert]);

// useEffect(() => {
// let pressedKeys = [];
// const handleKeyDown = (e) => {
// const copyKeys = ['Control', 'c'];
// const pasteKeys = ['Control', 'v'];
// pressedKeys.push(e.key);
// if (pressedKeys.join('+') === copyKeys.join('+')) {
// e.preventDefault();
// copyText();
// pressedKeys = [];
// }
// if (pressedKeys.join('+') === pasteKeys.join('+')) {
// e.preventDefault();
// pasteText();
// pressedKeys = [];
// }
// // if (e.key === 's') { console.log("savingssssssssss") }
// // if (e.key === 'Control' && e.key === 'c') {
// // console.log("copying")
// // e.preventDefault();
// // // Call your custom copy function
// // copyText();
// // } else if (e.metaKey && e.key === 'v') {
// // console.log("pasting")
// // e.preventDefault();
// // // Call your custom paste function
// // pasteText();
// // }
// };

// document.addEventListener('keydown', handleKeyDown);
// return () => {
// document.removeEventListener('keydown', handleKeyDown);
// };
// }, []);

const scrollReference = (chapterNumber) => {
const refEditors = document.getElementsByClassName('ref-editor');
refEditors.length > 0 && Array.prototype.filter.call(refEditors, (refEditor) => {
Expand Down
1 change: 0 additions & 1 deletion renderer/src/components/EditorPage/Scribex/Popup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const Popup = ({
handleClose, handleButtonClick, title, isPopupOpen, selectedText,
}) => {
const [number, setNumber] = useState('');
// console.log({ title }, "title");
const handleInputChange = (event) => {
setNumber(event.target.value);
};
Expand Down
2 changes: 0 additions & 2 deletions renderer/src/components/EditorPage/Scribex/RecursiveBlock.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ export default function RecursiveBlock({
const checkCurrentVerse = () => {
if (document.getSelection().rangeCount >= 1 && onReferenceSelected) {
const range = document.getSelection().getRangeAt(0);
// console.log({ range })
const selectedNode = range.startContainer;
// console.log({ selectedNode })
const verse = getCurrentVerse(selectedNode);
const chapter = getCurrentChapter(selectedNode);
// if (onReferenceSelected) {
Expand Down
2 changes: 0 additions & 2 deletions renderer/src/components/Login/Signin.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const SignIn = () => {
password,
});
if (data.session) {
console.log('sign in success', data);
await localforage.setItem('userProfile', data);
const userData = await localforage.getItem('userProfile');
console.log({ userData });
Expand All @@ -28,7 +27,6 @@ const SignIn = () => {
} else {
setError(signInError);
setLoading(false);
console.log('sign in error', signInError);
}
};

Expand Down
1 change: 1 addition & 0 deletions renderer/src/components/Profile/UserProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const UserProfile = () => {
// if(!process.env.NEXT_PUBLIC_IS_ELECTRON){
const { error } = await supabaseSignout();
localforage.removeItem('userProfile');
// eslint-disable-next-line no-console
error ? console.log({ error }) : router.push('/login');
};
// }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import LicencePopover from './LicencePopover';
import * as logger from '../../../logger';
import packageInfo from '../../../../../package.json';
import { newPath, sbStorageDownload } from '../../../../../supabase';
import {} from '../../../lib/license/Custom.md';

function BookNumberTag(props) {
const { children } = props;
Expand Down Expand Up @@ -302,7 +303,6 @@ export default function AdvancedSettingsDropdown({ call, project, projectType })
onClick={() => selectCanon(canonList[3])}
role="button"
tabIndex="0"
aria-label="custom-book"
>
{t('label-custom')}
</div>
Expand Down Expand Up @@ -351,7 +351,7 @@ export default function AdvancedSettingsDropdown({ call, project, projectType })
projectType === 'OBS' && (
<>
<h4 className="text-xs font-base mt-4 text-primary tracking-wide leading-4 font-light">
{t('modal-title-license')}
Licence
<span className="text-error">*</span>
</h4>
<div className="flex gap-3 mt-2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ const CustomCanonSpecification = ({ bibleNav, closeBibleNav, handleNav }) => {
</button>
<button
type="button"
id="save-canon"
className="w-40 h-10 bg-success leading-loose rounded shadow text-xs font-base text-white tracking-wide font-light uppercase"
onClick={() => (handleNav === 'edit' ? editCanon() : saveCanon())}
>
Expand Down
4 changes: 2 additions & 2 deletions renderer/src/components/Projects/NewProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { useRouter } from 'next/navigation';
import { useTranslation } from 'react-i18next';
import { ChevronDownIcon } from '@heroicons/react/24/solid';
import ProjectsLayout from '@/layouts/projects/Layout';
import AdvancedSettingsDropdown from '@/components/ProjectsPage/CreateProject/AdvancedSettingsDropdown';
import AdvancedSettingsDropdown from '@/components/Projects/CreateProject/AdvancedSettingsDropdown';
import { ProjectContext } from '@/components/context/ProjectContext';
import TargetLanguagePopover from '@/components/ProjectsPage/CreateProject/TargetLanguagePopover';
import TargetLanguagePopover from '@/components/Projects/CreateProject/TargetLanguagePopover';
import PopoverProjectType from '@/layouts/editor/PopoverProjectType';
import { SnackBar } from '@/components/SnackBar';
import useValidator from '@/components/hooks/useValidator';
Expand Down
Loading

0 comments on commit 9339fbf

Please sign in to comment.