diff --git a/app/newproject/page.js b/app/newproject/page.js index aea0cfe49..2bca36c06 100644 --- a/app/newproject/page.js +++ b/app/newproject/page.js @@ -1,9 +1,9 @@ import ProtectedRoute from '@/components/Protected'; -import NewWebProject from '@/components/Projects/NewWebProject'; +import NewProject from '@/components/Projects/NewProject'; const newproject = () => ( - + ); diff --git a/package.json b/package.json index 146e690a8..74acc6241 100644 --- a/package.json +++ b/package.json @@ -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", @@ -204,4 +204,4 @@ "word-aligner": "$word-aligner", "@mui/lab": "$@mui/lab" } -} \ No newline at end of file +} diff --git a/renderer/src/components/EditorPage/BookMarks/Bookmarks.js b/renderer/src/components/EditorPage/BookMarks/Bookmarks.js index 1562af309..4a10ea941 100644 --- a/renderer/src/components/EditorPage/BookMarks/Bookmarks.js +++ b/renderer/src/components/EditorPage/BookMarks/Bookmarks.js @@ -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 ( <>
diff --git a/renderer/src/components/EditorPage/ObsEditor/WebReferenceObs.js b/renderer/src/components/EditorPage/ObsEditor/WebReferenceObs.js index 73e4455cc..9135e95c4 100644 --- a/renderer/src/components/EditorPage/ObsEditor/WebReferenceObs.js +++ b/renderer/src/components/EditorPage/ObsEditor/WebReferenceObs.js @@ -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 }, []); diff --git a/renderer/src/components/EditorPage/ObsEditor/core.js b/renderer/src/components/EditorPage/ObsEditor/core.js index 18ffc8ebf..4f7f79ce9 100644 --- a/renderer/src/components/EditorPage/ObsEditor/core.js +++ b/renderer/src/components/EditorPage/ObsEditor/core.js @@ -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; @@ -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) => { @@ -230,7 +227,6 @@ const webCore = async (num, projectName, username) => { } } }); - console.log({ stories }); return stories; }; diff --git a/renderer/src/components/EditorPage/Reference/MultiComboBox.js b/renderer/src/components/EditorPage/Reference/MultiComboBox.js index 98a79db05..c92c69090 100644 --- a/renderer/src/components/EditorPage/Reference/MultiComboBox.js +++ b/renderer/src/components/EditorPage/Reference/MultiComboBox.js @@ -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) { diff --git a/renderer/src/components/EditorPage/Scribex/Editor.jsx b/renderer/src/components/EditorPage/Scribex/Editor.jsx index dc4f6d011..5686132b6 100644 --- a/renderer/src/components/EditorPage/Scribex/Editor.jsx +++ b/renderer/src/components/EditorPage/Scribex/Editor.jsx @@ -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'; @@ -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) => { diff --git a/renderer/src/components/EditorPage/Scribex/Popup.jsx b/renderer/src/components/EditorPage/Scribex/Popup.jsx index 498401eee..7533e8466 100644 --- a/renderer/src/components/EditorPage/Scribex/Popup.jsx +++ b/renderer/src/components/EditorPage/Scribex/Popup.jsx @@ -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); }; diff --git a/renderer/src/components/EditorPage/Scribex/RecursiveBlock.jsx b/renderer/src/components/EditorPage/Scribex/RecursiveBlock.jsx index 921136d7a..9a670a79b 100644 --- a/renderer/src/components/EditorPage/Scribex/RecursiveBlock.jsx +++ b/renderer/src/components/EditorPage/Scribex/RecursiveBlock.jsx @@ -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) { diff --git a/renderer/src/components/Login/Signin.js b/renderer/src/components/Login/Signin.js index a9b7db2f3..b57623c75 100644 --- a/renderer/src/components/Login/Signin.js +++ b/renderer/src/components/Login/Signin.js @@ -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 }); @@ -28,7 +27,6 @@ const SignIn = () => { } else { setError(signInError); setLoading(false); - console.log('sign in error', signInError); } }; diff --git a/renderer/src/components/Profile/UserProfile.js b/renderer/src/components/Profile/UserProfile.js index 8c5be9f40..9259adea2 100644 --- a/renderer/src/components/Profile/UserProfile.js +++ b/renderer/src/components/Profile/UserProfile.js @@ -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'); }; // } diff --git a/renderer/src/components/ProjectsPage/CreateProject/AdvancedSettingsDropdown.js b/renderer/src/components/Projects/CreateProject/AdvancedSettingsDropdown.js similarity index 99% rename from renderer/src/components/ProjectsPage/CreateProject/AdvancedSettingsDropdown.js rename to renderer/src/components/Projects/CreateProject/AdvancedSettingsDropdown.js index eb7bae0dc..b2bcac356 100644 --- a/renderer/src/components/ProjectsPage/CreateProject/AdvancedSettingsDropdown.js +++ b/renderer/src/components/Projects/CreateProject/AdvancedSettingsDropdown.js @@ -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; @@ -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')}
@@ -351,7 +351,7 @@ export default function AdvancedSettingsDropdown({ call, project, projectType }) projectType === 'OBS' && ( <>

- {t('modal-title-license')} + Licence *

diff --git a/renderer/src/components/ProjectsPage/CreateProject/CustomCanonSpecification.js b/renderer/src/components/Projects/CreateProject/CustomCanonSpecification.js similarity index 99% rename from renderer/src/components/ProjectsPage/CreateProject/CustomCanonSpecification.js rename to renderer/src/components/Projects/CreateProject/CustomCanonSpecification.js index 1ad017662..fbe7e7933 100644 --- a/renderer/src/components/ProjectsPage/CreateProject/CustomCanonSpecification.js +++ b/renderer/src/components/Projects/CreateProject/CustomCanonSpecification.js @@ -114,7 +114,6 @@ const CustomCanonSpecification = ({ bibleNav, closeBibleNav, handleNav }) => { - - ) - : ( - - ) - - ); -} -export default function NewWebProject({ call, project, closeEdit }) { - const { - states: { - newProjectFields, - languages, - language, - }, - actions: { - setLanguage, - createSupabaseProject, - setNewProjectFields, - }, - } = useContext(ProjectContext); - - const { - states: { - loading, - }, - action: { - setLoading, - }, - } = useContext(AutographaContext); - const { t } = useTranslation(); - const { action: { validateField, isLengthValidated, isTextValidated } } = useValidator(); - const router = useRouter(); - const [snackBar, setOpenSnackBar] = useState(false); - const [snackText, setSnackText] = useState(''); - const [notify, setNotify] = useState(); - const [metadata, setMetadata] = useState(); - const [openModal, setOpenModal] = useState(false); - const [projectLangData, setProjectLangData] = useState({}); - const [error, setError] = useState({ - projectName: {}, - abbr: {}, - description: {}, - }); - - const [headerDropDown, setHeaderDropDown] = useState(solutions[0].name); - const handleDropDown = (currentSelection) => { - setHeaderDropDown(currentSelection); - }; - - function getAbbreviation(text) { - if (typeof text !== 'string' || !text) { - return ''; - } - const abbr = []; - const splitText = text.trim().split(' '); - splitText.forEach((t) => { - abbr.push(t.charAt(0)); - }); - return abbr.join('').toUpperCase(); - } - - const handleProjectName = (e) => { - const abbreviation = getAbbreviation(e.target.value); - setNewProjectFields({ ...newProjectFields, projectName: e.target.value, abbreviation }); - }; - - const setEditLanguage = async (value) => { - // check the language already in the list or set a new one which create on save project - if (value.ang) { - const editLang = languages.filter((l) => l.ang?.toLowerCase() === value.ang?.toLowerCase()); - if (editLang.length > 0) { - setLanguage(editLang[0]); - } else { - const key = value.ang + +moment().format(); - const id = uuidv5(key, environment.uuidToken); - setLanguage( - { - id, - ang: value.ang, - ld: value?.ld || 'LTR', - lc: value?.lc, - custom: true, - }, - ); - } - } - }; - - const createWebProject = async (update) => { - setLoading(true); - if (newProjectFields.projectName && newProjectFields.abbreviation) { - const value = await createSupabaseProject(call, metadata, update, headerDropDown); - console.log({ value }); - - const status = value[0]; - logger.debug('NewProject.js', status.value); - setLoading(false); - setNotify(status.type); - setSnackText(status.value); - setOpenSnackBar(true); - if (status.type === 'success') { - if (call === 'edit') { - closeEdit(); - } else { - router.push('/projects'); - } - } - } - }; - const validate = async () => { - setLoading(true); - let create = true; - if (newProjectFields.projectName && newProjectFields.abbreviation) { - logger.debug('NewProject.js', 'Validating all the fields.'); - const checkName = await validateField([isLengthValidated(newProjectFields.projectName, { minLen: 5, maxLen: 40 }), isTextValidated(newProjectFields.projectName, 'nonSpecChar')]); - if (checkName[0].isValid === false || checkName[1].isValid === false) { - logger.warn('NewProject.js', 'Validation failed for Project Name.'); - create = false; - } - const checkAbbr = await validateField([isLengthValidated(newProjectFields.abbreviation, { minLen: 1, maxLen: 10 }), isTextValidated(newProjectFields.abbreviation, 'nonSpecChar')]); - if (checkAbbr[0].isValid === false || checkAbbr[1].isValid === false) { - logger.warn('NewProject.js', 'Validation failed for Abbreviation.'); - create = false; - } - // eslint-disable-next-line max-len - const checkDesc = await validateField([isLengthValidated(newProjectFields.description, { minLen: 0, maxLen: 400 })]); - if (checkDesc[0].isValid === false) { - logger.warn('NewProject.js', 'Validation failed for Description.'); - create = false; - } - setError({ - ...error, projectName: checkName, abbr: checkAbbr, description: checkDesc, - }); - } else { - create = false; - logger.warn('NewProject.js', 'Validation Failed - Fill all the required fields.'); - setNotify('warning'); - setSnackText(t('dynamic-msg-fill-all-fields')); - setOpenSnackBar(true); - } - if (create === true) { - // Checking whether the burrito is of latest version - console.warn('NewProject.js', 'Checking whether the burrito is of latest version.'); - if (call === 'edit' && burrito?.meta?.version !== metadata?.meta?.version) { - setOpenModal(true); - setLoading(false); - } else { - logger.warn('NewProject.js', 'Calling createTheProject function'); - createWebProject(false); - } - } else { - setLoading(false); - } - }; - - const updateBurritoVersion = () => { - setOpenModal(false); - logger.warn('NewProject.js', 'Calling createTheProject function with burrito update'); - createWebProject(true); - }; - const [openPopUp, setOpenPopUp] = useState(false); - const [replaceWarning, setReplaceWarning] = useState(false); - - function openImportPopUp() { - setOpenPopUp(true); - } - - function closeImportPopUp() { - setOpenPopUp(false); - if (call === 'edit') { - setReplaceWarning(true); - } - } - const loadData = async (project) => { - logger.debug('NewProject.js', 'In loadData for loading current project details in Edit page'); - setNewProjectFields({ - projectName: project.identification.name.en, - abbreviation: project.identification.abbreviation.en, - description: project.project[project.type.flavorType.flavor.name].description, - }); - setProjectLangData({ - ang: project.languages[0].name.en, - ld: project.project[project.type.flavorType.flavor.name].scriptDirection, - lc: project.languages[0]?.tag ? project.languages[0].tag : project.languages[0].name.en.substring(0, 3), - }); - setMetadata(project); - // set dropdown to the project type - switch (project.type.flavorType.flavor.name) { - case 'textTranslation': - setHeaderDropDown('Translation'); - break; - - case 'textStories': - setHeaderDropDown('OBS'); - break; - - case 'audioTranslation': - setHeaderDropDown('Audio'); - break; - - default: - break; - } - }; - - useEffect(() => { - setEditLanguage(projectLangData); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [languages.length, projectLangData]); - - useEffect(() => { - if (call === 'edit') { - loadData(project); - } else if (call === 'new') { - // set englsh as default lang - const defaulLang = languages.filter((lang) => lang.lc === 'en'); - setLanguage(defaulLang[0]); - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [call]); - - return ( - - {loading === true - ? ( -
- - - - -
- ) - : ( -
-
- -
-

- {t('label-project-name')} - * -

- { - handleProjectName(e); - }} - disabled={call !== 'new'} - className={classNames(call !== 'new' ? 'bg-gray-200' : '', 'w-52 lg:w-80 block rounded shadow-sm sm:text-sm focus:border-primary border-gray-300')} - /> - {error.projectName[0]?.message || error.projectName[1]?.message} -

{t('label-description')}

-