diff --git a/.gitignore b/.gitignore index a0f608045..7c1e5ffa6 100755 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,8 @@ Autogrpha-DB/ /app/**/*.map /.next .next +.yalc +yalc.lock # testing /coverage diff --git a/package.json b/package.json index 8152c91ed..2be57c813 100644 --- a/package.json +++ b/package.json @@ -88,6 +88,7 @@ "@babel/eslint-parser": "^7.5.4", "@babel/preset-env": "^7.25.4", "@babel/preset-react": "^7.17.12", + "@capacitor/cli": "5.4.2", "@mui/icons-material": "^5.8.4", "@netlify/plugin-nextjs": "^4.8.0", "@playwright/test": "^1.36.2", @@ -127,6 +128,8 @@ "@mui/icons-material": "^5.x" }, "dependencies": { + "@babel/plugin-proposal-private-property-in-object": "^7.21.11", + "@biblionexus-foundation/scribe-editor": "0.1.2-scribe-v1", "@capacitor/app": "5.0.6", "@capacitor/core": "5.4.2", "@capacitor/haptics": "5.0.6", @@ -222,6 +225,7 @@ "react-router": "^5.2.0", "react-router-dom": "^5.2.0", "react-scripts": "5.0.1", + "sj-usfm-grammar": "^3.0.3", "styled-components": "^5.3.6", "tc-ui-toolkit": "5.3.3", "terser-webpack-plugin": "^5.3.10", @@ -230,9 +234,9 @@ "typescript": "^4.9.5", "use-deep-compare": "^1.1.0", "usfm-editor": "0.8.7", - "usfm-grammar": "^2.3.0", + "usfm-grammar": "^2.3.1", "uuid": "^9.0.1", - "wavesurfer.js": "^6.6.2", + "wavesurfer.js": "^6.6.4", "webpack-node-externals": "^3.0.0", "winston": "^3.7.2", "word-aligner": "1.0.0", diff --git a/renderer/src/components/EditorPage/Navigation/reference/SelectBook.js b/renderer/src/components/EditorPage/Navigation/reference/SelectBook.js index 2256f55f7..cb28054e0 100644 --- a/renderer/src/components/EditorPage/Navigation/reference/SelectBook.js +++ b/renderer/src/components/EditorPage/Navigation/reference/SelectBook.js @@ -14,6 +14,7 @@ export default function SelectBook({ selectedBooks, setSelectedBooks, scope, + setBook, existingScope = [], disableScope = {}, call = '', @@ -37,6 +38,7 @@ export default function SelectBook({ function bookSelect(e, bookId) { e.preventDefault(); onChangeBook(bookId, selectedBooks[0]); + setBook(bookId); if (multiSelectBook === false) { selectBook(); } } diff --git a/renderer/src/components/EditorPage/TextEditor/BibleNavigationX.jsx b/renderer/src/components/EditorPage/TextEditor/BibleNavigationX.jsx deleted file mode 100644 index 4be5cb2b0..000000000 --- a/renderer/src/components/EditorPage/TextEditor/BibleNavigationX.jsx +++ /dev/null @@ -1,251 +0,0 @@ -import PropTypes from 'prop-types'; -import { Dialog, Transition } from '@headlessui/react'; -import React, { - Fragment, useContext, useEffect, useRef, useState, -} from 'react'; -import { XMarkIcon, ChevronDownIcon } from '@heroicons/react/24/solid'; -import * as localforage from 'localforage'; -import SelectBook from '@/components/EditorPage/Navigation/reference/SelectBook'; -import SelectVerse from '@/components/EditorPage/Navigation/reference/SelectVerse'; - -import { ReferenceContext } from '@/components/context/ReferenceContext'; - -export default function BibleNavigationX(props) { - const { - showVerse, chapterNumber, setChapterNumber, verseNumber, setVerseNumber, - } = props; - const supportedBooks = null; // if empty array or null then all books available - - const { - state: { - bookId, - bookList, - bookName, - chapter, - verse, - chapterList, - verseList, - languageId, - // closeNavigation, - }, actions: { - onChangeBook, - onChangeChapter, - onChangeVerse, - applyBooksFilter, - setCloseNavigation, - }, - } = useContext(ReferenceContext); - - useEffect(() => { - applyBooksFilter(supportedBooks); - }, [applyBooksFilter, supportedBooks]); - - const [openBook, setOpenBook] = useState(false); - const [openVerse, setOpenVerse] = useState(false); - const cancelButtonRef = useRef(null); - - const [multiSelectVerse] = useState(false); - const [multiSelectBook] = useState(false); - const [selectedVerses, setSelectedVerses] = useState([]); - const [selectedBooks, setSelectedBooks] = useState([]); - const [verselectActive, setVerseSelectActive] = useState(false); - - function closeBooks() { - setOpenBook(false); - } - - function openBooks() { - setSelectedBooks([(bookId.toUpperCase())]); - setOpenBook(true); - } - - function closeVerses() { - setOpenVerse(false); - if (multiSelectVerse) { setVerseSelectActive(true); } - } - - function selectBook() { - setOpenBook(false); - setOpenVerse(true); - if (multiSelectVerse) { setSelectedVerses([]); } - } - - useEffect(() => { - const getSupportedBooks = async () => { - const refs = await localforage.getItem('refBibleBurrito'); - refs?.forEach((ref) => { - if (languageId !== null) { - if (ref.value.languages[0].tag === languageId) { - const supportedBooks = []; - Object.entries((ref.value.type.flavorType.currentScope)).forEach( - ([key]) => { - supportedBooks.push(key.toLowerCase()); - }, - ); - applyBooksFilter(supportedBooks); - } - } - }); - }; - getSupportedBooks(); - }, [languageId, applyBooksFilter]); - - useEffect(() => { - async function setReference() { - await localforage.setItem('navigationHistory', [bookId, chapter, verse]); - } - setReference(); - }, [bookId, chapter, verse]); - - useEffect(() => { - if (openBook === false && openVerse === false) { - setCloseNavigation(true); - } - if (openBook || openVerse) { - setCloseNavigation(false); - } - }, [openVerse, openBook, setCloseNavigation]); - - return ( - <> -