From da3111385fc947fd5bdcf727b80cb511d02c5913 Mon Sep 17 00:00:00 2001 From: Kalisa <95277748+Kalisa11@users.noreply.github.com> Date: Wed, 20 Dec 2023 07:22:11 +0200 Subject: [PATCH 01/15] sidebar ui fix (#279) Co-authored-by: Yannick M <85898240+mugishayannick@users.noreply.github.com> --- renderer/src/components/Projects/ProjectRow.js | 15 ++++++++------- renderer/src/layouts/projects/SideBar.js | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/renderer/src/components/Projects/ProjectRow.js b/renderer/src/components/Projects/ProjectRow.js index c1cee48b2..310f91eb9 100644 --- a/renderer/src/components/Projects/ProjectRow.js +++ b/renderer/src/components/Projects/ProjectRow.js @@ -59,9 +59,10 @@ const ProjectRow = ({ } return 0; } + return ( - {projects?.length === 0 && ( + {((projects?.length === 0 && filteredProjects?.length > 0) || (!showArchived && projects?.length === archivedProjects?.length)) && (

You don't have any projects yet

@@ -87,12 +88,12 @@ const ProjectRow = ({ )} { - projects?.length !== 0 && filteredProjects?.length === 0 && ( - - -

No projects found. Try a different search term.

- - + projects?.length > 0 && filteredProjects?.length === 0 && ( + + +

No projects found. Try a different search term.

+ + ) } { diff --git a/renderer/src/layouts/projects/SideBar.js b/renderer/src/layouts/projects/SideBar.js index e4ed77b08..d5a484e4f 100644 --- a/renderer/src/layouts/projects/SideBar.js +++ b/renderer/src/layouts/projects/SideBar.js @@ -46,7 +46,7 @@ export default function SideBar() { Date: Tue, 2 Jan 2024 10:40:32 +0530 Subject: [PATCH 02/15] Adding tsv content for tA,obs-tQ,tQ (#280) --- renderer/src/components/Resources/ListResources.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/renderer/src/components/Resources/ListResources.js b/renderer/src/components/Resources/ListResources.js index b1d5f8bd6..fdeb954b6 100644 --- a/renderer/src/components/Resources/ListResources.js +++ b/renderer/src/components/Resources/ListResources.js @@ -106,19 +106,19 @@ export const ListResources = ({ await fetchTranslationResource('TSV Translation Words Links', settranslationWordList, selectResource, selectedPreProd, snackBarAction); break; case 'tq': - await fetchTranslationResource('Translation Questions', setTranslationQuestion, selectResource, selectedPreProd, snackBarAction); + await fetchTranslationResource('Translation Questions&subject=tsv Translation Questions', setTranslationQuestion, selectResource, selectedPreProd, snackBarAction); break; case 'obs-tn': await fetchTranslationResource('OBS Translation Notes&subject=tsv obs Translation notes', setObsTranslationNote, selectResource, selectedPreProd, snackBarAction); break; case 'obs-tq': - await fetchTranslationResource('OBS Translation Questions', setObsTranslationQuestion, selectResource, selectedPreProd, snackBarAction); + await fetchTranslationResource('OBS Translation Questions&subject=tsv obs Translation Questions', setObsTranslationQuestion, selectResource, selectedPreProd, snackBarAction); break; case 'obs-twlm': await fetchTranslationResource('TSV OBS Translation Words Links', setObsTranslationWordList, selectResource, selectedPreProd, snackBarAction); break; case 'ta': - await fetchTranslationResource('Translation Academy', setTranslationAcademy, selectResource, selectedPreProd, snackBarAction); + await fetchTranslationResource('Translation Academy&subject=tsv Translation Academy', setTranslationAcademy, selectResource, selectedPreProd, snackBarAction); break; default: break; From d29c0e694cc4705d3e78655971a9fa7832cf219e Mon Sep 17 00:00:00 2001 From: Siju Moncy <72241997+sijumoncy@users.noreply.github.com> Date: Thu, 4 Jan 2024 16:51:15 +0530 Subject: [PATCH 03/15] rewrite the logics for loading online and offline Twords (#285) --- .../EditorPage/Reference/TW/TwNavigation.js | 126 ++++++++++-------- 1 file changed, 71 insertions(+), 55 deletions(-) diff --git a/renderer/src/components/EditorPage/Reference/TW/TwNavigation.js b/renderer/src/components/EditorPage/Reference/TW/TwNavigation.js index 4dee6c222..d75c4bc3c 100644 --- a/renderer/src/components/EditorPage/Reference/TW/TwNavigation.js +++ b/renderer/src/components/EditorPage/Reference/TW/TwNavigation.js @@ -17,34 +17,30 @@ export default function TwNavigation({ languageId, referenceResources, setRefere const [openSnackBar, setOpenSnackBar] = useState(false); const [snackText, setSnackText] = useState(''); const [error, setError] = useState(''); + const [onlineMeta, setOnlineMeta] = useState(); - // const baseUrl = 'https://git.door43.org/api/v1/repos'; const owner = referenceResources?.owner; useEffect(() => { if (referenceResources && referenceResources?.offlineResource?.offline) { - // offline - // console.log('offline : ', { referenceResources }); - const taArrayOffline = []; const { offlineResource } = referenceResources; localForage.getItem('userProfile').then(async (user) => { - logger.debug('TwNavigation.js', 'reading offline helps ', offlineResource.data?.projectDir); const fs = window.require('fs'); const path = require('path'); const newpath = localStorage.getItem('userPath'); const currentUser = user?.username; const folder = path.join(newpath, packageInfo.name, 'users', `${currentUser}`, 'resources'); const projectName = `${offlineResource?.data?.value?.meta?.name}_${offlineResource?.data?.value?.meta?.owner}_${offlineResource?.data?.value?.meta?.release?.tag_name}`; - // set Options + const optionsDir = path.join(folder, projectName, 'bible'); const tempOptions = []; + if (fs.existsSync(optionsDir)) { fs.readdir(optionsDir, async (err, optionsNames) => { if (err) { // console.log(`Unable to scan directory: ${ err}`); logger.debug('TwNavigation.js', `Unable to scan directory: ${ err}`); } - // console.log({ optionsNames }); let optionsCount = 0; await optionsNames.forEach(async (folderName) => { if (fs.lstatSync(path.join(optionsDir, folderName)).isDirectory()) { @@ -53,36 +49,14 @@ export default function TwNavigation({ languageId, referenceResources, setRefere } }); if (tempOptions.length === optionsCount) { - setoptions(tempOptions); + setoptions(tempOptions); + setselectedOption(tempOptions[0]); } - // fetch contents of selected folder - if (selectedOption && selectedOption?.length > 0 && fs.existsSync(path.join(optionsDir, selectedOption))) { - fs.readdir(path.join(optionsDir, selectedOption), async (err, folderContents) => { - let contentsCount = 0; - folderContents.forEach((content) => { - if (fs.lstatSync(path.join(optionsDir, selectedOption, content)).isFile()) { - contentsCount += 1; - taArrayOffline.push( - { - folder: path.join(selectedOption, content), - title: content.replace('.md', ''), - subTitle: '', - }, - ); - } - }); - if (taArrayOffline.length === contentsCount) { - setTwList(taArrayOffline); - } - }); - } - }); + }); } }); } else { // online - // get options - // fetch(`https://git.door43.org/api/catalog/v5/search?subject=Translation%20Words&lang=${languageId}&owner=${owner}`) fetch(`${environment.GITEA_API_ENDPOINT}/catalog/search?metadataType=rc&subject=Translation%20Words&lang=${languageId}&owner=${owner}`) .then((res) => res.json()) .then((meta) => { @@ -90,6 +64,7 @@ export default function TwNavigation({ languageId, referenceResources, setRefere fetch(meta?.data[0]?.contents_url) .then((response) => response.json()) .then((contents) => { + setOnlineMeta(meta); const bibleDirUlr = contents.filter((content) => content?.name === 'bible' && content?.type === 'dir'); // console.log({ bibleDirUlr }); if (bibleDirUlr?.length > 0) { @@ -107,45 +82,86 @@ export default function TwNavigation({ languageId, referenceResources, setRefere }); if (folderCount === tempOptions?.length) { setoptions(tempOptions); + setselectedOption(tempOptions[0]); } } }); } }); + }); + } + }, [owner, languageId]); - const fetchData = async () => { - await fetch(`${environment.GITEA_API_ENDPOINT}/repos/${owner}/${languageId}_tw/contents/bible/${selectedOption}?ref=${meta?.data[0]?.release?.tag_name}`) - .then((response) => response.json()) - .then((twData) => { - twData && twData?.forEach((data) => { - data.folder = data?.path.replace('bible/', ''); - data.title = data?.name.replace('.md', ''); - data.subTitle = ''; + useEffect(() => { + if (referenceResources && referenceResources?.offlineResource?.offline) { + const taArrayOffline = []; + const { offlineResource } = referenceResources; + localForage.getItem('userProfile').then(async (user) => { + const fs = window.require('fs'); + const path = require('path'); + const newpath = localStorage.getItem('userPath'); + const currentUser = user?.username; + const folder = path.join(newpath, packageInfo.name, 'users', `${currentUser}`, 'resources'); + const projectName = `${offlineResource?.data?.value?.meta?.name}_${offlineResource?.data?.value?.meta?.owner}_${offlineResource?.data?.value?.meta?.release?.tag_name}`; + // set Options + const optionsDir = path.join(folder, projectName, 'bible'); + if (selectedOption && selectedOption?.length > 0 && fs.existsSync(path.join(optionsDir, selectedOption))) { + fs.readdir(path.join(optionsDir, selectedOption), async (err, folderContents) => { + let contentsCount = 0; + folderContents.forEach((content) => { + if (fs.lstatSync(path.join(optionsDir, selectedOption, content)).isFile()) { + contentsCount += 1; + taArrayOffline.push( + { + folder: path.join(selectedOption, content), + title: content.replace('.md', ''), + subTitle: '', + }, + ); + } }); - setTwList(twData); - }).catch((err) => { - logger.debug('TwNavigation.js', 'reading offline helps ', err); - setOpenSnackBar(true); - setError('failure'); - setSnackText('Can not load content'); + if (taArrayOffline.length === contentsCount) { + setTwList(taArrayOffline); + setSelected(taArrayOffline[0]); + } }); - }; + } + }); + } else { + // online data fetch + const fetchData = async () => { + await fetch(`${environment.GITEA_API_ENDPOINT}/repos/${owner}/${languageId}_tw/contents/bible/${selectedOption}?ref=${onlineMeta?.data[0]?.release?.tag_name}`) + .then((response) => response.json()) + .then((twData) => { + twData && twData?.forEach((data) => { + data.folder = data?.path.replace('bible/', ''); + data.title = data?.name.replace('.md', ''); + data.subTitle = ''; + }); + setTwList(twData); + setSelected(twData[0]); + }).catch((err) => { + logger.debug('TwNavigation.js', 'reading offline helps ', err); + setOpenSnackBar(true); + setError('failure'); + setSnackText('Can not load content'); + }); + }; - const getData = async () => { - await fetchData(); - }; - // console.log({ selectedOption }); - selectedOption && getData(); - }); + const getData = async () => { + await fetchData(); + }; + + selectedOption && getData(); } - }, [languageId, referenceResources, owner, selectedOption]); + }, [options, selectedOption]); useEffect(() => { selected && setReferenceResources((current) => ({ ...current, offlineResource: { ...current.offlineResource, twSelected: selected }, })); - }, [selected, selectedOption, setReferenceResources]); + }, [selected]); return ( <> From 3048b884eac29b2eae6d1b86031f190d55fc393a Mon Sep 17 00:00:00 2001 From: VIPIN PAUL <37212471+vipinpaul@users.noreply.github.com> Date: Fri, 5 Jan 2024 10:54:16 +0530 Subject: [PATCH 04/15] Text editor sync with Navigation panel and Reference Translation helps (#288) * Connected navigation and editor panel * Connected the translation helps resources with Editor panel --- .../EditorPage/TextEditor/Editor.jsx | 30 +++++++++++++++++-- .../EditorPage/TextEditor/index.jsx | 8 ++++- .../TextEditor/utils/IntersectionObserver.js | 17 +++++++---- 3 files changed, 45 insertions(+), 10 deletions(-) diff --git a/renderer/src/components/EditorPage/TextEditor/Editor.jsx b/renderer/src/components/EditorPage/TextEditor/Editor.jsx index 54fbeff18..03c1ad86e 100644 --- a/renderer/src/components/EditorPage/TextEditor/Editor.jsx +++ b/renderer/src/components/EditorPage/TextEditor/Editor.jsx @@ -1,4 +1,6 @@ -import React, { useContext, useEffect } from 'react'; +import React, { + useContext, useEffect, useLayoutEffect, useRef, +} from 'react'; import { HtmlPerfEditor } from '@xelah/type-perf-html'; import LoadingScreen from '@/components/Loading/LoadingScreen'; @@ -12,7 +14,7 @@ import { functionMapping } from './utils/insertFunctionMap'; import RecursiveBlock from './RecursiveBlock'; // eslint-disable-next-line import/no-unresolved, import/extensions import { useAutoSaveIndication } from '@/hooks2/useAutoSaveIndication'; -import { onIntersection } from './utils/IntersectionObserver'; +import { onIntersection, scrollReference } from './utils/IntersectionObserver'; export default function Editor(props) { const { @@ -98,14 +100,35 @@ export default function Editor(props) { // eslint-disable-next-line react-hooks/exhaustive-deps }, [triggerVerseInsert]); + const isScrolling = useRef(false); + useLayoutEffect(() => { + const handleScroll = () => { + isScrolling.current = true; + }; + const handleScrollEnd = () => { + isScrolling.current = false; + }; + const editorDiv = document.getElementById('fulleditor'); + // Adding scroll and click event listeners + editorDiv.addEventListener('scroll', handleScroll); + editorDiv.addEventListener('click', handleScrollEnd); + return () => { + editorDiv.removeEventListener('scroll', handleScroll); + editorDiv.removeEventListener('click', handleScrollEnd); + }; + }, []); + useAutoSaveIndication(isSaving); function onReferenceSelected({ chapter, verse }) { chapter && setChapterNumber(chapter); verse && setVerseNumber(verse); + scrollReference(chapter); } - const observer = new IntersectionObserver((entries) => onIntersection({ setChapterNumber, scrollLock, entries }), { + const observer = new IntersectionObserver((entries) => onIntersection({ + scroll: isScrolling.current, setChapterNumber, scrollLock, entries, setVerseNumber, + }), { root: document.querySelector('editor'), threshold: 0, rootMargin: '0% 0% -60% 0%', @@ -140,6 +163,7 @@ export default function Editor(props) { return (
{ + onChangeChapter(chapterNumber, 1); + onChangeVerse(verseNumber, 1); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [chapterNumber, verseNumber]); + const { catalog } = useCatalog({ proskomma, stateId, verbose }); const { id: docSetId, documents } = (done && catalog.docSets[0]) || {}; if (done) { diff --git a/renderer/src/components/EditorPage/TextEditor/utils/IntersectionObserver.js b/renderer/src/components/EditorPage/TextEditor/utils/IntersectionObserver.js index b6f806ad2..dafa7eaf2 100644 --- a/renderer/src/components/EditorPage/TextEditor/utils/IntersectionObserver.js +++ b/renderer/src/components/EditorPage/TextEditor/utils/IntersectionObserver.js @@ -9,12 +9,17 @@ export const scrollReference = (chapterNumber) => { }); }; -export const onIntersection = ({ entries, setChapterNumber, scrollLock }) => { - // eslint-disable-next-line no-restricted-syntax - for (const entry of entries) { - if (entry.isIntersecting) { - setChapterNumber(entry.target.dataset.attsNumber); - scrollLock === false ? scrollReference(entry.target.dataset.attsNumber) : {}; +export const onIntersection = ({ + scroll, entries, setChapterNumber, scrollLock, setVerseNumber, +}) => { + if (scroll) { + // eslint-disable-next-line no-restricted-syntax + for (const entry of entries) { + if (entry.isIntersecting) { + setChapterNumber(entry.target.dataset.attsNumber); + setVerseNumber(1); + scrollLock === false ? scrollReference(entry.target.dataset.attsNumber) : {}; + } } } }; From 926534da4452a051aac6e8ce6c59ef510d91af53 Mon Sep 17 00:00:00 2001 From: Siju Moncy <72241997+sijumoncy@users.noreply.github.com> Date: Fri, 5 Jan 2024 10:54:46 +0530 Subject: [PATCH 05/15] loading added for helps resources (#287) * loading added for helps resources * added fix for infinite loading * lint fix --- .../Reference/TranslationHelpsCard.js | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js index 6bfad3fa5..303ca2020 100644 --- a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js +++ b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js @@ -4,6 +4,7 @@ import { useContent, } from 'translation-helps-rcl'; import localForage from 'localforage'; +import LoadingScreen from '@/components/Loading/LoadingScreen'; import ReferenceCard from './ReferenceCard'; import * as logger from '../../../logger'; import packageInfo from '../../../../../package.json'; @@ -177,7 +178,7 @@ export default function TranslationHelpsCard({ setOfflineItemsDisable(true); setOfflineMarkdown(filecontent); } else { - setOfflineMarkdown(''); + setOfflineMarkdown({ error: true, data: 'No Content Avaialble' }); } } }); @@ -191,6 +192,8 @@ export default function TranslationHelpsCard({ const filecontent = fs.readFileSync(path.join(folder, projectName, projectId, filePath), 'utf8'); setOfflineItemsDisable(true); setOfflineMarkdown(filecontent); + } else { + setOfflineMarkdown({ error: true, data: 'No Content Available' }); } break; @@ -201,6 +204,8 @@ export default function TranslationHelpsCard({ const filecontent = fs.readFileSync(path.join(folder, projectName, 'bible', filePath), 'utf8'); setOfflineItemsDisable(true); setOfflineMarkdown(filecontent); + } else { + setOfflineMarkdown({ error: true, data: 'No Content Available' }); } break; @@ -221,20 +226,23 @@ export default function TranslationHelpsCard({ markdown = offlineResource?.offline ? offlineMarkdown : markdown; return ( - + (markdown || items) ? ( + + ) : + ); } From 690e02f2f3ff2d4888407829d090b24ffaddbfd9 Mon Sep 17 00:00:00 2001 From: VIPIN PAUL <37212471+vipinpaul@users.noreply.github.com> Date: Fri, 5 Jan 2024 12:10:09 +0530 Subject: [PATCH 06/15] Fix the loading of LTR reference Bible resources as RTL (#290) --- .../src/components/EditorPage/TextEditor/ReferenceScribex.jsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/renderer/src/components/EditorPage/TextEditor/ReferenceScribex.jsx b/renderer/src/components/EditorPage/TextEditor/ReferenceScribex.jsx index 9d128a8f9..43816f27d 100644 --- a/renderer/src/components/EditorPage/TextEditor/ReferenceScribex.jsx +++ b/renderer/src/components/EditorPage/TextEditor/ReferenceScribex.jsx @@ -27,7 +27,6 @@ export default function ReferenceScribex(props) { const { state: { fontSize, - projectScriptureDir, }, } = useContext(ReferenceContext); @@ -85,7 +84,6 @@ export default function ReferenceScribex(props) { fontFamily: font || 'sans-serif', fontSize: `${fontSize}rem`, lineHeight: (fontSize > 1.3) ? 1.5 : '', - direction: `${projectScriptureDir === 'RTL' ? 'rtl' : 'auto'}`, }} > From 08e4aad52ac5465af31dbc265e2b0ea849a955c2 Mon Sep 17 00:00:00 2001 From: Siju Moncy <72241997+sijumoncy@users.noreply.github.com> Date: Fri, 5 Jan 2024 14:01:04 +0530 Subject: [PATCH 07/15] fix for localized name remove on edit (#291) --- renderer/src/core/burrito/createTranslationSB.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/renderer/src/core/burrito/createTranslationSB.js b/renderer/src/core/burrito/createTranslationSB.js index d48680539..3fe19c45c 100644 --- a/renderer/src/core/burrito/createTranslationSB.js +++ b/renderer/src/core/burrito/createTranslationSB.js @@ -18,7 +18,7 @@ call, update, ) => { logger.debug('createTranslationSB.js', 'In createTranslationSB'); - const localizedNames = {}; + let localizedNames = {}; return new Promise((resolve) => { let json = {}; if (call === 'edit') { @@ -54,9 +54,19 @@ update, } else { json.copyright.licenses[0].ingredient = 'license.md'; } + + if (call === 'edit') { + localizedNames = JSON.parse(JSON.stringify(json.localizedNames)); + Object.keys(json.type.flavorType.currentScope).forEach((scope) => { + if (!localizedNames[scope]) { + localizedNames[scope] = burrito.localizedNames[scope]; + } + }); + } + selectedScope.forEach((scope) => { json.type.flavorType.currentScope[scope] = []; - localizedNames[scope] = json.localizedNames[scope]; + localizedNames[scope] = burrito.localizedNames[scope]; }); json.localizedNames = localizedNames; logger.debug('createTranslationSB.js', 'Created the Translation SB'); From 6df8d236ac29ca7b97d55917bf4517559b3902b4 Mon Sep 17 00:00:00 2001 From: VIPIN PAUL <37212471+vipinpaul@users.noreply.github.com> Date: Fri, 5 Jan 2024 14:01:18 +0530 Subject: [PATCH 08/15] Updating the version (#292) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1fe1f4040..1af3c153f 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "productName": "scribe-scripture-editor", "description": "A friendly assistant for Bible Translators.", "author": "Bible Technology ", - "version": "0.5.6", + "version": "0.5.7", "license": "MIT", "private": true, "main": "main/index.js", From ded3ff4d9f8f08fcc395214523f82c745c8afb37 Mon Sep 17 00:00:00 2001 From: VIPIN PAUL <37212471+vipinpaul@users.noreply.github.com> Date: Mon, 15 Jan 2024 12:27:33 +0530 Subject: [PATCH 09/15] Added book and chapter overview for tN (#299) * added tab UI for tn notes changes * Added book and chapter overview for tN --------- Co-authored-by: sijumoncy <72241997+sijumoncy@users.noreply.github.com> --- .vscode/settings.json | 2 +- .../EditorPage/Reference/TabSelector.js | 43 +++++++++++ .../Reference/TranslationHelpsCard.js | 73 ++++++++++++++----- 3 files changed, 98 insertions(+), 20 deletions(-) create mode 100644 renderer/src/components/EditorPage/Reference/TabSelector.js diff --git a/.vscode/settings.json b/.vscode/settings.json index 0ecec27ec..6c3fb1be8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -27,7 +27,7 @@ "eslint.codeAction.disableRuleComment": {}, "eslint.codeAction.showDocumentation": {}, "editor.codeActionsOnSave": { - "source.fixAll.eslint": true + "source.fixAll.eslint": "explicit" }, "eslint.workingDirectories": [], "editor.tabSize": 2 diff --git a/renderer/src/components/EditorPage/Reference/TabSelector.js b/renderer/src/components/EditorPage/Reference/TabSelector.js new file mode 100644 index 000000000..a99e27b32 --- /dev/null +++ b/renderer/src/components/EditorPage/Reference/TabSelector.js @@ -0,0 +1,43 @@ +import React from 'react'; +import { Tab } from '@headlessui/react'; +import PropTypes from 'prop-types'; + +function classNames(...classes) { + return classes.filter(Boolean).join(' '); +} + +function TabSelector({ currentTab, setCurrentTab, tabData }) { + return ( +
+ + + {tabData.map((data) => ( + classNames( + 'w-full rounded-lg py-1 text-sm font-medium leading-5', + 'ring-white/60 ring-offset-2 ring-offset-gray-400 focus:outline-none focus:ring-2', + selected + ? 'bg-primary/80 text-white shadow' + : 'text-[#4b5563] hover:bg-[#4b5563]/40 hover:text-white', + )} + > + {data.title} + + ))} + + +
+ ); +} + +export default TabSelector; + +TabSelector.propTypes = { + currentTab: PropTypes.object, + setCurrentTab: PropTypes.func, + tabData: PropTypes.shape({ + id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), + title: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), + }), +}; diff --git a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js index 303ca2020..1b15f9323 100644 --- a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js +++ b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js @@ -8,6 +8,13 @@ import LoadingScreen from '@/components/Loading/LoadingScreen'; import ReferenceCard from './ReferenceCard'; import * as logger from '../../../logger'; import packageInfo from '../../../../../package.json'; +import TabSelector from './TabSelector'; + +const tnTabHeads = [ + { id: 1, title: 'Book Overview' }, + { id: 2, title: 'Chapter Overview' }, + { id: 3, title: 'Verse Note' }, +]; export default function TranslationHelpsCard({ title, @@ -31,10 +38,14 @@ export default function TranslationHelpsCard({ const [offlineMarkdown, setOfflineMarkdown] = useState(''); const [resetTrigger, setResetTrigger] = useState(false); + const [currentTnTab, setCurrentTnTab] = useState(2); + + const [currentChapterVerse, setCurrentChapterVerse] = useState({ verse, chapter }); + // eslint-disable-next-line prefer-const let { items, markdown, isLoading } = useContent({ - verse, - chapter, + verse: currentChapterVerse.verse, + chapter: currentChapterVerse.chapter, projectId, branch, languageId, @@ -45,6 +56,16 @@ export default function TranslationHelpsCard({ readyToFetch: true, }); + useEffect(() => { + if (currentTnTab === 1) { + setCurrentChapterVerse({ chapter, verse: 'intro' }); + } else if (currentTnTab === 0) { + setCurrentChapterVerse({ verse: 'intro', chapter: 'front' }); + } else { + setCurrentChapterVerse({ verse, chapter }); + } + }, [currentTnTab, verse, chapter]); + useEffect(() => { if (offlineResource && offlineResource.offline) { // read tn tsv contents and pass to items @@ -103,7 +124,7 @@ export default function TranslationHelpsCard({ return { Book, Chapter, Verse, ID, [noteName]: file.split('\t')[indexOfNote], }; - }).filter((data) => data.Chapter === chapter && data.Verse === verse); + }).filter((data) => data.Chapter === currentChapterVerse.chapter && data.Verse === currentChapterVerse.verse); setOfflineItemsDisable(false); setOfflineItems(json); } @@ -225,23 +246,37 @@ export default function TranslationHelpsCard({ items = !offlineItemsDisable && offlineResource?.offline ? offlineItems : items; markdown = offlineResource?.offline ? offlineMarkdown : markdown; + if (resourceId === 'tn' && items) { + if (items[0]?.Note) { + items[0].Note = (items[0].Note).replace(/(
|\\n)/gm, '\n'); + } + if (items[0]?.OccurrenceNote) { + items[0].OccurrenceNote = (items[0].OccurrenceNote).replace(/(
|\\n)/gm, '\n'); + } + } + return ( - (markdown || items) ? ( - - ) : + <> + {resourceId === 'tn' && ()} + {(markdown || items) ? ( + + ) + : } + ); } From dc6a78046875f99cac198cd4a07d450f207b9da7 Mon Sep 17 00:00:00 2001 From: Siju Moncy <72241997+sijumoncy@users.noreply.github.com> Date: Fri, 19 Jan 2024 15:40:17 +0530 Subject: [PATCH 10/15] name chaged from offline sync to save to computer in the message (#304) --- renderer/src/components/Sync/Scribe/SyncToGitea.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renderer/src/components/Sync/Scribe/SyncToGitea.js b/renderer/src/components/Sync/Scribe/SyncToGitea.js index d40d0ec05..6a89e1cc1 100644 --- a/renderer/src/components/Sync/Scribe/SyncToGitea.js +++ b/renderer/src/components/Sync/Scribe/SyncToGitea.js @@ -92,7 +92,7 @@ export async function uploadToGitea(projectDataAg, auth, setSyncProgress, notify
OR
You can do - OFFLINE SYNC + Save To Computer which will overwrite all unsynced changes with the data of Door43.
From 8bea62f44194be746e6dc9600fc5e4cc57bcfc4f Mon Sep 17 00:00:00 2001 From: VIPIN PAUL <37212471+vipinpaul@users.noreply.github.com> Date: Fri, 19 Jan 2024 15:52:40 +0530 Subject: [PATCH 11/15] Updated the metadata URL to scribe web site (#305) --- renderer/src/components/Sync/Gitea/SyncFromGiteaUtils.js | 2 +- renderer/src/core/burrito/createAudioSB.js | 2 ++ renderer/src/core/burrito/createObsSB.js | 2 ++ renderer/src/core/burrito/createTranslationSB.js | 2 ++ renderer/src/core/burrito/importBurrito.js | 2 +- renderer/src/layouts/projects/Export/ExportProjectPopUp.js | 2 ++ renderer/src/lib/AudioBurritoTemplete.json | 2 +- renderer/src/lib/BurritoTemplete.json | 2 +- renderer/src/lib/OBSTemplete.json | 2 +- 9 files changed, 13 insertions(+), 5 deletions(-) diff --git a/renderer/src/components/Sync/Gitea/SyncFromGiteaUtils.js b/renderer/src/components/Sync/Gitea/SyncFromGiteaUtils.js index df6177a3d..3b1bd1109 100644 --- a/renderer/src/components/Sync/Gitea/SyncFromGiteaUtils.js +++ b/renderer/src/components/Sync/Gitea/SyncFromGiteaUtils.js @@ -211,7 +211,7 @@ export const importServerProject = async (updateBurrito, repo, sbData, auth, use }); sbDataObject.idAuthorities = { scribe: { - id: 'http://www.autographa.org', + id: 'http://www.scribe.bible', name: { en: 'Scribe application', }, diff --git a/renderer/src/core/burrito/createAudioSB.js b/renderer/src/core/burrito/createAudioSB.js index cf4b33d11..4f75fc5bc 100644 --- a/renderer/src/core/burrito/createAudioSB.js +++ b/renderer/src/core/burrito/createAudioSB.js @@ -49,6 +49,8 @@ update, json.identification.name.en = projectFields.projectName; json.identification.abbreviation.en = projectFields.abbreviation; json.languages[0].name.en = language; + // Adding the below line in 0.5.8 version, since the id in the previous versions is autographa.org + json.idAuthorities.scribe.id = 'http://www.scribe.bible'; if (call === 'edit' && project?.copyright?.shortStatements && (copyright.licence).length <= 500) { json.copyright.shortStatements[0].statement = copyright.licence; } else { diff --git a/renderer/src/core/burrito/createObsSB.js b/renderer/src/core/burrito/createObsSB.js index ec6a27e72..5335ff5a3 100644 --- a/renderer/src/core/burrito/createObsSB.js +++ b/renderer/src/core/burrito/createObsSB.js @@ -47,6 +47,8 @@ update, json.identification.name.en = projectFields.projectName; json.identification.abbreviation.en = projectFields.abbreviation; json.languages[0].name.en = language; + // Adding the below line in 0.5.8 version, since the id in the previous versions is autographa.org + json.idAuthorities.scribe.id = 'http://www.scribe.bible'; if (call === 'edit' && project?.copyright?.shortStatements && (copyright.licence).length <= 500) { json.copyright.shortStatements[0].statement = copyright.licence; } else { diff --git a/renderer/src/core/burrito/createTranslationSB.js b/renderer/src/core/burrito/createTranslationSB.js index 3fe19c45c..fbaef9c6c 100644 --- a/renderer/src/core/burrito/createTranslationSB.js +++ b/renderer/src/core/burrito/createTranslationSB.js @@ -49,6 +49,8 @@ update, json.identification.name.en = projectFields.projectName; json.identification.abbreviation.en = projectFields.abbreviation; json.languages[0].name.en = language; + // Adding the below line in 0.5.8 version, since the id in the previous versions is autographa.org + json.idAuthorities.scribe.id = 'http://www.scribe.bible'; if (call === 'edit' && project?.copyright?.shortStatements && (copyright.licence).length <= 500) { json.copyright.shortStatements[0].statement = copyright.licence; } else { diff --git a/renderer/src/core/burrito/importBurrito.js b/renderer/src/core/burrito/importBurrito.js index 50d0d565c..c85f14110 100644 --- a/renderer/src/core/burrito/importBurrito.js +++ b/renderer/src/core/burrito/importBurrito.js @@ -234,7 +234,7 @@ const importBurrito = async (filePath, currentUser, updateBurritoVersion, concat }); metadata.idAuthorities = { scribe: { - id: 'http://www.autographa.org', + id: 'http://www.scribe.bible', name: { en: 'Scribe application', }, diff --git a/renderer/src/layouts/projects/Export/ExportProjectPopUp.js b/renderer/src/layouts/projects/Export/ExportProjectPopUp.js index e1e072a7c..71c2dc477 100644 --- a/renderer/src/layouts/projects/Export/ExportProjectPopUp.js +++ b/renderer/src/layouts/projects/Export/ExportProjectPopUp.js @@ -89,6 +89,8 @@ export default function ExportProjectPopUp(props) { logger.debug('ExportProjectPopUp.js', 'Updated Scripture burrito'); let data = fs.readFileSync(path.join(folder, 'metadata.json'), 'utf-8'); const sb = JSON.parse(data); + // Adding the below line in 0.5.8 version, since the id in the previous versions is autographa.org + sb.idAuthorities.scribe.id = 'http://www.scribe.bible'; if (!sb.copyright?.shortStatements && sb.copyright?.licenses) { delete sb.copyright.publicDomain; data = JSON.stringify(sb); diff --git a/renderer/src/lib/AudioBurritoTemplete.json b/renderer/src/lib/AudioBurritoTemplete.json index 1107fedac..7bd58f9e2 100644 --- a/renderer/src/lib/AudioBurritoTemplete.json +++ b/renderer/src/lib/AudioBurritoTemplete.json @@ -14,7 +14,7 @@ }, "idAuthorities": { "scribe": { - "id": "http://www.autographa.org", + "id": "http://www.scribe.bible", "name": { "en": "Scribe application" } diff --git a/renderer/src/lib/BurritoTemplete.json b/renderer/src/lib/BurritoTemplete.json index c3f45fa47..18d3961b9 100644 --- a/renderer/src/lib/BurritoTemplete.json +++ b/renderer/src/lib/BurritoTemplete.json @@ -14,7 +14,7 @@ }, "idAuthorities": { "scribe": { - "id": "http://www.autographa.org", + "id": "http://www.scribe.bible", "name": { "en": "Scribe application" } diff --git a/renderer/src/lib/OBSTemplete.json b/renderer/src/lib/OBSTemplete.json index 94fdb1c5b..a8e5bea0c 100644 --- a/renderer/src/lib/OBSTemplete.json +++ b/renderer/src/lib/OBSTemplete.json @@ -13,7 +13,7 @@ }, "idAuthorities": { "scribe": { - "id": "http://www.autographa.org", + "id": "http://www.scribe.bible", "name": { "en": "Scribe application" } From 327a013bff1f6a82b988a33eac0ecb96a07e711e Mon Sep 17 00:00:00 2001 From: Samuel John <40059405+samueljd@users.noreply.github.com> Date: Fri, 19 Jan 2024 16:02:53 +0530 Subject: [PATCH 12/15] versewise navigation with arrow keys. (#300) * versewise navigation with arrow keys. * highlight text, navigate on same verse multi click * fixed scroll lock issue * removed highlight text --- .../EditorPage/TextEditor/Editor.jsx | 6 +- .../EditorPage/TextEditor/RecursiveBlock.jsx | 59 +++++++++-------- .../TextEditor/utils/IntersectionObserver.js | 31 ++++++--- .../TextEditor/utils/getReferences.js | 64 ++++++++++++++----- styles/globals.css | 4 ++ 5 files changed, 109 insertions(+), 55 deletions(-) diff --git a/renderer/src/components/EditorPage/TextEditor/Editor.jsx b/renderer/src/components/EditorPage/TextEditor/Editor.jsx index 03c1ad86e..9423e062c 100644 --- a/renderer/src/components/EditorPage/TextEditor/Editor.jsx +++ b/renderer/src/components/EditorPage/TextEditor/Editor.jsx @@ -1,5 +1,5 @@ import React, { - useContext, useEffect, useLayoutEffect, useRef, + useContext, useEffect, useLayoutEffect, useRef, } from 'react'; import { HtmlPerfEditor } from '@xelah/type-perf-html'; @@ -123,7 +123,7 @@ export default function Editor(props) { function onReferenceSelected({ chapter, verse }) { chapter && setChapterNumber(chapter); verse && setVerseNumber(verse); - scrollReference(chapter); + !scrollLock && scrollReference(chapter, verse); } const observer = new IntersectionObserver((entries) => onIntersection({ @@ -147,7 +147,7 @@ export default function Editor(props) { addSequenceId, components: { block: (__props) => RecursiveBlock({ - htmlPerf, onHtmlPerf: saveHtmlPerf, sequenceIds, addSequenceId, onReferenceSelected, setCaretPosition, setSelectedText, ...__props, + htmlPerf, onHtmlPerf: saveHtmlPerf, sequenceIds, addSequenceId, onReferenceSelected, setCaretPosition, setSelectedText, scrollLock, ...__props, }), }, options: { diff --git a/renderer/src/components/EditorPage/TextEditor/RecursiveBlock.jsx b/renderer/src/components/EditorPage/TextEditor/RecursiveBlock.jsx index 17e7f36f3..ce97f24a2 100644 --- a/renderer/src/components/EditorPage/TextEditor/RecursiveBlock.jsx +++ b/renderer/src/components/EditorPage/TextEditor/RecursiveBlock.jsx @@ -3,7 +3,9 @@ import React, { useEffect, useState } from 'react'; import { HtmlPerfEditor } from '@xelah/type-perf-html'; import { getCurrentCursorPosition, pasteTextAtCursorPosition } from '@/util/cursorUtils'; -import { getCurrentVerse, getCurrentChapter } from '@/components/EditorPage/TextEditor/utils/getReferences'; +import { + getCurrentVerse, getCurrentChapter, +} from '@/components/EditorPage/TextEditor/utils/getReferences'; import { on } from 'ws'; const getTarget = ({ content }) => { @@ -31,6 +33,7 @@ export default function RecursiveBlock({ onReferenceSelected, setCaretPosition, setSelectedText, + scrollLock, ...props }) { const [currentVerse, setCurrentVerse] = useState(null); @@ -40,27 +43,6 @@ export default function RecursiveBlock({ setCaretPosition(cursorPosition); }; - const checkReturnKeyPress = (event) => { - const activeTextArea = document.activeElement; - if (event.key === 'Enter') { - if (activeTextArea.children.length > 1) { - const lineBreak = activeTextArea.children[1]?.outerHTML; - activeTextArea.children[1].outerHTML = lineBreak.replace(//gi, ' '); - } - } - // BACKSPACE DISABLE - if (event.keyCode === 8) { - const range = document.getSelection().getRangeAt(0); - const selectedNode = range.startContainer; - const prevNode = selectedNode.previousSibling; - if (prevNode && prevNode.dataset.attsNumber !== currentVerse) { - event.preventDefault(); - } - prevNode ? setCurrentVerse(prevNode.dataset.attsNumber) : {}; - } - updateCursorPosition(); - }; - function handleSelection() { let selectedText = ''; if (window.getSelection) { @@ -72,19 +54,44 @@ export default function RecursiveBlock({ setSelectedText(selectedText); } } - const checkCurrentVerse = () => { if (document.getSelection().rangeCount >= 1 && onReferenceSelected) { const range = document.getSelection().getRangeAt(0); const selectedNode = range.startContainer; - const verse = getCurrentVerse(selectedNode); + const { verse } = getCurrentVerse(selectedNode); const chapter = getCurrentChapter(selectedNode); onReferenceSelected({ bookId, chapter, verse }); + // !scrollLock && hightlightRefVerse(chapter, verse); } updateCursorPosition(); handleSelection(); }; + const keyStrokeHandler = (event) => { + const activeTextArea = document.activeElement; + // Replace line break with space + if (event.key === 'Enter') { + if (activeTextArea.children.length > 1) { + const lineBreak = activeTextArea.children[1]?.outerHTML; + activeTextArea.children[1].outerHTML = lineBreak.replace(//gi, ' '); + } + } + // Disable backspace if the previous node is not the same verse + if (event.keyCode === 8) { + const range = document.getSelection().getRangeAt(0); + const selectedNode = range.startContainer; + const prevNode = selectedNode.previousSibling; + if (prevNode && prevNode.dataset.attsNumber !== currentVerse) { + event.preventDefault(); + } + prevNode ? setCurrentVerse(prevNode.dataset.attsNumber) : {}; + } + if ([37, 38, 39, 40].includes(event.keyCode)) { + checkCurrentVerse(); + updateCursorPosition(); + } + }; + function onPasteHandler(event) { const cursorPosition = getCurrentCursorPosition('editor'); const paste = (event.clipboardData || window.clipboardData).getData('text'); @@ -101,11 +108,11 @@ export default function RecursiveBlock({
{ event.preventDefault(); onPasteHandler(event); }} + {...props} /> ); } diff --git a/renderer/src/components/EditorPage/TextEditor/utils/IntersectionObserver.js b/renderer/src/components/EditorPage/TextEditor/utils/IntersectionObserver.js index dafa7eaf2..7ba0957aa 100644 --- a/renderer/src/components/EditorPage/TextEditor/utils/IntersectionObserver.js +++ b/renderer/src/components/EditorPage/TextEditor/utils/IntersectionObserver.js @@ -1,13 +1,24 @@ -export const scrollReference = (chapterNumber) => { - const refEditors = document.getElementsByClassName('ref-editor'); - refEditors.length > 0 && Array.prototype.filter.call(refEditors, (refEditor) => { - const editorInView = refEditor.querySelector(`#ch-${chapterNumber}`); - if (editorInView) { - editorInView.scrollIntoView(); - editorInView.classList.add('scroll-mt-10'); - } - }); -}; +export const scrollReference = (() => { + let prevCV; + return (c, v) => { + const refEditors = document.getElementsByClassName('ref-editor'); + refEditors.length > 0 && Array.prototype.filter.call(refEditors, (refEditor) => { + if (!prevCV || prevCV.c !== c) { + const chapterInView = refEditor.querySelector(`#ch-${c}`); + if (chapterInView) { + chapterInView.scrollIntoView(); + chapterInView.classList.add('scroll-mt-10'); + } + } else { + const verseInView = refEditor.querySelector(`#ch${c}v${v}`); + if (verseInView) { + verseInView.scrollIntoView(); + } + } + }); + prevCV = { c, v }; + }; +})(); export const onIntersection = ({ scroll, entries, setChapterNumber, scrollLock, setVerseNumber, diff --git a/renderer/src/components/EditorPage/TextEditor/utils/getReferences.js b/renderer/src/components/EditorPage/TextEditor/utils/getReferences.js index fe6cb92f2..b923fa370 100644 --- a/renderer/src/components/EditorPage/TextEditor/utils/getReferences.js +++ b/renderer/src/components/EditorPage/TextEditor/utils/getReferences.js @@ -1,17 +1,49 @@ export const getCurrentVerse = (currentNode) => { - let currentVerse; - let prev = currentNode.previousElementSibling; - while (prev) { - if (prev.dataset.type === 'mark' && prev.dataset.subtype === 'verses') { - currentVerse = prev.dataset.attsNumber; + let verse; + let previousElement = currentNode?.previousElementSibling; + const verseText = currentNode?.nextSibling; + while (previousElement) { + if (previousElement.dataset.type === 'mark' && previousElement.dataset.subtype === 'verses') { + verse = previousElement.dataset.attsNumber; break; } - // Get the previous sibling - prev = prev.previousElementSibling; + previousElement = previousElement?.previousElementSibling; } - return currentVerse; + return { verse, verseText }; }; +export const removeHighlightFromRefVerse = ({ c, v }) => { + const refEditors = document.getElementsByClassName('ref-editor'); + refEditors.length > 0 && Array.prototype.filter.call(refEditors, (refEditor) => { + const prevHighlight = refEditor.querySelector(`#ch${c}v${v}`)?.nextElementSibling; + const hightlightText = prevHighlight && prevHighlight.innerHTML; + prevHighlight && prevHighlight.replaceWith(hightlightText); + }); +}; + +export const hightlightRefVerse = (() => { + let prevCV; + return (c, v) => { + const refEditors = document.getElementsByClassName('ref-editor'); + refEditors.length > 0 && Array.prototype.filter.call(refEditors, (refEditor) => { + if (!(prevCV && prevCV.c !== c)) { + const verseInView = refEditor.querySelector(`#ch${c}v${v}`); + const { verseText } = getCurrentVerse(verseInView); + // highlight verse + const range = document.createRange(); + range.setStart(verseText, 0); + range.setEnd(verseText, verseText.textContent.length); + const newSpan = document.createElement('span'); + newSpan.classList.add('bg-primary-50'); + range.surroundContents(newSpan); + // remove highlight from previous verse + prevCV && removeHighlightFromRefVerse({ ...prevCV }); + } + }); + prevCV = { c, v }; + }; +})(); + export const getCurrentChapter = (currentNode) => { let currentChapter; const closestParaDiv = currentNode.parentNode.parentNode; @@ -20,13 +52,13 @@ export const getCurrentChapter = (currentNode) => { return currentChapter; } - let prevParaDiv = closestParaDiv.previousElementSibling; - while (prevParaDiv) { - if (prevParaDiv.firstElementChild?.firstElementChild?.classList.contains('chapter')) { - currentChapter = prevParaDiv.firstElementChild.firstElementChild.dataset.attsNumber; - break; - } - prevParaDiv = prevParaDiv.previousElementSibling; + let prevParaDiv = closestParaDiv.previousElementSibling; + while (prevParaDiv) { + if (prevParaDiv.firstElementChild?.firstElementChild?.classList.contains('chapter')) { + currentChapter = prevParaDiv.firstElementChild.firstElementChild.dataset.attsNumber; + break; } - return currentChapter; + prevParaDiv = prevParaDiv.previousElementSibling; + } + return currentChapter; }; diff --git a/styles/globals.css b/styles/globals.css index c544797b6..f716ddc74 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -103,6 +103,10 @@ p.paragraph:has(.chapter) { @apply text-primary text-sm; } +.ref-editor ::selection { + @apply bg-primary-50; +} + /* .perf .verse:after { visibility: visible; position: absolute; From 8d1e760e984bff1156f790bac26d996183f6ef5c Mon Sep 17 00:00:00 2001 From: VIPIN PAUL <37212471+vipinpaul@users.noreply.github.com> Date: Fri, 19 Jan 2024 16:14:53 +0530 Subject: [PATCH 13/15] Updating the version to 0.5.8 (#307) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1af3c153f..fd859be4e 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "productName": "scribe-scripture-editor", "description": "A friendly assistant for Bible Translators.", "author": "Bible Technology ", - "version": "0.5.7", + "version": "0.5.8", "license": "MIT", "private": true, "main": "main/index.js", From f77dfd3ac79b65c9d2d49c793f268b8b57dd74a7 Mon Sep 17 00:00:00 2001 From: danielc-n Date: Fri, 2 Feb 2024 10:26:24 +0100 Subject: [PATCH 14/15] Scripture Burrito as a resource : added the poissibility for the user to search and download a SB as a resource in a module --- .../ResourceUtils/DownloadResourcePopUp.js | 16 ++- .../createDownloadedResourceSB.js | 102 ++++++++++-------- .../Resources/useFetchTranslationResource.js | 6 +- renderer/src/translations/en.js | 2 +- renderer/src/translations/fa.js | 2 +- 5 files changed, 81 insertions(+), 47 deletions(-) diff --git a/renderer/src/components/Resources/ResourceUtils/DownloadResourcePopUp.js b/renderer/src/components/Resources/ResourceUtils/DownloadResourcePopUp.js index 8a9f889e9..b9edc54a4 100644 --- a/renderer/src/components/Resources/ResourceUtils/DownloadResourcePopUp.js +++ b/renderer/src/components/Resources/ResourceUtils/DownloadResourcePopUp.js @@ -46,6 +46,7 @@ function DownloadResourcePopUp({ selectResource, isOpenDonwloadPopUp, setIsOpenD const [selectedLangFilter, setSelectedLangFilter] = useState([]); const [selectedTypeFilter, setSelectedTypeFilter] = useState([]); const [selectedPreProd, setSelectedPreProd] = useState(false); + const [selectedScriptureBurrito, setselectedScriptureBurrito] = useState(false); // resource Download const [downloadStarted, setDownloadStarted] = useState(false); const [totalDownload, setTotalDownload] = useState(0); @@ -79,7 +80,8 @@ function DownloadResourcePopUp({ selectResource, isOpenDonwloadPopUp, setIsOpenD setLoading(true); // subject = bible and lang = en - if not custom filter or initial loading // const baseUrl = 'https://git.door43.org/api/catalog/v5/search'; - const baseUrl = `${environment.GITEA_API_ENDPOINT}/catalog/search?metadataType=rc`; + const metadataType = selectedScriptureBurrito ? 'sb' : 'rc'; + const baseUrl = `${environment.GITEA_API_ENDPOINT}/catalog/search?metadataType=${metadataType}`; let url = ''; if (filter) { url = `${baseUrl}`; @@ -372,6 +374,18 @@ function DownloadResourcePopUp({ selectResource, isOpenDonwloadPopUp, setIsOpenD />
+ {/* NicolasEdits : add scripture burrito check */} +
+ + setselectedScriptureBurrito(e.target.checked)} + /> +
+
- {/* NicolasEdits : add scripture burrito check */} -
- - setselectedScriptureBurrito(e.target.checked)} - /> -
-