From 129f4c81f334344de2907fed5b3b53c2b3590dad Mon Sep 17 00:00:00 2001 From: sijumoncy <72241997+sijumoncy@users.noreply.github.com> Date: Wed, 23 Aug 2023 15:21:03 +0530 Subject: [PATCH 01/34] resource url updation, fix for bible and obs download issue due to url change and response change, remove refactored deadcodes from earlier versions, bug fixes from earlier refactor --- .../EditorPage/Reference/TW/TwNavigation.js | 8 ++- .../EditorPage/Reference/TranslationHelps.js | 2 + .../Reference/TranslationHelpsCard.js | 5 +- .../src/components/Resources/ListResources.js | 31 ++++++++- .../ResourceUtils/CheckHelpsUpdatePopUp.js | 4 +- .../ResourceUtils/DownloadResourcePopUp.js | 67 +++++-------------- .../createDownloadedResourceSB.js | 5 +- .../Resources/useFetchTranslationResource.js | 4 +- 8 files changed, 64 insertions(+), 62 deletions(-) diff --git a/renderer/src/components/EditorPage/Reference/TW/TwNavigation.js b/renderer/src/components/EditorPage/Reference/TW/TwNavigation.js index 3574235ce..4dee6c222 100644 --- a/renderer/src/components/EditorPage/Reference/TW/TwNavigation.js +++ b/renderer/src/components/EditorPage/Reference/TW/TwNavigation.js @@ -7,6 +7,7 @@ import { SnackBar } from '@/components/SnackBar'; import * as logger from '../../../../logger'; import MultiComboBox from '../MultiComboBox'; import packageInfo from '../../../../../../package.json'; +import { environment } from '../../../../../environment'; export default function TwNavigation({ languageId, referenceResources, setReferenceResources }) { const [selected, setSelected] = useState(''); @@ -17,7 +18,7 @@ export default function TwNavigation({ languageId, referenceResources, setRefere const [snackText, setSnackText] = useState(''); const [error, setError] = useState(''); - const baseUrl = 'https://git.door43.org/api/v1/repos'; + // const baseUrl = 'https://git.door43.org/api/v1/repos'; const owner = referenceResources?.owner; useEffect(() => { @@ -81,7 +82,8 @@ export default function TwNavigation({ languageId, referenceResources, setRefere } else { // online // get options - fetch(`https://git.door43.org/api/catalog/v5/search?subject=Translation%20Words&lang=${languageId}&owner=${owner}`) + // 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) => { // console.log('meta : ', { meta }); @@ -112,7 +114,7 @@ export default function TwNavigation({ languageId, referenceResources, setRefere }); const fetchData = async () => { - await fetch(`${baseUrl}/${owner}/${languageId}_tw/contents/bible/${selectedOption}?ref=${meta?.data[0]?.release?.tag_name}`) + 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) => { diff --git a/renderer/src/components/EditorPage/Reference/TranslationHelps.js b/renderer/src/components/EditorPage/Reference/TranslationHelps.js index c35f497ec..a421c688b 100644 --- a/renderer/src/components/EditorPage/Reference/TranslationHelps.js +++ b/renderer/src/components/EditorPage/Reference/TranslationHelps.js @@ -22,6 +22,8 @@ const TranslationHelps = ({ const filePathTa = `${taNavigationPath?.path}/01.md`; + console.log({ selectedResource, languageId }); + return ( <> {(() => { diff --git a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js index e20622176..3c0a2a78e 100644 --- a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js +++ b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js @@ -43,7 +43,9 @@ export default function TranslationHelpsCard({ server, }); - // console.log('online data structure : ', { items, markdown, isLoading }); + console.log('online data structure : ', { + items, markdown, isLoading, offlineResource, languageId, resourceId, projectId, +}); const { state: { @@ -59,6 +61,7 @@ export default function TranslationHelpsCard({ // console.log('offline in Helpscard : ', offlineResource); // read tn tsv contents and pass to items try { + console.log('inisde offline ---'); setOfflineMarkdown(''); setOfflineItems(''); localForage.getItem('userProfile').then(async (user) => { diff --git a/renderer/src/components/Resources/ListResources.js b/renderer/src/components/Resources/ListResources.js index f6e490073..28db6b244 100644 --- a/renderer/src/components/Resources/ListResources.js +++ b/renderer/src/components/Resources/ListResources.js @@ -193,6 +193,7 @@ export const ListResources = ({ `${resource?.value?.meta?.subject} ${resource?.value?.meta?.language_title}`, resource?.value?.meta?.owner, resource?.value?.meta?.subject, + '', resource, )} role="button" @@ -207,7 +208,15 @@ export const ListResources = ({
handleRowSelect(e, resource?.value?.meta?.language, `${resource?.value?.meta?.subject} ${resource?.value?.meta?.language_title}`, resource?.value?.meta?.owner, resource?.value?.meta?.subject, resource)} + onClick={(e) => handleRowSelect( + e, + resource?.value?.meta?.language, + `${resource?.value?.meta?.subject} ${resource?.value?.meta?.language_title}`, + resource?.value?.meta?.owner, + resource?.value?.meta?.subject, + '', + resource, + )} role="button" tabIndex="0" > @@ -217,7 +226,15 @@ export const ListResources = ({
handleRowSelect(e, resource?.value?.meta?.language, `${resource?.value?.meta?.subject} ${resource?.value?.meta?.language_title}`, resource?.value?.meta?.owner, resource?.value?.meta?.subject, resource)} + onClick={(e) => handleRowSelect( + e, + resource?.value?.meta?.language, + `${resource?.value?.meta?.subject} ${resource?.value?.meta?.language_title}`, + resource?.value?.meta?.owner, + resource?.value?.meta?.subject, + '', + resource, + )} role="button" tabIndex="0" > @@ -227,7 +244,15 @@ export const ListResources = ({
handleRowSelect(e, resource?.value?.meta?.language, `${resource?.value?.meta?.subject} ${resource?.value?.meta?.language_title}`, resource?.value?.meta?.owner, resource?.value?.meta?.subject, resource)} + onClick={(e) => handleRowSelect( + e, + resource?.value?.meta?.language, + `${resource?.value?.meta?.subject} ${resource?.value?.meta?.language_title}`, + resource?.value?.meta?.owner, + resource?.value?.meta?.subject, + '', + resource, + )} role="button" tabIndex="0" > diff --git a/renderer/src/components/Resources/ResourceUtils/CheckHelpsUpdatePopUp.js b/renderer/src/components/Resources/ResourceUtils/CheckHelpsUpdatePopUp.js index 5be491d13..a2ee32651 100644 --- a/renderer/src/components/Resources/ResourceUtils/CheckHelpsUpdatePopUp.js +++ b/renderer/src/components/Resources/ResourceUtils/CheckHelpsUpdatePopUp.js @@ -11,6 +11,7 @@ import * as logger from '../../../logger'; import DownloadCreateSBforHelps from './DownloadCreateSBforHelps'; import { handleDownloadResources } from './createDownloadedResourceSB'; import Door43Logo from '@/icons/door43.svg'; +import { environment } from '../../../../environment'; // const path = require('path'); @@ -40,7 +41,8 @@ const checkHelpsVersionUpdate = async (reference, selectResource) => { owner = reference?.value?.meta?.owner; } if (subject && lang && owner) { - fetch(`https://git.door43.org/api/catalog/v5/search?subject=${subject}&lang=${lang}&owner=${owner}`) + // fetch(`https://git.door43.org/api/catalog/v5/search?subject=${subject}&lang=${lang}&owner=${owner}`) + fetch(`${environment.GITEA_API_ENDPOINT}/catalog/search?metadataType=rc&subject=${subject}&lang=${lang}&owner=${owner}`) .then((res) => res.json()) .then((resultMeta) => { // console.log({ resultMeta }); diff --git a/renderer/src/components/Resources/ResourceUtils/DownloadResourcePopUp.js b/renderer/src/components/Resources/ResourceUtils/DownloadResourcePopUp.js index a0b3a6382..c9d190841 100644 --- a/renderer/src/components/Resources/ResourceUtils/DownloadResourcePopUp.js +++ b/renderer/src/components/Resources/ResourceUtils/DownloadResourcePopUp.js @@ -9,8 +9,6 @@ import moment from 'moment'; import localForage from 'localforage'; import { useTranslation } from 'react-i18next'; import { SnackBar } from '@/components/SnackBar'; -import { Typography } from '@material-ui/core'; -import { makeStyles } from '@material-ui/core/styles'; import LoadingScreen from '@/components/Loading/LoadingScreen'; import { XMarkIcon, ArrowDownTrayIcon } from '@heroicons/react/24/solid'; import { AutographaContext } from '@/components/context/AutographaContext'; @@ -19,6 +17,7 @@ import CustomMultiComboBox from './CustomMultiComboBox'; import langJson from '../../../lib/lang/langNames.json'; import { handleDownloadResources } from './createDownloadedResourceSB'; import * as logger from '../../../logger'; +import { environment } from '../../../../environment'; const subjectTypeArray = { bible: [ @@ -32,30 +31,12 @@ const subjectTypeArray = { ], }; -// mui styles for accordion -const useStyles = makeStyles((theme) => ({ - root: { - backgroundColor: '#fff', - color: '#000', - boxShadow: '0px 0px 15px 1px rgba(0,0,0,0.43);', - - }, - summary: { - backgroundColor: '#fff', - }, - heading: { - fontSize: theme.typography.pxToRem(12), - fontWeight: '500', - color: '#000', - }, -})); - function DownloadResourcePopUp({ selectResource, isOpenDonwloadPopUp, setIsOpenDonwloadPopUp }) { logger.debug('DownloadResourcePopUp.js', 'in download resource pop up'); const { t } = useTranslation(); const [snackBar, setOpenSnackBar] = useState(false); const [loading, setLoading] = useState(false); - const [loadFilterDiv, setLoadFilterDiv] = useState(false); + // const [loadFilterDiv, setLoadFilterDiv] = useState(false); const [snackText, setSnackText] = useState(''); // eslint-disable-next-line no-unused-vars const [notify, setNotify] = useState(); @@ -68,7 +49,6 @@ function DownloadResourcePopUp({ selectResource, isOpenDonwloadPopUp, setIsOpenD const [totalDownload, setTotalDownload] = useState(0); // eslint-disable-next-line no-unused-vars const [downloadCount, setDownloadCount] = useState(0); - const [expandAccordion, setExpandAccordion] = useState(''); const { // states: { resourceDownload }, @@ -78,17 +58,6 @@ function DownloadResourcePopUp({ selectResource, isOpenDonwloadPopUp, setIsOpenD }, } = React.useContext(AutographaContext); - const modalClose = () => { - if (!downloadStarted) { - setIsOpenDonwloadPopUp(false); - } - }; - - const toggleAcordion = (element) => { - if (expandAccordion === element) { setExpandAccordion(''); } - if (expandAccordion !== element) { setExpandAccordion(element); } - }; - const addNewNotification = async (title, text, type) => { localForage.getItem('notification').then((value) => { const temp = [...value]; @@ -107,26 +76,19 @@ function DownloadResourcePopUp({ selectResource, isOpenDonwloadPopUp, setIsOpenD logger.debug('DownloadResourcePopUp.js', 'fetching resource as per filter applied'); 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 = 'https://git.door43.org/api/catalog/v5/search'; + const baseUrl = `${environment.GITEA_API_ENDPOINT}/catalog/search?metadataType=rc`; let url = ''; if (filter) { - url = `${baseUrl}?`; + url = `${baseUrl}`; if (selectedLangFilter.length > 0) { selectedLangFilter.forEach((row) => { - if (url.slice(-1) === '?') { - url += `lang=${row?.lc ? row?.lc : row?.code}`; - } else { - url += `&lang=${row?.lc ? row?.lc : row?.code}`; - } + url += `&lang=${row?.lc ? row?.lc : row?.code}`; }); } if (selectedTypeFilter.length > 0) { selectedTypeFilter.forEach((row) => { - if (url.slice(-1) === '?') { - url += `subject=${row.name}`; - } else { - url += `&subject=${row.name}`; - } + url += `&subject=${row.name}`; }); } else { // nothing selected default will be bible || obs @@ -145,15 +107,14 @@ function DownloadResourcePopUp({ selectResource, isOpenDonwloadPopUp, setIsOpenD // initial load switch (selectResource) { case 'bible': - url = `${baseUrl}?subject=Bible&lang=en`; + url = `${baseUrl}&subject=Bible&lang=en`; break; case 'obs': - url = `${baseUrl}?subject=${subjectTypeArray.obs[0].name}&lang=en`; + url = `${baseUrl}&subject=${subjectTypeArray.obs[0].name}&lang=en`; break; default: break; } - // url = `${baseUrl}?subject=Bible&subject=Aligned Bible&lang=en&lang=ml`; } // pre-release items if (selectedPreProd) { @@ -207,7 +168,7 @@ function DownloadResourcePopUp({ selectResource, isOpenDonwloadPopUp, setIsOpenD const handleSaveFilter = async () => { logger.debug('DownloadResourcePopUp.js', 'save filter and call fetch'); if (!downloadStarted) { - setLoadFilterDiv(!loadFilterDiv); + // setLoadFilterDiv(!loadFilterDiv); if (selectedLangFilter.length > 0 || selectedTypeFilter.length > 0) { await fetchResource(true); } else { @@ -325,7 +286,8 @@ function DownloadResourcePopUp({ selectResource, isOpenDonwloadPopUp, setIsOpenD // eslint-disable-next-line react-hooks/exhaustive-deps }, []); - const classes = useStyles(); + // const classes = useStyles(); + const removeLanguage = (idx) => { selectedLangFilter.splice(idx, 1); setSelectedLangFilter([...selectedLangFilter]); @@ -447,7 +409,8 @@ function DownloadResourcePopUp({ selectResource, isOpenDonwloadPopUp, setIsOpenD
- + */}
{ + resourceMeta.projects.forEach(({ identifier: scope }) => { json.type.flavorType.currentScope[scope.toUpperCase()] = []; localizedNames[scope.toUpperCase()] = json.localizedNames[scope.toUpperCase()]; }); @@ -208,6 +209,7 @@ export const generateResourceIngredientsOBS = async (currentResourceMeta, path, }; export const handleDownloadResources = async (resourceData, selectResource, action, update = false) => { + console.log(resourceData, selectResource, action); logger.debug('DownloadResourcePopUp.js', 'In resource download - started : '); const newpath = localStorage.getItem('userPath'); // console.log({ @@ -266,6 +268,7 @@ export const handleDownloadResources = async (resourceData, selectResource, acti currentResourceProject = resource; // creating burrito template resourceBurritoFile = await createDownloadedResourceSB(user?.username, currentResourceMeta, currentResourceProject, selectResource); + console.log({ resourceBurritoFile }); // adding online fetch response meta as resourceMeta resourceBurritoFile.resourceMeta = currentResourceProject; resourceBurritoFile.resourceMeta.lastUpdatedAg = moment().format(); diff --git a/renderer/src/components/Resources/useFetchTranslationResource.js b/renderer/src/components/Resources/useFetchTranslationResource.js index 0329fb2b0..3653f7480 100644 --- a/renderer/src/components/Resources/useFetchTranslationResource.js +++ b/renderer/src/components/Resources/useFetchTranslationResource.js @@ -1,5 +1,6 @@ /* eslint-disable no-undef */ import * as logger from '../../logger'; +import { environment } from '../../../environment'; function createData(name, language, owner) { return { @@ -8,7 +9,8 @@ function createData(name, language, owner) { } export const fetchTranslationResource = async (urlpath, setResource, selectResource, selectedPreProd, snackBarAction) => { logger.debug('ResourcesPopUp.js', `fetchTranslationResource : ${selectResource}`); - const baseUrl = 'https://git.door43.org/api/catalog/v5/search?'; + // const baseUrl = 'https://git.door43.org/api/catalog/v5/search?'; + const baseUrl = `${environment.GITEA_API_ENDPOINT}/catalog/search?metadataType=rc&`; let url = `${baseUrl}subject=${urlpath}`; if (selectedPreProd) { url += '&stage=preprod'; From 20e1b0e575dd1b834db57fff9368c376caa38baa Mon Sep 17 00:00:00 2001 From: sijumoncy <72241997+sijumoncy@users.noreply.github.com> Date: Wed, 23 Aug 2023 16:12:17 +0530 Subject: [PATCH 02/34] fixed TA resource load online and offline issue --- .../EditorPage/Reference/TA/TaNavigation.js | 22 ++++++------------- .../Reference/TranslationHelpsCard.js | 5 ----- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/renderer/src/components/EditorPage/Reference/TA/TaNavigation.js b/renderer/src/components/EditorPage/Reference/TA/TaNavigation.js index 3c44b76aa..9acb8f74f 100644 --- a/renderer/src/components/EditorPage/Reference/TA/TaNavigation.js +++ b/renderer/src/components/EditorPage/Reference/TA/TaNavigation.js @@ -7,6 +7,7 @@ import localForage from 'localforage'; import * as logger from '../../../../logger'; import MultiComboBox from '../MultiComboBox'; import packageInfo from '../../../../../../package.json'; +import { environment } from '../../../../../environment'; export default function TaNavigation({ languageId, referenceResources }) { const [selected, setSelected] = useState(''); @@ -15,15 +16,7 @@ export default function TaNavigation({ languageId, referenceResources }) { // const [hovered, setHovered] = useState(null); const [taList, setTaList] = useState([]); - const BaseUrl = 'https://git.door43.org/api/v1/repos/'; - - // const setHover = (index) => { - // setHovered(index); - // }; - - // const unsetHover = () => { - // setHovered(null); - // }; + const BaseUrl = `${environment.GITEA_API_ENDPOINT}/repos/`; const { state: { @@ -35,7 +28,7 @@ export default function TaNavigation({ languageId, referenceResources }) { }, } = useContext(ReferenceContext); -useEffect(() => { + useEffect(() => { if (referenceResources && referenceResources?.offlineResource?.offline) { // offline const taArrayOffline = []; @@ -50,8 +43,8 @@ useEffect(() => { 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}`; // multiple books or options - if (offlineResource?.data?.value?.books.length > 0) { - setoptions(offlineResource?.data?.value?.books); + if (offlineResource?.data?.value?.meta?.books.length > 0) { + setoptions(offlineResource.data.value.meta.books); } // if (fs.existsSync(path.join(folder, projectName, 'translate'))) { if (selectedOption && fs.existsSync(path.join(folder, projectName, selectedOption))) { @@ -85,7 +78,7 @@ useEffect(() => { fetch(`${BaseUrl}${owner}/${languageId}_ta/`) .then((response) => response.json()) .then((actualData) => { - // get avaialble books + // get avaialble books/ingredients if (actualData?.books?.length > 0 && !options.length > 0) { setoptions(actualData?.books); } @@ -111,7 +104,6 @@ useEffect(() => { tempObj.subTitle = data; }); taArray.push(tempObj); - // console.log("array : ", taArray); } }); }); @@ -129,7 +121,7 @@ useEffect(() => { logger.debug('In Fetch TA Content.js', `Error in Fetch : ${err.message}`); }); } - }, [languageId, options, owner, referenceResources, selectedOption]); + }, [BaseUrl, languageId, options, owner, referenceResources, selectedOption]); useEffect(() => { if (referenceResources?.offlineResource?.offline) { diff --git a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js index 3c0a2a78e..4d3413027 100644 --- a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js +++ b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js @@ -43,10 +43,6 @@ export default function TranslationHelpsCard({ server, }); - console.log('online data structure : ', { - items, markdown, isLoading, offlineResource, languageId, resourceId, projectId, -}); - const { state: { item, headers, fontSize, itemIndex, markdownView, @@ -61,7 +57,6 @@ export default function TranslationHelpsCard({ // console.log('offline in Helpscard : ', offlineResource); // read tn tsv contents and pass to items try { - console.log('inisde offline ---'); setOfflineMarkdown(''); setOfflineItems(''); localForage.getItem('userProfile').then(async (user) => { From 9957e6ad141b6f57a2522a887901603afb4547ce Mon Sep 17 00:00:00 2001 From: sijumoncy <72241997+sijumoncy@users.noreply.github.com> Date: Wed, 23 Aug 2023 18:59:44 +0530 Subject: [PATCH 03/34] try to fix TN issue --- .../src/components/EditorPage/Reference/TranslationHelps.js | 2 -- .../components/EditorPage/Reference/TranslationHelpsCard.js | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/renderer/src/components/EditorPage/Reference/TranslationHelps.js b/renderer/src/components/EditorPage/Reference/TranslationHelps.js index a421c688b..c35f497ec 100644 --- a/renderer/src/components/EditorPage/Reference/TranslationHelps.js +++ b/renderer/src/components/EditorPage/Reference/TranslationHelps.js @@ -22,8 +22,6 @@ const TranslationHelps = ({ const filePathTa = `${taNavigationPath?.path}/01.md`; - console.log({ selectedResource, languageId }); - return ( <> {(() => { diff --git a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js index 4d3413027..697e12556 100644 --- a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js +++ b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js @@ -52,6 +52,8 @@ export default function TranslationHelpsCard({ }, } = useCardState({ items }); + console.log({ item }); + useEffect(() => { if (offlineResource && offlineResource.offline) { // console.log('offline in Helpscard : ', offlineResource); @@ -154,6 +156,8 @@ export default function TranslationHelpsCard({ items = !offlineItemsDisable && offlineResource?.offline ? offlineItems : items; markdown = offlineResource?.offline ? offlineMarkdown : markdown; + console.log({ items }, offlineResource?.offline); + return ( <> Date: Wed, 23 Aug 2023 19:55:51 +0530 Subject: [PATCH 04/34] fixed not merging without conflict . pull out file copy function from component to utils --- .../projects/Import/ConflictResolverUI.jsx | 26 ++------------- .../layouts/projects/Import/mergeObsUtils.js | 32 +++++++++++++++++++ .../layouts/projects/Import/mergeProject.js | 15 +++++++-- 3 files changed, 46 insertions(+), 27 deletions(-) diff --git a/renderer/src/layouts/projects/Import/ConflictResolverUI.jsx b/renderer/src/layouts/projects/Import/ConflictResolverUI.jsx index e6b78087a..83e8f048d 100644 --- a/renderer/src/layouts/projects/Import/ConflictResolverUI.jsx +++ b/renderer/src/layouts/projects/Import/ConflictResolverUI.jsx @@ -2,12 +2,11 @@ import React, { useRef, Fragment, useState, useEffect, } from 'react'; import { Dialog, Transition } from '@headlessui/react'; -import { commitChanges } from '@/components/Sync/Isomorphic/utils'; import { XMarkIcon } from '@heroicons/react/24/outline'; import ConfirmationModal from '@/layouts/editor/ConfirmationModal'; import * as logger from '../../../logger'; import ConflictSideBar from './ConflictSideBar'; -import { parseObs, updateAndSaveStory } from './mergeObsUtils'; +import { copyFilesTempToOrginal, parseObs, updateAndSaveStory } from './mergeObsUtils'; import ConflictEditor from './ConflictEditor'; function ConflictResolverUI({ conflictData, setConflictPopup }) { @@ -28,28 +27,7 @@ function ConflictResolverUI({ conflictData, setConflictPopup }) { const finishMergeMoveFiletoProject = async (conflictData) => { logger.debug('conflictResolverUI.jsx', 'in finish merge process and copy final data to project'); setFinishingMerge(true); - const path = require('path'); - const fs = window.require('fs'); - const fse = window.require('fs-extra'); - // copy all md from merge main to project main - await fse.copy( - conflictData.data.mergeDirPath, - path.join(conflictData.data.projectPath, conflictData.data.projectContentDirName), - ); - // remove .git dir from the copied files - await fs.rmdirSync(path.join(conflictData.data.projectPath, conflictData.data.projectContentDirName, '.git'), { recursive: true }, (err) => { - if (err) { - throw new Error(`Failed to remove .git from projects ingredients : ${err}`); - } - }); - // commit changes in project Dir - await commitChanges(fs, conflictData.data.projectPath, conflictData.data.author, 'commit conflcit resolved'); - // delete tempDir - await fs.rmdirSync(conflictData.data.mergeDirPath, { recursive: true }, (err) => { - if (err) { - throw new Error(`Merge Dir exist. Failed to remove : ${err}`); - } - }); + await copyFilesTempToOrginal(conflictData); setFinishingMerge(false); logger.debug('conflictResolverUI.jsx', 'finished merge . copy done. delete temp dir and .git'); }; diff --git a/renderer/src/layouts/projects/Import/mergeObsUtils.js b/renderer/src/layouts/projects/Import/mergeObsUtils.js index 76a5edffa..6207f6689 100644 --- a/renderer/src/layouts/projects/Import/mergeObsUtils.js +++ b/renderer/src/layouts/projects/Import/mergeObsUtils.js @@ -1,4 +1,5 @@ // parse obs story based on the story number +import { commitChanges } from '@/components/Sync/Isomorphic/utils'; import JsonToMd from '../../../obsRcl/JsonToMd/JsonToMd'; import * as logger from '../../../logger'; // import OBSData from '../../../lib/OBSData.json'; @@ -203,3 +204,34 @@ export async function createAllMdInDir(dirPath) { return false; } } + +export async function copyFilesTempToOrginal(conflictData) { + try { + const path = require('path'); + const fs = window.require('fs'); + const fse = window.require('fs-extra'); + + // copy all md from merge main to project main + await fse.copy( + conflictData.data.mergeDirPath, + path.join(conflictData.data.projectPath, conflictData.data.projectContentDirName), + ); + // remove .git dir from the copied files + await fs.rmdirSync(path.join(conflictData.data.projectPath, conflictData.data.projectContentDirName, '.git'), { recursive: true }, (err) => { + if (err) { + throw new Error(`Failed to remove .git from projects ingredients : ${err}`); + } + }); + // commit changes in project Dir + await commitChanges(fs, conflictData.data.projectPath, conflictData.data.author, 'commit conflcit resolved'); + // delete tempDir + await fs.rmdirSync(conflictData.data.mergeDirPath, { recursive: true }, (err) => { + if (err) { + throw new Error(`Merge Dir exist. Failed to remove : ${err}`); + } + }); + return true; + } catch (err) { + return false; + } +} diff --git a/renderer/src/layouts/projects/Import/mergeProject.js b/renderer/src/layouts/projects/Import/mergeProject.js index 98477b802..45a2e8a78 100644 --- a/renderer/src/layouts/projects/Import/mergeProject.js +++ b/renderer/src/layouts/projects/Import/mergeProject.js @@ -13,7 +13,7 @@ import { readUserSettings } from '@/core/projects/userSettings'; import packageInfo from '../../../../../package.json'; import * as logger from '../../../logger'; import { environment } from '../../../../environment'; -import { createAllMdInDir } from './mergeObsUtils'; +import { copyFilesTempToOrginal, createAllMdInDir } from './mergeObsUtils'; const path = require('path'); @@ -150,8 +150,17 @@ export const mergeProject = async (incomingPath, currentUser, setConflictPopup, const mergeStatus = checkoutMainStatus && await mergeBranches(fs, mergeDirPath, tempMergeMain, tempMergeIncoming); if (mergeStatus.status) { // Isomorphic git is doing an extra merge or logic cause deletion of the merged data at staging state - await checkoutJsonFiles(fs, targetPath, tempMergeMain); - logger.debug('mergeProject.js', 'merge done - No conflcit'); + await checkoutJsonFiles(fs, mergeDirPath, tempMergeMain); + const conflictData = { + data: { + mergeDirPath, + projectPath: targetPath, + projectContentDirName: dirName, + author, + }, + }; + const finalCopy = await copyFilesTempToOrginal(conflictData); + logger.debug('mergeProject.js', 'merge done - No conflcit', finalCopy); } else if (mergeStatus.status === false && mergeStatus?.data) { logger.debug('mergeProject.js', 'merge done - conflcit. Opening resolver window'); // conflcit section From 3cd330cbb05de54834430abe96ac4bd854fbafe3 Mon Sep 17 00:00:00 2001 From: sijumoncy <72241997+sijumoncy@users.noreply.github.com> Date: Thu, 24 Aug 2023 13:25:09 +0530 Subject: [PATCH 05/34] fixed footer conflcit issue when edit last line in the story, added dev dosc : overview of ofline merge process --- docs/Development/Offline-Merge.md | 30 +++++++++++++++++++ .../layouts/projects/Import/mergeObsUtils.js | 14 +++++---- 2 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 docs/Development/Offline-Merge.md diff --git a/docs/Development/Offline-Merge.md b/docs/Development/Offline-Merge.md new file mode 100644 index 000000000..ad61bbe35 --- /dev/null +++ b/docs/Development/Offline-Merge.md @@ -0,0 +1,30 @@ +# Offline Merge Development Document + +Offline Merge or Local merge is a functionality to combine the project based on [Scripture Burrito](https://docs.burrito.bible/en/latest/) with contributions from different collabarators + +- Current Support for OBS + +## Expected Work Flow + +- open scribe app and create OBS project +- export and share the project with collabarators +- Collabarator need to import the project on his/her scribe app and edit assigned story/sections +- export the project after finishing the work and send back the project to manager / owner. (He can also merge if he have somebody else changes). +- Owner / Manager import the project from the collabarator to his/her scribe app +- When the owner import the project , he will be prompted with a popup have 3 options _cancel_ , _replace_ and _merge_ + +- click and proceed with _**merge**_ option. + +### Case 1 - No Conflict + +- if there is no conflict in the merge process. Success message will be shown and all the combined changes will be avaialble in the project in scribe + +### Case 2 - Conflict + +- If there is a conflict in the merge process , a new window of _**Conflict Resolver**_ will be pop up + +- In the conflict Resolver window , all files with conflict will be listed and conflicted content will be show in the editor window with multiple option to accept which change need to accept . + +- once all the conflict is finished . click done and finish the merge process + +- Now the project in scribe will have all combined changes. diff --git a/renderer/src/layouts/projects/Import/mergeObsUtils.js b/renderer/src/layouts/projects/Import/mergeObsUtils.js index 6207f6689..96465c19b 100644 --- a/renderer/src/layouts/projects/Import/mergeObsUtils.js +++ b/renderer/src/layouts/projects/Import/mergeObsUtils.js @@ -23,18 +23,20 @@ export async function parseObs(conflictData, selectedFileName) { // eslint-disable-next-line react/prop-types const allLines = fileContent.split(/\r\n|\n/); logger.debug('ObsEditor.js', 'Spliting the stories line by line and storing into an array.'); - // Reading line by line + + // filter alllines to remove empty lines from the array + const allLineFiltered = allLines.filter((line) => line !== ''); // parse handling HEADER and Footer Conflicts let headerConflcit = false; let footerConflcit = false; let footerConflcitFoundIndex; - if (allLines[0].startsWith('<<<<<')) { + if (allLineFiltered[0].startsWith('<<<<<')) { headerConflcit = true; } - allLines.forEach((line, index) => { + allLineFiltered.forEach((line, index) => { // To avoid the values after footer, we have added id=0 if (line && id !== 0 && footerConflcit === false) { if (headerConflcit) { @@ -57,7 +59,7 @@ export async function parseObs(conflictData, selectedFileName) { } // } else if (footerConflcit && !headerConflcit && line.startsWith('<<<<<') && allLines[index + 1].startsWith('_')) { - } else if (line.startsWith('<<<<<') && allLines[index + 1].startsWith('_')) { + } else if (line.startsWith('<<<<<') && allLineFiltered[index + 1].startsWith('_')) { // footer coflcit found from this line onwards pass execution to else footerConflcitFoundIndex = index; footerConflcit = true; @@ -131,10 +133,10 @@ export async function parseObs(conflictData, selectedFileName) { logger.debug('mergeObsUtils.js', 'Story for selected navigation is been set to the array for Editor'); // Handle conflcit in footer -- brark the loop when footer conflcit found - if (allLines && footerConflcit && footerConflcitFoundIndex) { + if (allLineFiltered && footerConflcit && footerConflcitFoundIndex) { logger.debug('mergeObsUtils.js', 'conflcit for footer section. Handling'); // handle footer with conflcit - const footerConflcitArr = allLines.slice(footerConflcitFoundIndex, allLines.length); + const footerConflcitArr = allLineFiltered.slice(footerConflcitFoundIndex, allLineFiltered.length); // add text field in last section -> normaly handled in footer section if (!('text' in stories[stories.length - 1])) { stories[stories.length - 1].text = ''; From 513fa009184e33649d21fd942eb1e7e58539d248 Mon Sep 17 00:00:00 2001 From: sijumoncy <72241997+sijumoncy@users.noreply.github.com> Date: Thu, 24 Aug 2023 14:37:54 +0530 Subject: [PATCH 06/34] changed table heading in resource download bible and obs. changed text for not content avaialble --- .../Reference/TranslationHelpsCard.js | 4 --- .../ResourceUtils/DownloadResourcePopUp.js | 26 ++++++++++++++++--- .../createDownloadedResourceSB.js | 3 --- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js index 697e12556..4d3413027 100644 --- a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js +++ b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js @@ -52,8 +52,6 @@ export default function TranslationHelpsCard({ }, } = useCardState({ items }); - console.log({ item }); - useEffect(() => { if (offlineResource && offlineResource.offline) { // console.log('offline in Helpscard : ', offlineResource); @@ -156,8 +154,6 @@ export default function TranslationHelpsCard({ items = !offlineItemsDisable && offlineResource?.offline ? offlineItems : items; markdown = offlineResource?.offline ? offlineMarkdown : markdown; - console.log({ items }, offlineResource?.offline); - return ( <> - Resource - Type + SUBJECT Organization + + release/Version + @@ -458,8 +460,24 @@ function DownloadResourcePopUp({ selectResource, isOpenDonwloadPopUp, setIsOpenD )) ) : ( - - No Content Available + +
+ +
This content is unavailable for this language
+
+ You can Import Own + {' '} + Scripture Burrito + {' '} + Resources through + Collection + tab. +
+
+ Learn more about creating Scripture Burrito projects with Scribe. Refer Scribe Docs. +
+
+ )} diff --git a/renderer/src/components/Resources/ResourceUtils/createDownloadedResourceSB.js b/renderer/src/components/Resources/ResourceUtils/createDownloadedResourceSB.js index a9e0cb09a..221983d2d 100644 --- a/renderer/src/components/Resources/ResourceUtils/createDownloadedResourceSB.js +++ b/renderer/src/components/Resources/ResourceUtils/createDownloadedResourceSB.js @@ -98,7 +98,6 @@ export const createDownloadedResourceSB = async (username, resourceMeta, project statement: resourceMeta?.dublin_core?.rights, }, ]; - console.log({ resourceMeta }); json.copyright.licenses[0].ingredient = 'LICENSE.md'; if (selectResource === 'bible') { resourceMeta.projects.forEach(({ identifier: scope }) => { @@ -209,7 +208,6 @@ export const generateResourceIngredientsOBS = async (currentResourceMeta, path, }; export const handleDownloadResources = async (resourceData, selectResource, action, update = false) => { - console.log(resourceData, selectResource, action); logger.debug('DownloadResourcePopUp.js', 'In resource download - started : '); const newpath = localStorage.getItem('userPath'); // console.log({ @@ -268,7 +266,6 @@ export const handleDownloadResources = async (resourceData, selectResource, acti currentResourceProject = resource; // creating burrito template resourceBurritoFile = await createDownloadedResourceSB(user?.username, currentResourceMeta, currentResourceProject, selectResource); - console.log({ resourceBurritoFile }); // adding online fetch response meta as resourceMeta resourceBurritoFile.resourceMeta = currentResourceProject; resourceBurritoFile.resourceMeta.lastUpdatedAg = moment().format(); From a75fb898f9ceea9d989095a4169cebaec98903c9 Mon Sep 17 00:00:00 2001 From: sijumoncy <72241997+sijumoncy@users.noreply.github.com> Date: Thu, 24 Aug 2023 15:26:59 +0530 Subject: [PATCH 07/34] remove trailing spaces from the obs text on save --- renderer/src/components/EditorPage/ObsEditor/ObsEditor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/renderer/src/components/EditorPage/ObsEditor/ObsEditor.js b/renderer/src/components/EditorPage/ObsEditor/ObsEditor.js index 130ba57d7..e7e7b2e13 100644 --- a/renderer/src/components/EditorPage/ObsEditor/ObsEditor.js +++ b/renderer/src/components/EditorPage/ObsEditor/ObsEditor.js @@ -41,14 +41,14 @@ const ObsEditor = () => { let title; let body = ''; let end; story.forEach((s) => { if (Object.prototype.hasOwnProperty.call(s, 'title')) { - title = `# ${s.title}\n\n`; + title = `# ${s.title.trim()}\n\n`; } if (Object.prototype.hasOwnProperty.call(s, 'end')) { const foot = ((s.end).trim()); end = `_${foot}_`; } if (Object.prototype.hasOwnProperty.call(s, 'text')) { - body += `![OBS Image](${s.img})\n\n${s.text}\n\n`; + body += `![OBS Image](${s.img})\n\n${s.text.trim()}\n\n`; } }); const storyStr = title + body + end; From 44cb23f20db5dba0ad4be9d6f8141d401037ab68 Mon Sep 17 00:00:00 2001 From: vipinpaul Date: Fri, 25 Aug 2023 12:56:25 +0530 Subject: [PATCH 08/34] package updated and added a prop to useContent suggested by Joel C Johnson --- package.json | 19 ++++++++++--------- .../Reference/TranslationHelpsCard.js | 1 + 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index f70d4af80..a1bd23776 100644 --- a/package.json +++ b/package.json @@ -135,7 +135,7 @@ "@xelah/type-perf-html": "^1.0.1", "adm-zip": "^0.5.9", "audiobuffer-to-wav": "^1.0.0", - "bible-reference-rcl": "^1.1.0", + "bible-reference-rcl": "1.1.0", "clsx": "1.1.1", "crypto-js": "^4.1.1", "electron-is-dev": "^2.0.0", @@ -145,18 +145,18 @@ "epitelete": "0.2.20-beta.1", "epitelete-html": "0.2.20-beta.2", "eslint-import-resolver-alias": "^1.1.2", - "font-detect-rhl": "^1.0.5-1", + "font-detect-rhl": "1.0.5-1", "font-list": "^1.4.5", "fs-extra": "^10.1.0", "get-system-fonts": "^2.0.2", - "gitea-react-toolkit": "^2.1.2", + "gitea-react-toolkit": "2.1.2", "i18next": "^21.8.9", "is-electron": "^2.2.1", "isomorphic-git": "^1.24.0", "js-yaml": "^4.1.0", "localforage": "1.10.0", "lodash.isequal": "^4.5.0", - "markdown-translatable": "^1.3.0", + "markdown-translatable": "1.3.0", "md5": "^2.3.0", "moment": "^2.29.3", "next": "^13.0.0", @@ -176,8 +176,8 @@ "react-media-recorder": "^1.6.6", "react-scripts": "5.0.1", "styled-components": "^5.3.6", - "tc-ui-toolkit": "^5.3.3", - "translation-helps-rcl": "^3.3.7", + "tc-ui-toolkit": "5.3.3", + "translation-helps-rcl": "3.3.7", "use-deep-compare": "^1.1.0", "usfm-editor": "0.8.7", "usfm-grammar": "^2.3.0", @@ -185,14 +185,15 @@ "wavesurfer.js": "^6.6.2", "webpack-node-externals": "^3.0.0", "winston": "^3.7.2", - "word-aligner": "^1.0.0", + "word-aligner": "1.0.0", "ws": "^8.8.0", "yarn": "^1.22.19" }, "optionalDependencies": { "bufferutil": "^4.0.6", - "scripture-resources-rcl": "^5.1.0", - "utf-8-validate": "^5.0.9" + "scripture-resources-rcl": "5.1.0", + "utf-8-validate": "^5.0.9", + "react-icons": "4.10.1" }, "overrides": { "react": "$react", diff --git a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js index 4d3413027..aa0b49d4a 100644 --- a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js +++ b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js @@ -41,6 +41,7 @@ export default function TranslationHelpsCard({ filePath, owner, server, + readyToFetch: true, }); const { From 9315a5790db71270646dbf1948c2728f9d8f6747 Mon Sep 17 00:00:00 2001 From: vipinpaul Date: Fri, 25 Aug 2023 15:42:18 +0530 Subject: [PATCH 09/34] Adding tsv obs-tQ support --- .../components/EditorPage/Reference/OBS/ObsTsvToChapterLevel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renderer/src/components/EditorPage/Reference/OBS/ObsTsvToChapterLevel.js b/renderer/src/components/EditorPage/Reference/OBS/ObsTsvToChapterLevel.js index 2f2d1cca4..7fdb3e5e2 100644 --- a/renderer/src/components/EditorPage/Reference/OBS/ObsTsvToChapterLevel.js +++ b/renderer/src/components/EditorPage/Reference/OBS/ObsTsvToChapterLevel.js @@ -38,7 +38,7 @@ const getValue = async (filteredData, twURL, repoName, scrollLock, flavor = '') } else { // Fetching the content for Translation Notes & Questions let mdstring = ''; - mdstring += `# ${ tsvObj.Quote }\n\n${ tsvObj.Note }\n`; + mdstring += `# ${ tsvObj.Quote ? tsvObj.Quote : tsvObj.Question }\n\n${ tsvObj.Note ? tsvObj.Note : tsvObj.Response }\n`; if (tsvObj.Reference.split(':')[1] in notesObj) { notesObj[tsvObj.Reference.split(':')[1]].OccurrenceNote += mdstring; } else { From 9d07580bf43884b4b795c0baa45e41eaf87a6e38 Mon Sep 17 00:00:00 2001 From: vipinpaul Date: Fri, 25 Aug 2023 16:19:02 +0530 Subject: [PATCH 10/34] Version update --- package.json | 2 +- yarn.lock | 108 ++++++++++++++++++++++++--------------------------- 2 files changed, 51 insertions(+), 59 deletions(-) diff --git a/package.json b/package.json index a1bd23776..c67c2a250 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.0", + "version": "0.5.1", "license": "MIT", "private": true, "main": "main/index.js", diff --git a/yarn.lock b/yarn.lock index 03cc4d26d..7ac93af5e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6570,12 +6570,7 @@ bfj@^7.0.2: hoopy "^0.1.4" tryer "^1.0.1" -bible-reference-range@^1.0.1, bible-reference-range@^1.1.0: - version "1.1.0" - resolved "https://registry.npmjs.org/bible-reference-range/-/bible-reference-range-1.1.0.tgz" - integrity sha512-EVPhDLSY/hmeW6reO9XLst1SKAAf6Opyfy6l2MZSna9kE6DqEiFW/eWOrkPq5g40Hs+Xe8odPGJuIpdysokQpg== - -bible-reference-rcl@^1.1.0: +bible-reference-rcl@1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/bible-reference-rcl/-/bible-reference-rcl-1.1.0.tgz#0e9f33effeaabf6bfed53b897ad8e99033502911" integrity sha512-kUrJrTaPmzU7ih8pOjXdOKjBZngVE+NiDnS9SxtSRnpJbKGZqtsmstk3Ld4wIQZvmWfedlbGVx5/R7lG4DeVgw== @@ -10456,7 +10451,7 @@ follow-redirects@^1.0.0, follow-redirects@^1.14.0, follow-redirects@^1.14.9, fol resolved "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz" integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== -font-detect-rhl@^1.0.5-1: +font-detect-rhl@1.0.5-1: version "1.0.5-1" resolved "https://registry.yarnpkg.com/font-detect-rhl/-/font-detect-rhl-1.0.5-1.tgz#4a421265df97ee672eb515a7f9cae2853ca860f4" integrity sha512-gIRKZvNHp751pSI2bWk3kl3ybeUYiO8fXlo4xJQldp4Esp4yPkGslArJgEQXyROCBPdqU/kTyvA7eWWyE/y9oQ== @@ -10845,29 +10840,26 @@ git-diff@^2.0.6: shelljs "^0.8.1" shelljs.exec "^1.1.7" -gitea-react-toolkit@2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/gitea-react-toolkit/-/gitea-react-toolkit-2.2.1.tgz#e13191ae6e3089d12d0f2eeaa69ce49c740651a2" - integrity sha512-9VPuWOHQv+z+H2j+GRhShVPKRC1O+qVNWcoashjpXhd1IS4lF820YIl/YDacFa7SvgOpm/sOZ3MPVnxcGIG4aA== +gitea-react-toolkit@1.9.3: + version "1.9.3" + resolved "https://registry.yarnpkg.com/gitea-react-toolkit/-/gitea-react-toolkit-1.9.3.tgz#0f1467087fbb814aa68f6f6bc695407c76cd3966" + integrity sha512-JubGD8xmLFTSa4unszKIohVxq/6N04mISkA7XekyuPhH1Bm3GBBScETO5zUyZD2x7YeOnUyqCo4lBNKS/6HD9Q== dependencies: awesome-debounce-promise "2.1.0" axios "0.19.0" axios-cache-adapter "2.4.1" base-64 "0.1.0" - deep-equal "^2.0.5" - js-base64 "^3.7.2" jszip "^3.5.0" localforage "1.7.3" - markdown-translatable "1.3.1-rc.1" + markdown-translatable "1.3.1" prop-types "15.7.2" - use-deep-compare "^1.1.0" use-deep-compare-effect "^1.3.1" utf8 "3.0.0" -gitea-react-toolkit@^2.1.2: - version "2.2.2" - resolved "https://registry.npmjs.org/gitea-react-toolkit/-/gitea-react-toolkit-2.2.2.tgz" - integrity sha512-MHsJosA6yyq6iX5M3tn3VmG2CMxlh+6hAsPon2MGjkskbYtxInU4JJo4gX2xxQgbX9AWYC7QogLc7eOGOlSuXA== +gitea-react-toolkit@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/gitea-react-toolkit/-/gitea-react-toolkit-2.1.2.tgz#7943664e6412b18a905166339dc58016ff43b600" + integrity sha512-6tKGEKR5a0ZnxFPp/7w1n3/Cf9kF8nduE6k3dslY6A4zGBaESa4dQmhEEPJyFWOXsYVewflnhSjhgUDiieaqLQ== dependencies: awesome-debounce-promise "2.1.0" axios "0.19.0" @@ -14485,10 +14477,10 @@ markdown-escapes@^1.0.0: resolved "https://registry.yarnpkg.com/markdown-escapes/-/markdown-escapes-1.0.4.tgz#c95415ef451499d7602b91095f3c8e8975f78535" integrity sha512-8z4efJYk43E0upd0NbVXwgSTQs6cT3T06etieCMEg7dRbzCbxUCK/GHlX8mhHRDcp+OLlHkPKsvqQTCvsRl2cg== -markdown-translatable@1.3.1-rc.1: - version "1.3.1-rc.1" - resolved "https://registry.yarnpkg.com/markdown-translatable/-/markdown-translatable-1.3.1-rc.1.tgz#498a264d544f87511465ae06dd454565be1daabb" - integrity sha512-Cn6GFYHZTAQOBy+XCtweOzDVMmshTjIgd2z9oex9DlNWVqlHO54yEvXduFg4YOl4qgTxkdeH+i3Z3VA+01d71w== +markdown-translatable@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/markdown-translatable/-/markdown-translatable-1.3.0.tgz#ba6da3e0f01aa34f7c1d075117543cc57f290f2b" + integrity sha512-GBc5olyzw5hj7rQHah8tRWoGoqSatvD0Wc6ZEHF0IW8PVMpvgWUAAOFAbJyWbcYZe3FD5w13h1J1MqbPLz6Xww== dependencies: deep-freeze "^0.0.1" md5 "^2.2.1" @@ -14499,10 +14491,10 @@ markdown-translatable@1.3.1-rc.1: turndown "^7.0.0" turndown-plugin-gfm "^1.0.2" -markdown-translatable@2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/markdown-translatable/-/markdown-translatable-2.1.1.tgz#da5f0d6b42e73eada0314300362bb5818ecd5cb8" - integrity sha512-HYcHo76ooko6Z9bxaLERS6g/B9LXqnIP6kPyMGE3LwPOD/Nk60Q05mec+Zim8k5JswFvXsSOOJXt14jQXKb/3w== +markdown-translatable@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/markdown-translatable/-/markdown-translatable-1.3.1.tgz#29393f8650be38885c7991f2e2e661bbe9d000ae" + integrity sha512-oZieaVOCjxZISyGDvcpb3XsJsnPvKd4xCULFQawQ/L395EwGHFERG6gCH65b3w3HjkLEWhdPknWf1BLK6Mu6Tg== dependencies: deep-freeze "^0.0.1" md5 "^2.2.1" @@ -14513,10 +14505,10 @@ markdown-translatable@2.1.1: turndown "^7.0.0" turndown-plugin-gfm "^1.0.2" -markdown-translatable@^1.3.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/markdown-translatable/-/markdown-translatable-1.3.1.tgz#29393f8650be38885c7991f2e2e661bbe9d000ae" - integrity sha512-oZieaVOCjxZISyGDvcpb3XsJsnPvKd4xCULFQawQ/L395EwGHFERG6gCH65b3w3HjkLEWhdPknWf1BLK6Mu6Tg== +markdown-translatable@1.3.1-rc.1: + version "1.3.1-rc.1" + resolved "https://registry.yarnpkg.com/markdown-translatable/-/markdown-translatable-1.3.1-rc.1.tgz#498a264d544f87511465ae06dd454565be1daabb" + integrity sha512-Cn6GFYHZTAQOBy+XCtweOzDVMmshTjIgd2z9oex9DlNWVqlHO54yEvXduFg4YOl4qgTxkdeH+i3Z3VA+01d71w== dependencies: deep-freeze "^0.0.1" md5 "^2.2.1" @@ -17541,6 +17533,11 @@ react-i18next@^11.17.1: "@babel/runtime" "^7.14.5" html-parse-stringify "^3.0.1" +react-icons@4.10.1: + version "4.10.1" + resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-4.10.1.tgz#3f3b5eec1f63c1796f6a26174a1091ca6437a500" + integrity sha512-/ngzDP/77tlCfqthiiGNZeYFACw85fUjZtLbedmJ5DTlNDIwETxhwBzdOJ21zj4iJdvc0J3y7yOsX3PpxAJzrw== + react-is@^16.13.1, react-is@^16.3.2, react-is@^16.6.3, react-is@^16.7.0, react-is@^16.8.1: version "16.13.1" resolved "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz" @@ -18529,26 +18526,22 @@ schema-utils@^4.0.0: ajv-formats "^2.1.1" ajv-keywords "^5.0.0" -scripture-resources-rcl@^5.1.0: - version "5.3.9" - resolved "https://registry.yarnpkg.com/scripture-resources-rcl/-/scripture-resources-rcl-5.3.9.tgz#be100b829f1ec3c848145afe9ccc528da9011137" - integrity sha512-49+VzLNuFEvQKDQegljyIiB9ta3HyTCQKcuzLil8JsWcpQ4H38C5EmMiAd2CEyAieJhX+4gLPC9G1YoOrqCnzg== +scripture-resources-rcl@5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/scripture-resources-rcl/-/scripture-resources-rcl-5.1.0.tgz#0a614ca151f53dfe15a181f4fefb1e302feaa572" + integrity sha512-l7biQ4W/92HrJOvc7pIftfCLCmQMzYczFskKpTP3Fc9wXeMbNGPgGhEl6GIgDWAPezxG8qNylHdouqd09Gb58g== dependencies: - bible-reference-range "^1.0.1" deep-freeze "^0.0.1" - gitea-react-toolkit "2.2.1" + gitea-react-toolkit "1.9.3" js-yaml-parser "^1.0.0" - lodash "^4.17.21" - markdown-translatable "2.1.1" + lodash "^4.17.15" + markdown-translatable "1.3.1" nyc "^15.0.0-beta.3" - prop-types "^15.8.1" + prop-types "^15.7.2" react-waypoint "^9.0.2" string-punctuation-tokenizer "2.1.2" - tc-ui-toolkit "^5.3.3" use-deep-compare-effect "^1.3.1" - usfm-js "3.4.0" - word-aligner "^1.0.0" - xregexp "^4.1.1" + usfm-js "^2.0.2" scroll-into-view-if-needed@^2.2.20: version "2.2.31" @@ -19770,7 +19763,7 @@ tar@^6.0.2, tar@^6.1.0, tar@^6.1.11: mkdirp "^1.0.3" yallist "^4.0.0" -tc-ui-toolkit@^5.3.3: +tc-ui-toolkit@5.3.3: version "5.3.3" resolved "https://registry.yarnpkg.com/tc-ui-toolkit/-/tc-ui-toolkit-5.3.3.tgz#67d5fd6cb6b165a124c0f1490fad7c963fcaf043" integrity sha512-Op9iUXXqyd1gJIimgS80quXDEYa9SGxJDPJSGBmKKx3XahqPMDSZdgyuJM9Lvhi6B6bAeiT4iLED3JZY4fQZoQ== @@ -20071,15 +20064,14 @@ transform-runtime@0.0.0: resolved "https://registry.npmjs.org/transform-runtime/-/transform-runtime-0.0.0.tgz" integrity sha512-PX3vXzO8lucrVm82vZb7BABBLHyMDPGzn9zElHr+DnvtS3JPXtqwB1iTRe+D6iFXYmjtAF3zH7O0Xc5XpLpMEg== -translation-helps-rcl@^3.3.7: - version "3.3.9" - resolved "https://registry.npmjs.org/translation-helps-rcl/-/translation-helps-rcl-3.3.9.tgz" - integrity sha512-WulLZVAGexhSHo/j97vx3tkmKrD5usNaCHhlEW1lMPXugxGcYCw83dh3Mih2IMJkIZ2vPcx6SUwHLqWsjxArbA== +translation-helps-rcl@3.3.7: + version "3.3.7" + resolved "https://registry.yarnpkg.com/translation-helps-rcl/-/translation-helps-rcl-3.3.7.tgz#28fc937afde1390e92892826cc8c462ffc31f1bb" + integrity sha512-K5DRCHehRibclGObzV0A1o44d399z5/R4WLZEfFOjdq6w1lhKfWDrr68qG3o+AI2r74/UBqxF3rpQVxYlwqCMA== dependencies: "@gwdevs/extensible-rcl" "^1.0.1" "@mui/styled-engine" "npm:@mui/styled-engine-sc@latest" axios "^0.27.2" - bible-reference-range "^1.1.0" deep-equal "^2.0.5" react-draggable "^4.4.3" styled-components "^5.2.1" @@ -20688,10 +20680,10 @@ usfm-js@2.0.1: rimraf "^2.6.3" transform-runtime "0.0.0" -usfm-js@3.4.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/usfm-js/-/usfm-js-3.4.0.tgz#d3a00634b7219163b2bf41dc9dd83d976ec7ef26" - integrity sha512-8pCtMxzb/E3/4PPLLpf9KK10vza1I1/4tZJaDhJ+ycTGfg5JfT6GmDTxYFd6Nw81sbS0CVoyyG89a5ff6yHCzA== +usfm-js@^2.0.2: + version "2.1.0" + resolved "https://registry.yarnpkg.com/usfm-js/-/usfm-js-2.1.0.tgz#2d5b200d491d87a9c443728436f8ef07fb0c8730" + integrity sha512-DemzdzAwrVeuzRwnZYOKvAle/U2ZUUf04NQSVDgqZCSFyH7hVhe2/PWC7jT2DKnPMYoa0IxnG3XGbuOPXgZ/oQ== dependencies: lodash.clonedeep "^4.5.0" @@ -21263,10 +21255,10 @@ winston@^3.7.2: triple-beam "^1.3.0" winston-transport "^4.5.0" -word-aligner@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/word-aligner/-/word-aligner-1.0.2.tgz#7b47a913421337c44b340b424b420cb5ce3ac945" - integrity sha512-alc0TltIlBhFB2kEG3tvWVeH/FdD4i0h/fBAJ1kDdlcHcNW4wdbYDGriCW7ikDQYicKtvCJBIG6II8IXjbHTww== +word-aligner@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/word-aligner/-/word-aligner-1.0.0.tgz#eee4be21b2550f80e5af8df419427cb4272c36cc" + integrity sha512-eok7g0bz5yCodu3UusLpIbZMIjP7NkW4E4lpJH70txYFJsNYsASQaGdlc09MzyTwfQcxN076in/zWoNwyHug7g== dependencies: babel-runtime "^6.26.0" fs-extra "6.0.1" From 5bec86d53071264dc531d02804970b0be4713d5b Mon Sep 17 00:00:00 2001 From: Arpit Jacob Date: Mon, 28 Aug 2023 16:00:11 +0200 Subject: [PATCH 11/34] new filemerge UI --- pages/wip/data/fileData.js | 22 +++++++++++ pages/wip/data/labelData.js | 31 ++++++++++++++++ pages/wip/files.js | 74 +++++++++++++++++++++++++++++++++++++ tailwind.config.js | 2 +- 4 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 pages/wip/data/fileData.js create mode 100644 pages/wip/data/labelData.js create mode 100644 pages/wip/files.js diff --git a/pages/wip/data/fileData.js b/pages/wip/data/fileData.js new file mode 100644 index 000000000..6f3a8d145 --- /dev/null +++ b/pages/wip/data/fileData.js @@ -0,0 +1,22 @@ +export const fileData = [ + { + number: '1', + original: 'This is how God made everything in the beginning. He created the universe and everything in it in six days. After God created the earth it was dark and empty because he had not yet formed anything in it. But God’s Spirit was there over the water.', + new: 'This is how God made everything in the beginning. He created the universe and everything in it in six days. After God created the earth it was dark and empty because he had not yet formed anything in it. But God’s Spirit was there over the water.', + }, + { + number: '2', + original: 'This is how God made everything in the beginning. He created the universe and everything in it in six days. After God created the earth it was dark and empty because he had not yet formed anything in it. But God’s Spirit was there over the water.', + new: 'This is how God made everything in the beginning. He created the universe and everything in it in six days. After God created the earth it was dark and empty because he had not yet formed anything in it. But God’s Spirit was there over the water.', + }, + { + number: '3', + original: 'This is how God made everything in the beginning. He created the universe and everything in it in six days. After God created the earth it was dark and empty because he had not yet formed anything in it. But God’s Spirit was there over the water.', + new: 'This is how God made everything in the beginning. He created the universe and everything in it in six days. After God created the earth it was dark and empty because he had not yet formed anything in it. But God’s Spirit was there over the water.', + }, + { + number: '4', + original: 'This is how God made everything in the beginning. He created the universe and everything in it in six days. After God created the earth it was dark and empty because he had not yet formed anything in it. But God’s Spirit was there over the water.', + new: 'This is how God made everything in the beginning. He created the universe and everything in it in six days. After God created the earth it was dark and empty because he had not yet formed anything in it. But God’s Spirit was there over the water.', + }, +]; diff --git a/pages/wip/data/labelData.js b/pages/wip/data/labelData.js new file mode 100644 index 000000000..9c39f357b --- /dev/null +++ b/pages/wip/data/labelData.js @@ -0,0 +1,31 @@ +export const labelData = [ + { + id: 1, + name: 'comparison', + textColor: 'text-black', + }, + { + id: 2, + name: 'original', + textColor: 'text-white', + bgColor: 'bg-success', + }, + { + id: 3, + name: 'new', + textColor: 'text-white', + bgColor: 'bg-error', + }, + { + id: 4, + name: 'both', + textColor: 'text-white', + bgColor: 'bg-black', + }, + { + id: 5, + name: 'reset', + textColor: 'text-black', + bgColor: 'bg-white', + }, +]; diff --git a/pages/wip/files.js b/pages/wip/files.js new file mode 100644 index 000000000..732053eb6 --- /dev/null +++ b/pages/wip/files.js @@ -0,0 +1,74 @@ +import { Cog8ToothIcon } from '@heroicons/react/24/outline'; +import { + ArrowSmallDownIcon, ArrowSmallUpIcon, ArrowsUpDownIcon, +} from '@heroicons/react/20/solid'; + +import { fileData } from './data/fileData'; + +const files = () => ( +
+
+
+ + 23 files + + +
+
    +
  • bible/path/file_number_1.md
  • +
  • bible/path/file_number_2.md
  • +
+
+
+
+
+
+ comparison +
+
+ Original + New + Both + Reset +
+
+
+ +
+
+
+ {fileData.map((file) => ( +
+
+ {file.number} +
+ +
+
+ {file.original} +
+
+ {file.new} +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+ ))} +
+
+
+ + ); + +export default files; diff --git a/tailwind.config.js b/tailwind.config.js index 0b0790012..3951cfe90 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -16,7 +16,7 @@ module.exports = { primary: '#FF5500', 'primary-50': '#E4F2FF', secondary: '#151515', - success: '#00FF40', + success: '#05C715', error: '#FF1500', validation: '#FFE5E5', // white: colors.white, From b9a0e008fba68e80b123336729dbafff0af85fe8 Mon Sep 17 00:00:00 2001 From: sijumoncy <72241997+sijumoncy@users.noreply.github.com> Date: Wed, 30 Aug 2023 11:49:08 +0530 Subject: [PATCH 12/34] added new UI design for offline merge --- .../components/Resources/ResourcesPopUp.js | 2 +- .../projects/Import/ConflictEditor-back.jsx | 322 ++++++++++++++++++ .../projects/Import/ConflictEditor.jsx | 288 +++++----------- .../projects/Import/ConflictResolverUI.jsx | 63 ++-- .../projects/Import/ConflictSection.jsx | 126 +++++++ .../projects/Import/ConflictSideBar-back.jsx | 37 ++ .../projects/Import/ConflictSideBar.jsx | 63 ++-- tailwind.config.js | 2 +- 8 files changed, 630 insertions(+), 273 deletions(-) create mode 100644 renderer/src/layouts/projects/Import/ConflictEditor-back.jsx create mode 100644 renderer/src/layouts/projects/Import/ConflictSection.jsx create mode 100644 renderer/src/layouts/projects/Import/ConflictSideBar-back.jsx diff --git a/renderer/src/components/Resources/ResourcesPopUp.js b/renderer/src/components/Resources/ResourcesPopUp.js index 75c6513c8..a4622eb5b 100644 --- a/renderer/src/components/Resources/ResourcesPopUp.js +++ b/renderer/src/components/Resources/ResourcesPopUp.js @@ -100,7 +100,7 @@ export default function ResourcesPopUp(
-
+

RESOURCES

+ + + +
+
+
+ {selectedFileContent?.map((content, index) => ( + // eslint-disable-next-line react/no-array-index-key +
+
+ {(index !== 0 && index !== selectedFileContent.length - 1) && ( +
+ {index} +
+ )} +
+ +
+
+
+ ))} +
+
+ ); +} + +export default ConflictEditor; diff --git a/renderer/src/layouts/projects/Import/ConflictEditor.jsx b/renderer/src/layouts/projects/Import/ConflictEditor.jsx index c575d37fa..312eebc29 100644 --- a/renderer/src/layouts/projects/Import/ConflictEditor.jsx +++ b/renderer/src/layouts/projects/Import/ConflictEditor.jsx @@ -1,152 +1,7 @@ -/* eslint-disable no-nested-ternary */ -import React, { useEffect, useState } from 'react'; +import { Cog8ToothIcon } from '@heroicons/react/24/outline'; +import { useEffect, useState } from 'react'; +import ConflictSection from './ConflictSection'; -const ConflictComponent = ({ - text, index, setSelectedFileContent, selectedFileContent, handleResetSingle, resolvedFileNames, selectedFileName, -}) => { - // expecting 4 item in array - // 1. input text - // 2. HEAD change / current change - // 3. Incoming Change - // 4. mixed data - - const [hoveredId, setHoveredId] = useState(''); - - const handleSelection = (content, index) => { - const contents = [...selectedFileContent]; - const currentData = contents[index]; - if ('text' in contents[index]) { - currentData.text = content; - } else if ('title' in contents[index]) { - currentData.title = content; - } else if ('end' in contents[index]) { - currentData.end = content; - } - currentData.conflictResolved = true; - setSelectedFileContent(contents); - }; - - const handleEditAfterResolve = (e, selectedFileContent, index) => { - selectedFileContent[index].text = e.target.value.trim(); - }; - - let matchedData; - - if (text) { - // eslint-disable-next-line prefer-regex-literals - const conflictRegex = new RegExp( - /^<{7}([^=]*)\n([\s\S]*)\n={7}\n([\s\S]*)\n>{7}[^=]*$/, - ); - const matchArr = text.match(conflictRegex); - // console.log({ matchArr }); - if (matchArr?.length > 3) { - matchedData = { current: matchArr[2], incoming: matchArr[3] }; - selectedFileContent[index].conflict = true; - selectedFileContent[index].conflictResolved = false; - } - } - - // eslint-disable-next-line no-nested-ternary - return matchedData?.current && matchedData?.incoming ? ( - -
- {/* resolve button section */} -
- handleSelection(matchedData.current, index)} - onMouseEnter={() => setHoveredId('current')} - onMouseLeave={() => setHoveredId('')} - > - Ours - - - | - - handleSelection(matchedData.incoming, index)} - onMouseEnter={() => setHoveredId('incoming')} - onMouseLeave={() => setHoveredId('')} - > - Theirs - - - | - - handleSelection(`${matchedData.current}\t${matchedData.incoming}`, index)} - onMouseEnter={() => setHoveredId('both')} - onMouseLeave={() => setHoveredId('')} - > - Both - - -
- {/* conflict content section */} -
- - {/*
*/} -
- {/*
- {'<<<<<<<'} - {' '} - current -
*/} -
{matchedData.current}
-
- - {/*
=======
*/} - - {/*
*/} -
-
{matchedData.incoming}
- {/*
- {'>>>>>>>'} - {' '} - incoming -
*/} -
-
- -
- ) : ( - selectedFileContent[index].conflict && selectedFileContent[index].conflictResolved && !resolvedFileNames.includes(selectedFileName) - ? ( -
- handleResetSingle(selectedFileContent, index)} - > - Reset - - -
- ) - : ( -
{text}
- ) - ); -}; - -// all logic are based on OBS Parsed Array function ConflictEditor({ selectedFileContent, setSelectedFileContent, selectedFileName, FileContentOrginal, setEnableSave, resolvedFileNames, }) { @@ -246,74 +101,91 @@ function ConflictEditor({ }; return ( -
- {/* headign with reset and all select section */} - {/* !resolvedFileNames?.includes(selectedFileName) */} -
-
-
- - - - +
+ {/* Header and Buttons */} +
+
+
+ comparison +
+
+ + + + + + + + +
+
+
+
-
- {selectedFileContent?.map((content, index) => ( - // eslint-disable-next-line react/no-array-index-key -
-
- {(index !== 0 && index !== selectedFileContent.length - 1) && ( -
- {index} -
- )} -
- + {selectedFileContent.map((content, index) => ( +
+ {(index !== 0 && index !== selectedFileContent.length - 1) && ( +
+ {index} +
+ )} + +
+ -
+ index={index} + setSelectedFileContent={setSelectedFileContent} + selectedFileContent={selectedFileContent} + handleResetSingle={handleResetSingle} + resolvedFileNames={resolvedFileNames} + selectedFileName={selectedFileName} + />
+
- ))} + ))}
); diff --git a/renderer/src/layouts/projects/Import/ConflictResolverUI.jsx b/renderer/src/layouts/projects/Import/ConflictResolverUI.jsx index 83e8f048d..9d86f21c7 100644 --- a/renderer/src/layouts/projects/Import/ConflictResolverUI.jsx +++ b/renderer/src/layouts/projects/Import/ConflictResolverUI.jsx @@ -141,8 +141,8 @@ function ConflictResolverUI({ conflictData, setConflictPopup }) { > -
-
+
+

RESOLVE CONFLICT

{/* close btn section */} @@ -156,45 +156,47 @@ function ConflictResolverUI({ conflictData, setConflictPopup }) {
{/* contents section */} -
- -
-
- -
-
+
+ {/* sidebar and Editor */} +
+ +
+ +
+ +
{conflictData?.data?.files?.filepaths?.length === resolvedFileNames?.length && (
removeSection()} > {finishingMerge - ? ( -
- ) - : <>All conflicts Resolved : Finish} + ? ( +
+ ) + : <>Done}
)}
+
diff --git a/renderer/src/layouts/projects/Import/ConflictSection.jsx b/renderer/src/layouts/projects/Import/ConflictSection.jsx new file mode 100644 index 000000000..acafa618e --- /dev/null +++ b/renderer/src/layouts/projects/Import/ConflictSection.jsx @@ -0,0 +1,126 @@ +/* eslint-disable no-nested-ternary */ +// Indivudual text section of conflict Editor + +import { useState } from 'react'; +import { + ArrowSmallDownIcon, ArrowSmallUpIcon, ArrowsUpDownIcon, ArrowUturnLeftIcon, + } from '@heroicons/react/20/solid'; + +const ConflictSection = ({ + text, index, setSelectedFileContent, selectedFileContent, handleResetSingle, resolvedFileNames, selectedFileName, + }) => { + // const [hoveredId, setHoveredId] = useState(''); + + const handleSelection = (content, index) => { + const contents = [...selectedFileContent]; + const currentData = contents[index]; + if ('text' in contents[index]) { + currentData.text = content; + } else if ('title' in contents[index]) { + currentData.title = content; + } else if ('end' in contents[index]) { + currentData.end = content; + } + currentData.conflictResolved = true; + setSelectedFileContent(contents); + }; + + const handleEditAfterResolve = (e, selectedFileContent, index) => { + selectedFileContent[index].text = e.target.value.trim(); + }; + + let matchedData; + // matchedData : expecting 4 item in array + // 1. input text + // 2. HEAD change / current change + // 3. Incoming Change + // 4. mixed data + + if (text) { + // eslint-disable-next-line prefer-regex-literals + const conflictRegex = new RegExp( + /^<{7}([^=]*)\n([\s\S]*)\n={7}\n([\s\S]*)\n>{7}[^=]*$/, + ); + const matchArr = text.match(conflictRegex); + // console.log({ matchArr }); + if (matchArr?.length > 3) { + matchedData = { current: matchArr[2], incoming: matchArr[3] }; + selectedFileContent[index].conflict = true; + selectedFileContent[index].conflictResolved = false; + } + } + + return matchedData?.current && matchedData?.incoming + ? ( +
+
+
+ {matchedData.current} +
+
+ {matchedData.incoming} +
+
+ +
+ {/* current */} +
handleSelection(matchedData.current, index)} + title="Accept ORIGINAL changes to resolve conflict" + className="bg-black w-6 h-6 rounded-full flex justify-center items-center" + > + +
+ {/* Both */} +
handleSelection(`${matchedData.current}\t${matchedData.incoming}`, index)} + title="Accept BOTH changes to resolve conflict" + className="bg-blue-500 w-6 h-6 rounded-full flex justify-center items-center" + > + +
+ {/* Incoming */} +
handleSelection(matchedData.incoming, index)} + title="Accept NEW changes to resolve conflict" + className="bg-success w-6 h-6 rounded-full flex justify-center items-center" + > + +
+
+
+ ) : ( + selectedFileContent[index]?.conflict && selectedFileContent[index]?.conflictResolved && !resolvedFileNames?.includes(selectedFileName) + ? ( +
+ +
handleResetSingle(selectedFileContent, index)} + title="RESET this section to initial state" + className="bg-gray-300 w-6 h-6 rounded-full flex justify-center items-center p-1 self-center" + > + +
+
+ ) + : ( +
{text}
+ ) + ); +}; + +export default ConflictSection; diff --git a/renderer/src/layouts/projects/Import/ConflictSideBar-back.jsx b/renderer/src/layouts/projects/Import/ConflictSideBar-back.jsx new file mode 100644 index 000000000..392669de9 --- /dev/null +++ b/renderer/src/layouts/projects/Import/ConflictSideBar-back.jsx @@ -0,0 +1,37 @@ +import React from 'react'; +import FileIcon from '@/icons/file.svg'; + +function ConflictSideBar({ + conflictData, setSelectedFileName, selectedFileName, resolvedFileNames, +}) { + return ( +
+
Files
+
+ {conflictData?.data?.files?.filepaths?.sort()?.map((file, index) => ( + + ))} +
+
+ ); +} + +export default ConflictSideBar; diff --git a/renderer/src/layouts/projects/Import/ConflictSideBar.jsx b/renderer/src/layouts/projects/Import/ConflictSideBar.jsx index 392669de9..75de5ca02 100644 --- a/renderer/src/layouts/projects/Import/ConflictSideBar.jsx +++ b/renderer/src/layouts/projects/Import/ConflictSideBar.jsx @@ -1,37 +1,34 @@ -import React from 'react'; -import FileIcon from '@/icons/file.svg'; +import { Cog8ToothIcon } from '@heroicons/react/24/outline'; function ConflictSideBar({ - conflictData, setSelectedFileName, selectedFileName, resolvedFileNames, -}) { - return ( -
-
Files
-
- {conflictData?.data?.files?.filepaths?.sort()?.map((file, index) => ( - + conflictData, setSelectedFileName, selectedFileName, resolvedFileNames, + }) { + return ( +
+
+ + {`${conflictData?.data?.files?.filepaths.length || 0} files`} + + +
+
    + {conflictData?.data?.files?.filepaths?.sort()?.map((file) => ( +
  • setSelectedFileName(file)} + aria-disabled={resolvedFileNames.includes(file)} + className={`px-5 py-2 ${resolvedFileNames.includes(file) + ? 'line-through decoration-2 pointer-events-none' + : `${selectedFileName === file ? 'bg-primary/70' : 'hover:bg-primary/50 cursor-pointer'}`} `} + > + {file} +
  • ))} -
-
- ); -} + +
+ ); + } -export default ConflictSideBar; + export default ConflictSideBar; diff --git a/tailwind.config.js b/tailwind.config.js index 0b0790012..3951cfe90 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -16,7 +16,7 @@ module.exports = { primary: '#FF5500', 'primary-50': '#E4F2FF', secondary: '#151515', - success: '#00FF40', + success: '#05C715', error: '#FF1500', validation: '#FFE5E5', // white: colors.white, From e81eb344907622ce30a2628daf384f8b83f60528 Mon Sep 17 00:00:00 2001 From: sijumoncy <72241997+sijumoncy@users.noreply.github.com> Date: Wed, 30 Aug 2023 11:52:42 +0530 Subject: [PATCH 13/34] removed old UI files --- .../projects/Import/ConflictEditor-back.jsx | 322 ------------------ .../projects/Import/ConflictSideBar-back.jsx | 37 -- 2 files changed, 359 deletions(-) delete mode 100644 renderer/src/layouts/projects/Import/ConflictEditor-back.jsx delete mode 100644 renderer/src/layouts/projects/Import/ConflictSideBar-back.jsx diff --git a/renderer/src/layouts/projects/Import/ConflictEditor-back.jsx b/renderer/src/layouts/projects/Import/ConflictEditor-back.jsx deleted file mode 100644 index 9cf34b9f2..000000000 --- a/renderer/src/layouts/projects/Import/ConflictEditor-back.jsx +++ /dev/null @@ -1,322 +0,0 @@ -/* eslint-disable no-nested-ternary */ -import React, { useEffect, useState } from 'react'; - -const ConflictComponent = ({ - text, index, setSelectedFileContent, selectedFileContent, handleResetSingle, resolvedFileNames, selectedFileName, -}) => { - // expecting 4 item in array - // 1. input text - // 2. HEAD change / current change - // 3. Incoming Change - // 4. mixed data - - const [hoveredId, setHoveredId] = useState(''); - - const handleSelection = (content, index) => { - const contents = [...selectedFileContent]; - const currentData = contents[index]; - if ('text' in contents[index]) { - currentData.text = content; - } else if ('title' in contents[index]) { - currentData.title = content; - } else if ('end' in contents[index]) { - currentData.end = content; - } - currentData.conflictResolved = true; - setSelectedFileContent(contents); - }; - - const handleEditAfterResolve = (e, selectedFileContent, index) => { - selectedFileContent[index].text = e.target.value.trim(); - }; - - let matchedData; - - if (text) { - // eslint-disable-next-line prefer-regex-literals - const conflictRegex = new RegExp( - /^<{7}([^=]*)\n([\s\S]*)\n={7}\n([\s\S]*)\n>{7}[^=]*$/, - ); - const matchArr = text.match(conflictRegex); - // console.log({ matchArr }); - if (matchArr?.length > 3) { - matchedData = { current: matchArr[2], incoming: matchArr[3] }; - selectedFileContent[index].conflict = true; - selectedFileContent[index].conflictResolved = false; - } - } - - // eslint-disable-next-line no-nested-ternary - return matchedData?.current && matchedData?.incoming ? ( - -
- {/* resolve button section */} -
- handleSelection(matchedData.current, index)} - onMouseEnter={() => setHoveredId('current')} - onMouseLeave={() => setHoveredId('')} - > - Ours - - - | - - handleSelection(matchedData.incoming, index)} - className="hover:text-green-600 cursor-pointer group/incoming" - onMouseEnter={() => setHoveredId('incoming')} - onMouseLeave={() => setHoveredId('')} - > - Theirs - - - | - - handleSelection(`${matchedData.current}\t${matchedData.incoming}`, index)} - className="hover:text-primary cursor-pointer" - onMouseEnter={() => setHoveredId('both')} - onMouseLeave={() => setHoveredId('')} - > - Both - - -
- {/* conflict content section */} -
- - {/*
*/} -
- {/*
- {'<<<<<<<'} - {' '} - current -
*/} -
{matchedData.current}
-
- - {/*
=======
*/} - - {/*
*/} -
-
{matchedData.incoming}
- {/*
- {'>>>>>>>'} - {' '} - incoming -
*/} -
-
- -
- ) : ( - selectedFileContent[index].conflict && selectedFileContent[index].conflictResolved && !resolvedFileNames.includes(selectedFileName) - ? ( -
- handleResetSingle(selectedFileContent, index)} - > - Reset - - -
- ) - : ( -
{text}
- ) - ); -}; - -// all logic are based on OBS Parsed Array -function ConflictEditor({ - selectedFileContent, setSelectedFileContent, selectedFileName, FileContentOrginal, setEnableSave, resolvedFileNames, -}) { - const [resolveAllActive, setResolveALlActive] = useState(); - const [resetAlll, setResetAll] = useState(); - - useEffect(() => { - if (resolvedFileNames?.includes(selectedFileName)) { - setResolveALlActive(false); - setResetAll(false); - } else { - setResolveALlActive(true); - setResetAll(false); - } - }, [selectedFileName, resolvedFileNames]); - - useEffect(() => { - let conflcitCount = 0; - let resolvedCount = 0; - let save = false; - for (let index = 0; index < selectedFileContent.length; index++) { - if (selectedFileContent[index]?.conflict) { - conflcitCount += 1; - if (selectedFileContent[index].conflictResolved) { - resolvedCount += 1; - } - } - } - if (conflcitCount > 0 && conflcitCount === resolvedCount) { - save = true; - } else { - setResolveALlActive(true); - setResetAll(false); - } - setEnableSave(save); - if (save) { - setResolveALlActive(false); - setResetAll(true); - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [selectedFileContent]); - - const resolveAllTogether = (data, type) => { - if (resolveAllActive) { - const conflictedData = [...data]; - // loop check for conflcit lines - for (let i = 0; i < conflictedData.length; i++) { - const currentText = conflictedData[i]?.title || conflictedData[i]?.text || conflictedData[i]?.end; - if (currentText) { - // eslint-disable-next-line prefer-regex-literals - const conflictRegex = new RegExp( - /^<{7}([^=]*)\n([\s\S]*)\n={7}\n([\s\S]*)\n>{7}[^=]*$/, - ); - const matchArr = currentText.match(conflictRegex); - if (matchArr?.length > 3) { - let resolvedText; - if (type === 'current') { - resolvedText = matchArr[2]; - } else if (type === 'incoming') { - resolvedText = matchArr[3]; - } else if (type === 'both') { - resolvedText = `${matchArr[2]}\t${matchArr[3]}`; - } - if (resolvedText) { - conflictedData[i].conflictResolved = true; - if ('text' in conflictedData[i]) { - conflictedData[i].text = resolvedText; - } else if ('title' in conflictedData[i]) { - conflictedData[i].title = resolvedText; - } else if ('end' in conflictedData[i]) { - conflictedData[i].end = resolvedText; - } - } - } - } - } - // update state - setResolveALlActive(false); - setResetAll(true); - // update line with current | incoming | both based on selection - setSelectedFileContent(conflictedData); - } - }; - - const handleResetSingle = (data, index) => { - const orginalFileContent = JSON.parse(FileContentOrginal)[index]; - const conflictedData = [...data]; - conflictedData[index] = orginalFileContent; - setSelectedFileContent(conflictedData); - }; - - const resetAllResolved = () => { - setResetAll(false); - setResolveALlActive(true); - // update state with copy of conflcited data - setSelectedFileContent(JSON.parse(FileContentOrginal)); - }; - - return ( -
- {/* headign with reset and all select section */} - {/* !resolvedFileNames?.includes(selectedFileName) */} -
-
-
- - - - -
-
-
- {selectedFileContent?.map((content, index) => ( - // eslint-disable-next-line react/no-array-index-key -
-
- {(index !== 0 && index !== selectedFileContent.length - 1) && ( -
- {index} -
- )} -
- -
-
-
- ))} -
-
- ); -} - -export default ConflictEditor; diff --git a/renderer/src/layouts/projects/Import/ConflictSideBar-back.jsx b/renderer/src/layouts/projects/Import/ConflictSideBar-back.jsx deleted file mode 100644 index 392669de9..000000000 --- a/renderer/src/layouts/projects/Import/ConflictSideBar-back.jsx +++ /dev/null @@ -1,37 +0,0 @@ -import React from 'react'; -import FileIcon from '@/icons/file.svg'; - -function ConflictSideBar({ - conflictData, setSelectedFileName, selectedFileName, resolvedFileNames, -}) { - return ( -
-
Files
-
- {conflictData?.data?.files?.filepaths?.sort()?.map((file, index) => ( - - ))} -
-
- ); -} - -export default ConflictSideBar; From 717430517adfaef392527f644e99b362ff79785a Mon Sep 17 00:00:00 2001 From: sijumoncy <72241997+sijumoncy@users.noreply.github.com> Date: Wed, 30 Aug 2023 14:03:14 +0530 Subject: [PATCH 14/34] fix for ta online render issue --- .../src/components/EditorPage/Reference/TA/TaNavigation.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/renderer/src/components/EditorPage/Reference/TA/TaNavigation.js b/renderer/src/components/EditorPage/Reference/TA/TaNavigation.js index 9acb8f74f..34d2cd566 100644 --- a/renderer/src/components/EditorPage/Reference/TA/TaNavigation.js +++ b/renderer/src/components/EditorPage/Reference/TA/TaNavigation.js @@ -79,8 +79,9 @@ export default function TaNavigation({ languageId, referenceResources }) { .then((response) => response.json()) .then((actualData) => { // get avaialble books/ingredients - if (actualData?.books?.length > 0 && !options.length > 0) { - setoptions(actualData?.books); + const optionsList = actualData?.ingredients?.map((item) => item.identifier); + if (optionsList?.length > 0 && !options.length > 0) { + setoptions(optionsList); } // get data function const fetchData = async () => { From 6ce1cb4253efe5d5d4c1d8987450c616e4e25352 Mon Sep 17 00:00:00 2001 From: Arpit Jacob Date: Wed, 30 Aug 2023 10:38:32 +0200 Subject: [PATCH 15/34] few more fixes --- pages/wip/data/fileData.js | 20 ++++++++++++++++++++ pages/wip/files.js | 8 ++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/pages/wip/data/fileData.js b/pages/wip/data/fileData.js index 6f3a8d145..f1c06388c 100644 --- a/pages/wip/data/fileData.js +++ b/pages/wip/data/fileData.js @@ -19,4 +19,24 @@ export const fileData = [ original: 'This is how God made everything in the beginning. He created the universe and everything in it in six days. After God created the earth it was dark and empty because he had not yet formed anything in it. But God’s Spirit was there over the water.', new: 'This is how God made everything in the beginning. He created the universe and everything in it in six days. After God created the earth it was dark and empty because he had not yet formed anything in it. But God’s Spirit was there over the water.', }, + { + number: '5', + original: 'This is how God made everything in the beginning. He created the universe and everything in it in six days. After God created the earth it was dark and empty because he had not yet formed anything in it. But God’s Spirit was there over the water.', + new: 'This is how God made everything in the beginning. He created the universe and everything in it in six days. After God created the earth it was dark and empty because he had not yet formed anything in it. But God’s Spirit was there over the water.', + }, + { + number: '6', + original: 'This is how God made everything in the beginning. He created the universe and everything in it in six days. After God created the earth it was dark and empty because he had not yet formed anything in it. But God’s Spirit was there over the water.', + new: 'This is how God made everything in the beginning. He created the universe and everything in it in six days. After God created the earth it was dark and empty because he had not yet formed anything in it. But God’s Spirit was there over the water.', + }, + { + number: '7', + original: 'This is how God made everything in the beginning. He created the universe and everything in it in six days. After God created the earth it was dark and empty because he had not yet formed anything in it. But God’s Spirit was there over the water.', + new: 'This is how God made everything in the beginning. He created the universe and everything in it in six days. After God created the earth it was dark and empty because he had not yet formed anything in it. But God’s Spirit was there over the water.', + }, + { + number: '7', + original: 'This is how God made everything in the beginning. He created the universe and everything in it in six days. After God created the earth it was dark and empty because he had not yet formed anything in it. But God’s Spirit was there over the water.', + new: 'This is how God made everything in the beginning. He created the universe and everything in it in six days. After God created the earth it was dark and empty because he had not yet formed anything in it. But God’s Spirit was there over the water.', + }, ]; diff --git a/pages/wip/files.js b/pages/wip/files.js index 732053eb6..d2f1e985d 100644 --- a/pages/wip/files.js +++ b/pages/wip/files.js @@ -6,7 +6,7 @@ import { import { fileData } from './data/fileData'; const files = () => ( -
+
@@ -15,8 +15,8 @@ const files = () => (
    -
  • bible/path/file_number_1.md
  • -
  • bible/path/file_number_2.md
  • +
  • bible/path/file_number_1.md
  • +
  • bible/path/file_number_2.md
@@ -36,7 +36,7 @@ const files = () => (
-
+
{fileData.map((file) => (
From 145e72d2b0ac4a95a8c767c3b9063a3e33b34cd1 Mon Sep 17 00:00:00 2001 From: vipinpaul Date: Wed, 30 Aug 2023 14:52:35 +0530 Subject: [PATCH 16/34] updated readme with yarn --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bdc5c3985..958023f83 100644 --- a/README.md +++ b/README.md @@ -60,14 +60,14 @@ It is relatively easy to setup the application locally for development. This is an example of how to list things you need to use the software and how to install them. - [Node.js ^16.15.1](https://nodejs.org/en/) -- [NPM ^8.11.0](https://www.npmjs.com/get-npm) +- [YARN ^1.22.19](https://yarnpkg.com/getting-started) ### Installation 1. Fork and clone this repository -2. Install dependencies with `npm install` -3. Start the application with `npm start` -4. Checkout the web version with `npm run dev` +2. Install dependencies with `yarn install` +3. Start the application with `yarn start` +4. Checkout the web version with `yarn dev` Runs the app in the development mode.
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. @@ -107,8 +107,8 @@ Usage: logger.[level](", ") - [Jest](https://testing-library.com/docs/react-testing-library/intro) - [React Testing Library](https://jestjs.io/docs/en/getting-started) -6. Run `npm run lint:fix` for code to adapt our linting rules -7. Run `npm run build` for build checks +6. Run `yarn lint:fix` for code to adapt our linting rules +7. Run `yarn build` for build checks 8. Commit your Changes (`git commit -m 'Add some NewFeatures'`) 9. Push to the Branch (`git push origin feature/NewFeature`) 10. Open a Pull Request and make sure all checks have passed From a806a63401c48698b73a71c605ea2c0316344499 Mon Sep 17 00:00:00 2001 From: sijumoncy <72241997+sijumoncy@users.noreply.github.com> Date: Thu, 31 Aug 2023 09:56:06 +0530 Subject: [PATCH 17/34] font size issue fixed in audio text mode --- .../AudioRecorder/components/EditorPage.js | 11 +++++++++-- .../EditorPage/AudioEditor/AudioEditor.js | 14 +++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/renderer/src/components/AudioRecorder/components/EditorPage.js b/renderer/src/components/AudioRecorder/components/EditorPage.js index 54bce142c..00205f799 100644 --- a/renderer/src/components/AudioRecorder/components/EditorPage.js +++ b/renderer/src/components/AudioRecorder/components/EditorPage.js @@ -5,7 +5,7 @@ import { useEffect, useState } from 'react'; const AudioWaveform = dynamic(() => import('./WaveForm'), { ssr: false }); const EditorPage = ({ - content, onChangeVerse, verse, location, updateWave, + content, onChangeVerse, verse, location, updateWave, fontSize, selectedFont, }) => { const path = require('path'); const [waveUpdate, setWaveUpdate] = useState(false); @@ -44,7 +44,14 @@ const EditorPage = ({
{mainChunk.verseNumber}
-

+

1.3) ? 1.5 : '', + }} + > {mainChunk.verseText || ''}

diff --git a/renderer/src/components/EditorPage/AudioEditor/AudioEditor.js b/renderer/src/components/EditorPage/AudioEditor/AudioEditor.js index b041166f5..e3cf068a0 100644 --- a/renderer/src/components/EditorPage/AudioEditor/AudioEditor.js +++ b/renderer/src/components/EditorPage/AudioEditor/AudioEditor.js @@ -30,6 +30,8 @@ const AudioEditor = ({ editor }) => { isLoading, audioContent, audioPath, + selectedFont, + fontSize, // eslint-disable-next-line no-unused-vars updateWave, // updateWave is used to update the waveform in the Editor after recording audio }, actions: { @@ -210,7 +212,17 @@ const AudioEditor = ({ editor }) => { {((isLoading || !audioContent) && displyScreen) && } {isLoading && !displyScreen && } {audioContent && isLoading === false - && } + && ( + +)} Date: Thu, 31 Aug 2023 15:31:59 +0530 Subject: [PATCH 18/34] Adding the relaxed mode in the usfm validator --- renderer/src/modules/projects/ImportPopUp.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/renderer/src/modules/projects/ImportPopUp.js b/renderer/src/modules/projects/ImportPopUp.js index b547eb43f..118ce0d01 100644 --- a/renderer/src/modules/projects/ImportPopUp.js +++ b/renderer/src/modules/projects/ImportPopUp.js @@ -104,7 +104,7 @@ export default function ImportPopUp(props) { switch (projectType) { case 'Translation': { const usfm = fs.readFileSync(filePath, 'utf8'); - const myUsfmParser = new grammar.USFMParser(usfm); + const myUsfmParser = new grammar.USFMParser(usfm, grammar.LEVEL.RELAXED); const isJsonValid = myUsfmParser.validate(); if (isJsonValid) { logger.debug('ImportPopUp.js', 'Valid USFM file.'); @@ -121,7 +121,7 @@ export default function ImportPopUp(props) { case 'Audio': { const usfm = fs.readFileSync(filePath, 'utf8'); - const myUsfmParser = new grammar.USFMParser(usfm); + const myUsfmParser = new grammar.USFMParser(usfm, grammar.LEVEL.RELAXED); const isJsonValid = myUsfmParser.validate(); if (isJsonValid) { logger.debug('ImportPopUp.js', 'Valid USFM file.'); From 02d18a34b997027cf81087f28c3e9a4ebf4aa0ac Mon Sep 17 00:00:00 2001 From: sijumoncy <72241997+sijumoncy@users.noreply.github.com> Date: Thu, 31 Aug 2023 17:16:42 +0530 Subject: [PATCH 19/34] added localization keys for app --- .../AudioRecorder/components/Player.js | 28 +++++----- .../Reference/Audio/ReferenceAudio.js | 2 +- .../useReadReferenceUsfmFile.js | 2 +- .../Projects/EnhancedTableHead.js | 18 +++--- .../components/Resources/ImportResource.js | 4 +- .../src/components/Resources/ListResources.js | 4 +- .../components/Resources/ResourceTabPane.js | 13 ++++- .../ResourceUtils/CustomMultiComboBox.js | 4 +- .../ResourceUtils/DownloadResourcePopUp.js | 33 ++++++----- .../components/Resources/ResourcesPopUp.js | 2 +- .../src/components/Resources/SearchBar.js | 2 +- .../Sync/Gitea/EditorSync/EditorSync.js | 2 +- renderer/src/layouts/editor/MenuBar.js | 2 +- .../layouts/projects/ImportProjectPopUp.js | 2 +- renderer/src/layouts/projects/Layout.js | 6 +- renderer/src/modules/projects/NewProject.js | 2 +- renderer/src/modules/projects/Sync.js | 12 ++-- renderer/src/translations/en.js | 46 +++++++++++++++- renderer/src/translations/fa.js | 17 ++++++ renderer/src/translations/fr.js | 45 +++++++++++++++ renderer/src/translations/hi.js | 55 +++++++++++++++++-- renderer/src/translations/ne.js | 46 +++++++++++++++- renderer/src/translations/ru.js | 45 +++++++++++++++ 23 files changed, 326 insertions(+), 66 deletions(-) diff --git a/renderer/src/components/AudioRecorder/components/Player.js b/renderer/src/components/AudioRecorder/components/Player.js index d58195da0..2d62919e0 100644 --- a/renderer/src/components/AudioRecorder/components/Player.js +++ b/renderer/src/components/AudioRecorder/components/Player.js @@ -9,6 +9,7 @@ import { PlusIcon, StopIcon, } from '@heroicons/react/24/outline'; +import { useTranslation } from 'react-i18next'; import { Listbox } from '@headlessui/react'; import dynamic from 'next/dynamic'; import PropTypes from 'prop-types'; @@ -34,6 +35,7 @@ const Player = ({ setTrigger, location, }) => { + const { t } = useTranslation(); const [volume, setVolume] = useState(0.5); const [currentSpeed, setCurrentSpeed] = useState(1); const speed = [0.5, 1, 1.5, 2]; @@ -80,7 +82,7 @@ const Player = ({
- audio + {t('label-audio-bible')}
@@ -136,7 +136,7 @@ export default function ImportResource({ onClick={() => openResourceDialog()} className="py-2 px-4 flex gap-2 items-center rounded shadow bg-gray-200 border border-gray-300 text-gray-600 uppercase text-xs tracking-wider" > - Select Folder + {t('label-select-folder')}
diff --git a/renderer/src/components/Resources/ListResources.js b/renderer/src/components/Resources/ListResources.js index 28db6b244..6121d8b7a 100644 --- a/renderer/src/components/Resources/ListResources.js +++ b/renderer/src/components/Resources/ListResources.js @@ -279,7 +279,7 @@ export const ListResources = ({ - Online Resources + {t('label-online-resources')} @@ -335,7 +335,7 @@ export const ListResources = ({ className="cursor-pointer focus:outline-none flex justify-center items-center" role="button" tabIndex={0} - title="download" + title={t('tooltip-download')} onClick={(e) => handleDownloadHelpsResources(e, notes, filteredResources?.offlineResource)} > {downloading && currentDownloading?.responseData?.id === notes?.responseData?.id ? ( diff --git a/renderer/src/components/Resources/ResourceTabPane.js b/renderer/src/components/Resources/ResourceTabPane.js index f0848058b..2d3125b8e 100644 --- a/renderer/src/components/Resources/ResourceTabPane.js +++ b/renderer/src/components/Resources/ResourceTabPane.js @@ -1,9 +1,11 @@ +/* eslint-disable no-nested-ternary */ import React, { Fragment, useState } from 'react'; import { Tab } from '@headlessui/react'; import { classNames } from '@/util/classNames'; import { PlusIcon } from '@heroicons/react/24/outline'; import DownloadResourcePopUp from '@/components/Resources/ResourceUtils/DownloadResourcePopUp'; import ImportResource from '@/components/Resources/ImportResource'; +import { useTranslation } from 'react-i18next'; import ObsBibleAudioTab from './ObsBibleAudioTab'; import * as logger from '../../logger'; @@ -22,6 +24,7 @@ export default function ResourceTabPane({ setSubMenuItems, setfilteredBibleObsAudio, }) { + const { t } = useTranslation(); const [isOpenDonwloadPopUp, setIsOpenDonwloadPopUp] = useState(false); const [resourceIconClick, setResourceIconClick] = useState(false); const openResourceDialogBox = () => { @@ -43,7 +46,11 @@ export default function ResourceTabPane({ : 'text-black bg-gray-200', )} > - {selectResource} + {selectResource === 'bible' + ? t('label-resource-bible') + : selectResource === 'OBS' ? 'OBS' + : selectResource === 'audio' ? t('label-audio-bible') : selectResource} + {selectResource !== 'audio' && ( @@ -64,7 +71,7 @@ export default function ResourceTabPane({ className="w-4 h-4" aria-hidden="true" /> - Resource + {t('label-resource')} )} @@ -84,7 +91,7 @@ export default function ResourceTabPane({ className="w-4 h-4" aria-hidden="true" /> - Collection + {t('label-collection')} diff --git a/renderer/src/components/Resources/ResourceUtils/CustomMultiComboBox.js b/renderer/src/components/Resources/ResourceUtils/CustomMultiComboBox.js index 10bf12d9a..63acd21ac 100644 --- a/renderer/src/components/Resources/ResourceUtils/CustomMultiComboBox.js +++ b/renderer/src/components/Resources/ResourceUtils/CustomMultiComboBox.js @@ -2,10 +2,12 @@ import React, { useState } from 'react'; import { Combobox } from '@headlessui/react'; import PropTypes from 'prop-types'; import { ChevronUpDownIcon } from '@heroicons/react/24/solid'; +import { useTranslation } from 'react-i18next'; function CustomMultiComboBox({ selectedList, setSelectedList, customData, placeholder = 'Select Language', filterParams = 'name', multiSelect = false, dropArrow = false, showLangCode = { show: false, langkey: 'lc' }, }) { + const { t } = useTranslation(); let filteredData = []; const [query, setQuery] = useState(''); // eslint-disable-next-line no-unused-vars @@ -32,7 +34,7 @@ function CustomMultiComboBox({ className="w-full border-none py-2 pl-3 pr-10 text-sm leading-5 text-gray-900 focus:ring-0" // displayValue={(language) => language?.ang} displayValue={(selectedList) => `${selectedList.length > 0 ? `${selectedList[0][filterParams]}${multiSelect ? '... click for more' : '' }` : ''}`} - placeholder={placeholder} + placeholder={placeholder === 'Select Language' ? t('label-lang') : ''} onFocus={() => !open && setIsActive(true)} onBlur={() => setIsActive(false)} onChange={(event) => setQuery(event.target.value)} diff --git a/renderer/src/components/Resources/ResourceUtils/DownloadResourcePopUp.js b/renderer/src/components/Resources/ResourceUtils/DownloadResourcePopUp.js index 61f529bc5..3a9cd745b 100644 --- a/renderer/src/components/Resources/ResourceUtils/DownloadResourcePopUp.js +++ b/renderer/src/components/Resources/ResourceUtils/DownloadResourcePopUp.js @@ -1,3 +1,4 @@ +/* eslint-disable react/no-danger */ /* eslint-disable react/no-array-index-key */ /* eslint-disable jsx-a11y/control-has-associated-label */ /* eslint-disable no-unused-vars */ @@ -297,7 +298,7 @@ function DownloadResourcePopUp({ selectResource, isOpenDonwloadPopUp, setIsOpenD <>
- + -
@@ -386,16 +387,18 @@ function DownloadResourcePopUp({ selectResource, isOpenDonwloadPopUp, setIsOpenD - Resource + {t('label-resource')} - SUBJECT + {t('label-subject')} - Organization + {t('label-organization')} - - release/Version + + {t('label-version')} + / + {t('label-release')} @@ -406,7 +409,7 @@ function DownloadResourcePopUp({ selectResource, isOpenDonwloadPopUp, setIsOpenD

0 ? '' : ' text-red-600'} `}> - {`(${element}) ${resourceData[element].length > 0 ? resourceData[element][0].language_title : 'No Content'} `} + {`(${element}) ${resourceData[element].length > 0 ? resourceData[element][0].language_title : t('label-no-content-available')} `}

@@ -447,7 +450,7 @@ function DownloadResourcePopUp({ selectResource, isOpenDonwloadPopUp, setIsOpenD
)} diff --git a/renderer/src/components/Sync/Gitea/EditorSync/EditorSync.js b/renderer/src/components/Sync/Gitea/EditorSync/EditorSync.js index ca52641d8..3cce09dcf 100644 --- a/renderer/src/components/Sync/Gitea/EditorSync/EditorSync.js +++ b/renderer/src/components/Sync/Gitea/EditorSync/EditorSync.js @@ -115,7 +115,7 @@ function EditorSync({ selectedProject }) { : (
{() => ( <> -
diff --git a/renderer/src/layouts/projects/ImportProjectPopUp.js b/renderer/src/layouts/projects/ImportProjectPopUp.js index 04670b926..a3ff22e74 100644 --- a/renderer/src/layouts/projects/ImportProjectPopUp.js +++ b/renderer/src/layouts/projects/ImportProjectPopUp.js @@ -244,7 +244,7 @@ export default function ImportProjectPopUp(props) {

{t('label-burrito-directory')}

-
diff --git a/renderer/src/layouts/projects/Layout.js b/renderer/src/layouts/projects/Layout.js index d8477b494..dfa70f578 100644 --- a/renderer/src/layouts/projects/Layout.js +++ b/renderer/src/layouts/projects/Layout.js @@ -61,7 +61,7 @@ export default function ProjectsLayout(props) {
-

{showArchived ? 'Archived Projects' : title}

+

{showArchived ? t('label-archived-prj') : title}

{header}
@@ -103,12 +103,12 @@ export default function ProjectsLayout(props) { {showArchived ? ( <> - Active + {t('label-active')} ) : ( <> - Archived + {t('label-archived')} )} diff --git a/renderer/src/modules/projects/NewProject.js b/renderer/src/modules/projects/NewProject.js index ccce0ac5b..a4477b056 100644 --- a/renderer/src/modules/projects/NewProject.js +++ b/renderer/src/modules/projects/NewProject.js @@ -384,7 +384,7 @@ export default function NewProject({ call, project, closeEdit }) { showLangCode={{ show: true, langkey: 'lc' }} />
-
- Projects + {t('projects-page')}
- Last Synced + {t('label-last-synced')}
@@ -201,7 +201,7 @@ export default function Sync() { {/* cloud project side */}
- Projects on Cloud + {t('label-prj-on-cloud')}
  • @@ -242,7 +242,7 @@ export default function Sync() { disabled={syncProgress.syncStarted} > - Save to Computer + {t('label-save-to-computer')} )} diff --git a/renderer/src/translations/en.js b/renderer/src/translations/en.js index 5933d0dfe..2cdc7f395 100644 --- a/renderer/src/translations/en.js +++ b/renderer/src/translations/en.js @@ -72,7 +72,7 @@ export const En = { 'label-chapter': 'Chapter', 'label-verse': 'Verse', 'label-import-resource': 'Import Resource', - 'label-resource': 'Resources', + 'label-resource': 'Resource', 'label-resource-bible': 'Bible', 'label-resource-obs-tn': 'OBS Translation Notes', 'label-resource-obs-tq': 'OBS Translation Questions', @@ -193,4 +193,48 @@ export const En = { 'n-7': '7', 'n-8': '8', 'n-9': '9', + 'label-active': 'Active', + 'label-archived': 'Archived', + 'label-archived-prj': 'Archived projects', + 'label-bible-translation': 'Bible Translation', + 'msg-lang-code-req': 'Language code is required', + 'msg-lang-name-req': 'Language name is required', + 'msg-min-three-letter': 'Type minimum 3 letters for search', + 'label-prj-on-my-computer': 'Project on my computer', + 'label-save-to-cloud': 'Save to cloud', + 'label-last-synced': 'Last synced', + 'label-prj-on-cloud': 'Projects on cloud', + 'label-save-to-computer': 'Save to computer', + 'label-view-more': 'View more', + 'label-create-new-user': 'Create new user', + 'label-user-name': 'User name', + 'label-privacy': 'Privacy', + 'label-terms': 'Terms', + 'label-collection': 'Collection', + 'label-select-folder': 'Select folder', + 'label-resources': 'Resources', + 'label-lang': 'Language', + 'label-type': 'Type', + 'label-select-language': 'Select Language', + 'label-pre-release': 'Pre-release', + 'label-save-filter': 'Save filter', + 'label-subject': 'Subject', + 'label-release': 'Release', + 'label-version': 'Version', + 'msg-select-dir-for-SB': 'Select a directory/project that has a Scripture Burrito file I.e. metadata.json file', + 'label-online-resources': 'Online Resources', + 'tooltip-download': 'Download', + 'msg-no-resource-for-bible-obs-download': '
    This content is unavailable for this language
    You can Import OwnScripture BurritoResources through Collection tab.
    Learn more about creating Scripture Burrito projects with Scribe. Refer Scribe Docs.
    ', + 'label-back': 'Back', + 'label-speed': 'Speed', + 'label-record': 'Record', + 'label-stop': 'Stop', + 'label-continue': 'Continue', + 'label-rewind': 'Rewind', + 'label-play': 'Play', + 'label-pause': 'Pause', + 'label-delete': 'Delete', + 'label-volume': 'Volume', + 'label-takes': 'Takes', + 'label-settings': 'Settings', }; diff --git a/renderer/src/translations/fa.js b/renderer/src/translations/fa.js index 2ef41cf2a..d20485cc4 100644 --- a/renderer/src/translations/fa.js +++ b/renderer/src/translations/fa.js @@ -193,4 +193,21 @@ export const Fa = { 'n-7': '۷', 'n-8': '۸', 'n-9': '۹', + 'label-active': 'Active', + 'label-archived': 'Archived', + 'label-archived-prj': 'Archived projects', + 'label-bible-translation': 'Bible Translation', + 'msg-lang-code-req': 'Language code is required', + 'msg-lang-name-req': 'Language name is required', + 'msg-min-three-letter': 'Type minimum 3 letters for search', + 'label-prj-on-my-computer': 'Project on my computer', + 'label-save-to-cloud': 'Save to cloud', + 'label-last-synced': 'Last synced', + 'label-prj-on-cloud': 'Projects on cloud', + 'label-save-to-computer': 'Save to computer', + 'label-view-more': 'View more', + 'label-create-new-user': 'Create new user', + 'label-user-name': 'User name', + 'label-privacy': 'Privacy', + 'label-terms': 'Terms', }; diff --git a/renderer/src/translations/fr.js b/renderer/src/translations/fr.js index 3aee5e4e4..a1e8a0fbd 100644 --- a/renderer/src/translations/fr.js +++ b/renderer/src/translations/fr.js @@ -86,6 +86,7 @@ export const Fr = { 'label-footnotes': 'Notes de pied', 'label-location': 'emplacement', 'label-audio-bible': 'l\'audio', + 'label-resource-obs-twl': 'Liste des mots de traduction OBS', 'placeholder-resource-name': 'Entrez le nom de la ressource', 'placeholder-license-name': 'Nom de la licence', 'placeholder-search': 'Recherche…', @@ -192,4 +193,48 @@ export const Fr = { 'n-7': '7', 'n-8': '8', 'n-9': '9', + 'label-active': 'Actif', + 'label-archived': 'Archivé', + 'label-archived-prj': 'Projets archivés', + 'label-bible-translation': 'Traduction biblique', + 'msg-lang-code-req': 'Le code de langue est requis', + 'msg-lang-name-req': 'Le nom de la langue est obligatoire', + 'msg-min-three-letter': 'Tapez au minimum 3 caractères pour rechercher', + 'label-prj-on-my-computer': 'Projeter sur mon ordinateur', + 'label-save-to-cloud': 'Enregistrer dans le cloud', + 'label-last-synced': 'Dernière synchronisation', + 'label-prj-on-cloud': 'Projets sur le cloud', + 'label-save-to-computer': 'Enregistrer sur l\'ordinateur', + 'label-view-more': 'Voir plus', + 'label-create-new-user': 'Créer un nouvel utilisateur', + 'label-user-name': 'Nom d\'utilisateur', + 'label-privacy': 'Confidentialité', + 'label-terms': 'Termes', + 'label-collection': 'Collecte', + 'label-select-folder': 'Sélectionner le dossier', + 'label-resources': 'Ressources', + 'label-lang': 'Langue', + 'label-type': 'Taper', + 'label-select-language': 'Choisir la langue', + 'label-pre-release': 'Avant-première', + 'label-save-filter': 'Enregistrer le filtre', + 'label-subject': 'Sujette', + 'label-release': 'Libérer', + 'label-version': 'Version', + 'msg-select-dir-for-SB': 'Sélectionnez un répertoire/projet contenant un fichier Scripture Burrito, par exemple. Fichier métadonnées.json', + 'label-online-resources': 'Ressources en ligne', + 'tooltip-download': 'Ressources en ligne', + 'msg-no-resource-for-bible-obs-download': '
    Ce contenu n\'est pas disponible pour cette langue
    Vous pouvez importer vos propres ressources de burrito bibliques via l\'onglet Collection.
    Apprenez-en davantage sur la création de projets Scripture Burrito avec Scribe. Reportez-vous aux documents Scribe.
    ', + 'label-back': 'dos', + 'label-speed': 'Speed', + 'label-record': 'Record', + 'label-stop': 'Stop', + 'label-continue': 'Continue', + 'label-rewind': 'Rewind', + 'label-play': 'Play', + 'label-pause': 'Pause', + 'label-delete': 'Delete', + 'label-volume': 'Volume', + 'label-takes': 'Takes', + 'label-settings': 'Settings', }; diff --git a/renderer/src/translations/hi.js b/renderer/src/translations/hi.js index e6a20f1dc..6d979c3d9 100644 --- a/renderer/src/translations/hi.js +++ b/renderer/src/translations/hi.js @@ -1,5 +1,5 @@ export const Hi = { - 'app-name': 'Scribe Scripture', + 'app-name': 'स्क्राइब स्क्रिप्चर', 'new-project-page': 'नया प्रोजेक्ट', 'edit-project': 'प्रोजेक्ट संपादित करें', 'label-abbreviation': 'संक्षेपाक्षर', @@ -10,7 +10,7 @@ export const Hi = { 'label-book': 'पुस्तक', 'label-import-book': 'पुस्तक आयात करें', 'label-saved': 'सहेजा गया है', - 'label-sync': 'sync', + 'label-sync': 'सिंक', 'label-comments': 'टिप्पणियाँ', 'label-cross-ref': 'क्रॉस रेफरेंस', 'label-add-footnote': 'फुटनोट जोड़ें', @@ -24,14 +24,14 @@ export const Hi = { 'label-edit-langauge': 'भाषा संपादित करें', 'label-script-direction': 'स्क्रिप्ट दिशा', 'label-drop-file-upload': 'अपलोड करने के लिए फ़ाइलें यहाँ डालें', - 'projects-page': 'प्रोजेक्ट्स/प्रोजेक्टएँ ', + 'projects-page': 'प्रोजेक्ट्स', 'label-search': 'खोजें', 'label-project': 'प्रोजेक्ट', 'label-flavour': 'स्वाद', 'label-project-type': 'प्रकार', 'label-project-name': 'प्रोजेक्ट का नाम', 'label-language': 'भाषा', - 'label-language-code': 'भाषा संकेत-लिपि', + 'label-language-code': 'भाषा कोड', 'label-all': 'सभी पुस्तकें', 'label-other': 'अन्य', 'label-Gitea': 'Gitea', @@ -76,7 +76,7 @@ export const Hi = { 'label-resource-bible': 'बाइबल', 'label-resource-obs-tn': 'OBS रांसलेशन नोट्स', 'label-resource-obs-tq': 'OBS ट्रांसलेशन प्रश्नों', - 'label-resource-obs': 'खुली बाइबिल कहानी', + 'label-resource-obs': 'ओपन बाइबल स्टोरी', 'label-resource-tn': 'ट्रांसलेशन नोट्स', 'label-resource-twlm': 'ट्रांसलेशन शब्द', 'label-resource-twl': 'ट्रांसलेशन शब्दों की सूची', @@ -85,6 +85,7 @@ export const Hi = { 'label-resource-name': 'संसाधन का नाम', 'label-footnotes': 'फुट नोट्स', 'label-location': 'स्थान', + 'label-audio-bible': 'अडियो', 'label-resource-obs-twl': 'OBS अनुवाद शब्द सूची', 'placeholder-resource-name': 'संसाधन का नाम दर्ज करें', 'placeholder-license-name': 'लाइसेंस का नाम', @@ -192,4 +193,48 @@ export const Hi = { 'n-7': '7', 'n-8': '8', 'n-9': '9', + 'label-active': 'सक्रिय', + 'label-archived': 'संग्रहीत', + 'label-archived-prj': 'संग्रहीत परियोजनाएँ', + 'label-bible-translation': 'बाइबल अनुवाद', + 'msg-lang-code-req': 'भाषा कोड आवश्यक है', + 'msg-lang-name-req': 'भाषा का नाम आवश्यक है', + 'msg-min-three-letter': 'न्यूनतम 3 अक्षर टाइप करने के लिए खोजें', + 'label-prj-on-my-computer': '', + 'label-save-to-cloud': 'क्लाउड में सहेजें', + 'label-last-synced': 'अंतिम बार समन्वयित किया गया', + 'label-prj-on-cloud': 'क्लाउड पर प्रोजेक्ट', + 'label-save-to-computer': 'कंप्यूटर में सहेजें', + 'label-view-more': 'और देखें', + 'label-create-new-user': 'नया उपयोगकर्ता बनाएं', + 'label-user-name': 'उपयोगकर्ता नाम', + 'label-privacy': 'गोपनीयता', + 'label-terms': 'शर्तें', + 'label-collection': 'संग्रह', + 'label-select-folder': 'फोल्डर का चयन करें', + 'label-resources': 'संसाधन', + 'label-lang': 'भाषा', + 'label-type': 'प्रकार', + 'label-select-language': 'भाषा चुने', + 'label-pre-release': 'प्री-रिलीज़', + 'label-save-filter': 'फ़िल्टर सहेजें', + 'label-subject': 'विषय', + 'label-release': 'मुक्त करना', + 'label-version': 'संस्करण', + 'msg-select-dir-for-SB': 'एक निर्देशिका/प्रोजेक्ट का चयन करें जिसमें एक स्क्रिप्चर बरिटो फ़ाइल हो यानी। मेटाडेटा.json फ़ाइल', + 'label-online-resources': 'ऑनलाइन संसाधन', + 'tooltip-download': 'डाउनलोड', + 'msg-no-resource-for-bible-obs-download': '
    यह सामग्री इस भाषा के लिए उपलब्ध नहीं है|
    आप संग्रह टैब के माध्यम से स्वयं के स्क्रिप्चर बरिटो संसाधनों को आयात कर सकते हैं।
    स्क्राइब के साथ स्क्रिप्चर बरिटो प्रोजेक्ट बनाने के बारे में और जानें। स्क्राइब दस्तावेज़ देखें।
    ', + 'label-back': 'पीछे', + 'label-speed': 'स्पीड', + 'label-record': 'रिकॉर्ड', + 'label-stop': 'स्टॉप', + 'label-continue': 'कंटिन्यू', + 'label-rewind': 'रिवाइंड', + 'label-play': 'प्ले', + 'label-pause': 'पॉज', + 'label-delete': 'डिलीट', + 'label-volume': 'वॉल्यूम', + 'label-takes': 'टैक्स', + 'label-settings': 'सेटिंग्स', }; diff --git a/renderer/src/translations/ne.js b/renderer/src/translations/ne.js index ae49ea591..a5397d815 100644 --- a/renderer/src/translations/ne.js +++ b/renderer/src/translations/ne.js @@ -76,7 +76,7 @@ export const Ne = { 'label-resource-bible': 'बाइबल', 'label-resource-obs-tn': 'OBS ट्रांसलेशन नोट्स', 'label-resource-obs-tq': 'OBS ट्रांसलेशन प्रश्‍नहरु', - 'label-resource-obs': 'खुला बाइबल कथा', + 'label-resource-obs': 'ओपन बाइबल स्टोरी', 'label-resource-tn': 'ट्रांसलेशन नोट्स', 'label-resource-twlm': 'ट्रांसलेशन शब्द', 'label-resource-twl': 'ट्रांसलेशन शब्दहरुको सूची', @@ -193,4 +193,48 @@ export const Ne = { 'n-7': '7', 'n-8': '8', 'n-9': '9', + 'label-active': 'सक्रिय', + 'label-archived': 'अभिलेख राखिएको', + 'label-archived-prj': 'संग्रहित परियोजनाहरू', + 'label-bible-translation': 'बाइबल अनुवाद', + 'msg-lang-code-req': 'भाषा कोड आवश्यक छ', + 'msg-lang-name-req': 'भाषाको नाम आवश्यक छ', + 'msg-min-three-letter': 'खोजको लागि न्यूनतम 3 अक्षरहरू टाइप गर्नुहोस्', + 'label-prj-on-my-computer': 'मेरो कम्प्युटरमा परियोजना', + 'label-save-to-cloud': 'क्लाउडमा बचत गर्नुहोस्', + 'label-last-synced': 'पछिल्लो पटक सिंक गरियो', + 'label-prj-on-cloud': 'क्लाउडमा परियोजनाहरू', + 'label-save-to-computer': 'कम्प्युटरमा बचत गर्नुहोस्', + 'label-view-more': 'अझ धेरै हेर्नुहोस्', + 'label-create-new-user': 'नयाँ प्रयोगकर्ता सिर्जना गर्नुहोस्', + 'label-user-name': 'प्रयोगकर्ता नाम', + 'label-privacy': 'गोपनीयता', + 'label-terms': 'सर्तहरू', + 'label-collection': 'सङ्कलन', + 'label-select-folder': 'फोल्डर चयन गर्नुहोस्', + 'label-resources': 'स्रोतहरू', + 'label-lang': 'भाषा', + 'label-type': 'टाइप गर्नुहोस्', + 'label-select-language': 'भाषा छनोट गर्नुस', + 'label-pre-release': 'पूर्व रिलीज', + 'label-save-filter': 'फिल्टर बचत गर्नुहोस्', + 'label-subject': 'विषय', + 'label-release': 'रिलीज', + 'label-version': 'संस्करण', + 'msg-select-dir-for-SB': 'एउटा डाइरेक्टरी/प्रोजेक्ट छान्नुहोस् जसमा धर्मशास्त्र बुरिटो फाइल छ। metadata.json फाइल', + 'label-online-resources': 'अनलाइन स्रोतहरू', + 'tooltip-download': 'डाउनलोड', + 'msg-no-resource-for-bible-obs-download': '
    यो सामग्री यस भाषाको लागि अनुपलब्ध छ
    तपाईं संग्रह ट्याब मार्फत आफ्नै धर्मशास्त्र Burrito स्रोतहरू आयात गर्न सक्नुहुन्छ।
    Scribe सँग स्क्रिप्चर बुरिटो परियोजनाहरू सिर्जना गर्ने बारे थप जान्नुहोस्। स्क्राइब कागजातहरू सन्दर्भ गर्नुहोस्।
    ', + 'label-back': 'फिर्ता', + 'label-speed': 'स्पीड', + 'label-record': 'रिकॉर्ड', + 'label-stop': 'स्टॉप', + 'label-continue': 'कंटिन्यू', + 'label-rewind': 'रिवाइंड', + 'label-play': 'प्ले', + 'label-pause': 'पॉज', + 'label-delete': 'डिलीट', + 'label-volume': 'वॉल्यूम', + 'label-takes': 'टैक्स', + 'label-settings': 'सेटिंग्स', }; diff --git a/renderer/src/translations/ru.js b/renderer/src/translations/ru.js index 24d9e5a59..592de75d3 100644 --- a/renderer/src/translations/ru.js +++ b/renderer/src/translations/ru.js @@ -85,6 +85,7 @@ export const Ru = { 'label-resource-name': 'Название ресурса', 'label-footnotes': 'Примечания', 'label-location': 'расположение', + 'label-audio-bible': 'Аудио', 'label-resource-obs-twl': 'ОБС Список слов', 'placeholder-resource-name': 'Введите имя ресурса', 'placeholder-license-name': 'Название лицензии', @@ -192,4 +193,48 @@ export const Ru = { 'n-7': '7', 'n-8': '8', 'n-9': '9', + 'label-active': 'Активный', + 'label-archived': 'В архиве', + 'label-archived-prj': 'Архивные проекты', + 'label-bible-translation': 'перевод Библии', + 'msg-lang-code-req': 'Требуется код языка.', + 'msg-lang-name-req': 'Укажите название языка.', + 'msg-min-three-letter': 'Введите минимум 3 символа для поиска', + 'label-prj-on-my-computer': 'Проект на моем компьютере', + 'label-save-to-cloud': 'Сохранить в облако', + 'label-last-synced': 'Последняя синхронизация', + 'label-prj-on-cloud': 'Проекты в облаке', + 'label-save-to-computer': 'Сохранить на компьютер', + 'label-view-more': 'Посмотреть больше', + 'label-create-new-user': 'Создать нового пользователя', + 'label-user-name': 'Имя пользователя', + 'label-privacy': 'Конфиденциальность', + 'label-terms': 'Условия', + 'label-collection': 'Коллекция', + 'label-select-folder': 'Выберите папку', + 'label-resources': 'Ресурсы', + 'label-lang': 'Язык', + 'label-type': 'Тип', + 'label-select-language': 'Выберите язык', + 'label-pre-release': 'Пререлиз', + 'label-save-filter': 'Сохранить фильтр', + 'label-subject': 'Предмет', + 'label-release': 'Выпускать', + 'label-version': 'Версия', + 'msg-select-dir-for-SB': 'Выберите каталог/проект, в котором есть файл Писания Буррито, т.е. файл метаданных.json', + 'label-online-resources': 'Интернет-ресурсы', + 'tooltip-download': 'скачать', + 'msg-no-resource-for-bible-obs-download': '
    Этот контент недоступен для этого языка
    Вы можете импортировать собственные ресурсы по буррито из Священных Писаний через вкладку «Коллекция».
    Узнайте больше о создании проектов Write Burrito с помощью Scribe. См. документацию Scribe.
    ', + 'label-back': 'назад', + 'label-speed': 'Speed', + 'label-record': 'Record', + 'label-stop': 'Stop', + 'label-continue': 'Continue', + 'label-rewind': 'Rewind', + 'label-play': 'Play', + 'label-pause': 'Pause', + 'label-delete': 'Delete', + 'label-volume': 'Volume', + 'label-takes': 'Takes', + 'label-settings': 'Settings', }; From ae4eec9987cdeee8a74de329c563e2f0d9dacb5f Mon Sep 17 00:00:00 2001 From: Ntare cedrick Date: Thu, 31 Aug 2023 15:22:25 +0200 Subject: [PATCH 20/34] file view fix --- pages/wip/components/EditData.js | 25 +++++++++ pages/wip/components/ViewFileData.js | 80 ++++++++++++++++++++++++++++ pages/wip/files.js | 68 +++++++++++------------ 3 files changed, 137 insertions(+), 36 deletions(-) create mode 100644 pages/wip/components/EditData.js create mode 100644 pages/wip/components/ViewFileData.js diff --git a/pages/wip/components/EditData.js b/pages/wip/components/EditData.js new file mode 100644 index 000000000..80695f7f6 --- /dev/null +++ b/pages/wip/components/EditData.js @@ -0,0 +1,25 @@ +import { ArrowPathRoundedSquareIcon, DocumentArrowDownIcon } from '@heroicons/react/20/solid'; +import React from 'react'; + +export default function EditData({ data, customFuction, both }) { +return ( +
    + + + //
    handleResetSingle(selectedFileContent, index)} + // title="RESET this section to initial state" + // className="bg-gray-300 w-6 h-6 rounded-full flex justify-center items-center p-1 self-center" + // > + // + //
    + //
    +
    -
    handleResetSingle(selectedFileContent, index)} - title="RESET this section to initial state" - className="bg-gray-300 w-6 h-6 rounded-full flex justify-center items-center p-1 self-center" - > - +
    + handleResetSingle(selectedFileContent, index)} + /> + {/* */}
    ) : ( + // Normal Text - No issues
    {text}
    ) ); diff --git a/renderer/src/layouts/projects/Import/ConflictSideBar.jsx b/renderer/src/layouts/projects/Import/ConflictSideBar.jsx index 75de5ca02..05698635f 100644 --- a/renderer/src/layouts/projects/Import/ConflictSideBar.jsx +++ b/renderer/src/layouts/projects/Import/ConflictSideBar.jsx @@ -21,7 +21,7 @@ function ConflictSideBar({ aria-disabled={resolvedFileNames.includes(file)} className={`px-5 py-2 ${resolvedFileNames.includes(file) ? 'line-through decoration-2 pointer-events-none' - : `${selectedFileName === file ? 'bg-primary/70' : 'hover:bg-primary/50 cursor-pointer'}`} `} + : `${selectedFileName === file ? 'bg-primary/70' : 'hover:bg-primary cursor-pointer'}`} `} > {file}
  • From c82390167d0aa57e6d44036701f1325c15c65ae8 Mon Sep 17 00:00:00 2001 From: sijumoncy <72241997+sijumoncy@users.noreply.github.com> Date: Fri, 1 Sep 2023 15:05:23 +0530 Subject: [PATCH 22/34] added more labels --- renderer/src/modules/projects/ImportPopUp.js | 8 ++--- renderer/src/modules/projects/ProjectList.js | 12 +++---- renderer/src/modules/projects/Sync.js | 4 +-- renderer/src/translations/en.js | 6 ++++ renderer/src/translations/fa.js | 33 ++++++++++++++++++++ renderer/src/translations/fr.js | 6 ++++ renderer/src/translations/hi.js | 6 ++++ renderer/src/translations/ne.js | 6 ++++ renderer/src/translations/ru.js | 6 ++++ 9 files changed, 75 insertions(+), 12 deletions(-) diff --git a/renderer/src/modules/projects/ImportPopUp.js b/renderer/src/modules/projects/ImportPopUp.js index b547eb43f..fb1bf7da3 100644 --- a/renderer/src/modules/projects/ImportPopUp.js +++ b/renderer/src/modules/projects/ImportPopUp.js @@ -20,6 +20,7 @@ export default function ImportPopUp(props) { projectType, } = props; + const { t } = useTranslation(); const cancelButtonRef = useRef(null); const [books, setBooks] = React.useState([]); const [folderPath, setFolderPath] = React.useState([]); @@ -29,8 +30,7 @@ export default function ImportPopUp(props) { const [notify, setNotify] = React.useState(); const [show, setShow] = React.useState(false); const [fileFilter, setfileFilter] = React.useState([{ name: 'usfm files', extensions: ['usfm', 'sfm', 'USFM', 'SFM'] }]); - const { t } = useTranslation(); - const [labelImportFiles, setLabelImportFiles] = React.useState('Choose USFM files'); + const [labelImportFiles, setLabelImportFiles] = React.useState(t('label-choose-usfm-files')); const { actions: { setImportedFiles, @@ -187,12 +187,12 @@ export default function ImportPopUp(props) { switch (projectType) { case 'Translation': setfileFilter([{ name: 'usfm files', extensions: ['usfm', 'sfm', 'USFM', 'SFM'] }]); - setLabelImportFiles('Choose USFM files'); + setLabelImportFiles(t('label-choose-usfm-files')); break; case 'OBS': setfileFilter([{ name: 'markdown files', extensions: ['md', 'markdown', 'MD', 'MARKDOWN'] }]); - setLabelImportFiles('Choose Markdown files'); + setLabelImportFiles(t('label-choose-md-files')); break; default: diff --git a/renderer/src/modules/projects/ProjectList.js b/renderer/src/modules/projects/ProjectList.js index 5677d2282..233eed306 100644 --- a/renderer/src/modules/projects/ProjectList.js +++ b/renderer/src/modules/projects/ProjectList.js @@ -232,11 +232,11 @@ export default function ProjectList() { > -
    description
    +
    {t('label-description')}
    {project.description}
    -
    Project ID
    +
    {t('label-project-id')}
    {project.id[0]}
    @@ -292,7 +292,7 @@ export default function ProjectList() { archiveProject(project, project.name); }} > - {project.isArchived === true ? 'Restore' : 'Archive'} + {project.isArchived === true ? t('label-restore') : t('label-archive')} )} @@ -390,11 +390,11 @@ export default function ProjectList() { > -
    description
    +
    {t('label-description')}
    {project.description}
    -
    Project ID
    +
    {t('label-project-id')}
    {project.id[0]}
    @@ -450,7 +450,7 @@ export default function ProjectList() { archiveProject(project, project.name); }} > - {project.isArchived === true ? 'Restore' : 'Archive'} + {project.isArchived === true ? t('label-restore') : t('label-archive')} )} diff --git a/renderer/src/modules/projects/Sync.js b/renderer/src/modules/projects/Sync.js index dd9a92837..b7ab1f845 100644 --- a/renderer/src/modules/projects/Sync.js +++ b/renderer/src/modules/projects/Sync.js @@ -173,7 +173,7 @@ export default function Sync() { {/* Local Projects */} {t('label-prj-on-my-computer')}
-
+ {/*
-
+
*/}
{/* Content */} -
+
{selectedFileContent.map((content, index) => (
{(index !== 0 && index !== selectedFileContent.length - 1) && ( diff --git a/renderer/src/layouts/projects/Import/ConflictSideBar.jsx b/renderer/src/layouts/projects/Import/ConflictSideBar.jsx index 05698635f..21470f12d 100644 --- a/renderer/src/layouts/projects/Import/ConflictSideBar.jsx +++ b/renderer/src/layouts/projects/Import/ConflictSideBar.jsx @@ -1,4 +1,4 @@ -import { Cog8ToothIcon } from '@heroicons/react/24/outline'; +// import { Cog8ToothIcon } from '@heroicons/react/24/outline'; function ConflictSideBar({ conflictData, setSelectedFileName, selectedFileName, resolvedFileNames, @@ -9,7 +9,7 @@ function ConflictSideBar({ {`${conflictData?.data?.files?.filepaths.length || 0} files`} - + {/* */}
    {conflictData?.data?.files?.filepaths?.sort()?.map((file) => ( From ca41727386f692ccd7fa6013002d76bf153be9b0 Mon Sep 17 00:00:00 2001 From: sijumoncy <72241997+sijumoncy@users.noreply.github.com> Date: Tue, 5 Sep 2023 14:52:30 +0530 Subject: [PATCH 24/34] waveform size increased to 80 from 40 --- renderer/src/components/AudioRecorder/components/Player.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renderer/src/components/AudioRecorder/components/Player.js b/renderer/src/components/AudioRecorder/components/Player.js index 2d62919e0..3922576c1 100644 --- a/renderer/src/components/AudioRecorder/components/Player.js +++ b/renderer/src/components/AudioRecorder/components/Player.js @@ -383,7 +383,7 @@ const Player = ({
Date: Tue, 5 Sep 2023 17:55:09 +0530 Subject: [PATCH 25/34] fixed usfm file imports in audio projects --- renderer/src/modules/projects/ImportPopUp.js | 6 ++++++ renderer/src/modules/projects/NewProject.js | 6 ++++-- renderer/src/util/createVersificationUSFM.js | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/renderer/src/modules/projects/ImportPopUp.js b/renderer/src/modules/projects/ImportPopUp.js index 36ab9aaed..38739ce97 100644 --- a/renderer/src/modules/projects/ImportPopUp.js +++ b/renderer/src/modules/projects/ImportPopUp.js @@ -18,6 +18,7 @@ export default function ImportPopUp(props) { open, closePopUp, projectType, + replaceConformation, } = props; const { t } = useTranslation(); @@ -107,6 +108,8 @@ export default function ImportPopUp(props) { const myUsfmParser = new grammar.USFMParser(usfm, grammar.LEVEL.RELAXED); const isJsonValid = myUsfmParser.validate(); if (isJsonValid) { + // If importing a USFM file then ask user for replace of USFM with the new content or not + replaceConformation(true); logger.debug('ImportPopUp.js', 'Valid USFM file.'); const jsonOutput = myUsfmParser.toJSON(); files.push({ id: jsonOutput.book.bookCode, content: usfm }); @@ -124,6 +127,8 @@ export default function ImportPopUp(props) { const myUsfmParser = new grammar.USFMParser(usfm, grammar.LEVEL.RELAXED); const isJsonValid = myUsfmParser.validate(); if (isJsonValid) { + // If importing a USFM file then ask user for replace of USFM with the new content or not + replaceConformation(true); logger.debug('ImportPopUp.js', 'Valid USFM file.'); const jsonOutput = myUsfmParser.toJSON(); files.push({ id: jsonOutput.book.bookCode, content: usfm }); @@ -334,4 +339,5 @@ ImportPopUp.propTypes = { open: PropTypes.bool, closePopUp: PropTypes.func, projectType: PropTypes.string, + replaceConformation: PropTypes.bool, }; diff --git a/renderer/src/modules/projects/NewProject.js b/renderer/src/modules/projects/NewProject.js index a4477b056..5de4212ae 100644 --- a/renderer/src/modules/projects/NewProject.js +++ b/renderer/src/modules/projects/NewProject.js @@ -241,7 +241,9 @@ export default function NewProject({ call, project, closeEdit }) { function closeImportPopUp() { setOpenPopUp(false); - if (call === 'edit') { + } + function callReplace(value) { + if (call === 'edit' && value === true) { setReplaceWarning(true); } } @@ -403,7 +405,7 @@ export default function NewProject({ call, project, closeEdit }) { > {t('btn-import-books')} - +
diff --git a/renderer/src/util/createVersificationUSFM.js b/renderer/src/util/createVersificationUSFM.js index 0b98df00b..fad81ab2c 100644 --- a/renderer/src/util/createVersificationUSFM.js +++ b/renderer/src/util/createVersificationUSFM.js @@ -30,7 +30,7 @@ export const createVersificationUSFM = ( ingredientsDirName = ingredientsDirName[0].split(/[(\\)?(/)?]/gm).slice(0)[0]; } if (projectType === 'Audio') { - folder = path.join(folder, 'text-1', ingredientsDirName); + folder = path.join(folder, 'text-1', call === 'edit' ? 'ingredients' : ingredientsDirName); } else { folder = path.join(folder, ingredientsDirName); } From 1157aaf256b009828743956a33c0188e6e16b2d6 Mon Sep 17 00:00:00 2001 From: sijumoncy <72241997+sijumoncy@users.noreply.github.com> Date: Wed, 6 Sep 2023 12:41:26 +0530 Subject: [PATCH 26/34] added language keys for merge --- renderer/src/translations/en.js | 16 ++++++++++++++++ renderer/src/translations/fa.js | 16 ++++++++++++++++ renderer/src/translations/fr.js | 16 ++++++++++++++++ renderer/src/translations/hi.js | 16 ++++++++++++++++ renderer/src/translations/ne.js | 16 ++++++++++++++++ renderer/src/translations/ru.js | 16 ++++++++++++++++ 6 files changed, 96 insertions(+) diff --git a/renderer/src/translations/en.js b/renderer/src/translations/en.js index 3965f1f54..b5a6e003e 100644 --- a/renderer/src/translations/en.js +++ b/renderer/src/translations/en.js @@ -243,4 +243,20 @@ export const En = { 'tooltip-save-computer-btn': 'This action will clone or update your local data with Door43 data', 'label-choose-usfm-files': 'Choose USFM files', 'label-choose-md-files': 'Choose Markdown files', + 'label-merge': 'Merge', + 'label-abort': 'Abort', + 'tooltip-star-project': 'Star Project', + 'tooltip-un-star-project': 'Unstar Project', + 'tooltip-merge-all-orginal-btn': 'Accept ORIGINAL for all non resolved conflict sections in the opened file', + 'tooltip-merge-orginal-btn': 'Accept ORIGINAL changes to resolve conflict', + 'tooltip-merge-all-reset-btn': 'RESET the opened file to initial state', + 'tooltip-merge-all-both-btn': 'Accept BOTH for all non resolved conflict sections in the opened file', + 'tooltip-merge-both-btn': 'Accept BOTH changes to resolve conflict', + 'tooltip-merge-all-new-btn': 'Accept NEW for all non resolved conflict sections in the opened file', + 'tooltip-merge-new-btn': 'Accept NEW changes to resolve conflict', + 'label-original': 'Original', + 'label-new': 'New', + 'label-reset': 'Reset', + 'label-both': 'Both', + 'label-overwrite': 'Overwrite', }; diff --git a/renderer/src/translations/fa.js b/renderer/src/translations/fa.js index 5ce3b5f3e..16c886942 100644 --- a/renderer/src/translations/fa.js +++ b/renderer/src/translations/fa.js @@ -243,4 +243,20 @@ export const Fa = { 'tooltip-save-computer-btn': 'This action will clone or update your local data with Door43 data', 'label-choose-usfm-files': 'Choose USFM files ', 'label-choose-md-files': 'Choose Markdown files', + 'label-merge': 'Merge', + 'label-abort': 'Abort', + 'tooltip-star-project': 'Star Project', + 'tooltip-un-star-project': 'Unstar Project', + 'tooltip-merge-all-orginal-btn': 'Accept ORIGINAL for all non resolved conflict sections in the opened file', + 'tooltip-merge-orginal-btn': 'Accept ORIGINAL changes to resolve conflict', + 'tooltip-merge-all-reset-btn': 'RESET the opened file to initial state', + 'tooltip-merge-all-both-btn': 'Accept BOTH for all non resolved conflict sections in the opened file', + 'tooltip-merge-both-btn': 'Accept BOTH changes to resolve conflict', + 'tooltip-merge-all-new-btn': 'Accept NEW for all non resolved conflict sections in the opened file', + 'tooltip-merge-new-btn': 'Accept NEW changes to resolve conflict', + 'label-original': 'Original', + 'label-new': 'New', + 'label-reset': 'Reset', + 'label-both': 'Both', + 'label-overwrite': 'Overwrite', }; diff --git a/renderer/src/translations/fr.js b/renderer/src/translations/fr.js index aef33199d..bae184f41 100644 --- a/renderer/src/translations/fr.js +++ b/renderer/src/translations/fr.js @@ -243,4 +243,20 @@ export const Fr = { 'tooltip-save-computer-btn': 'Cette action clonera ou mettra à jour vos données locales avec les données Door43', 'label-choose-usfm-files': 'Choisissez les fichiers USFM', 'label-choose-md-files': 'Choisissez les fichiers Markdown', + 'label-merge': 'Fusionner', + 'label-abort': 'Avorter', + 'tooltip-star-project': 'Projet Étoile', + 'tooltip-un-star-project': 'Projet Unstar', + 'tooltip-merge-all-orginal-btn': 'Acceptez ORIGINAL pour toutes les sections de conflit non résolues dans le fichier ouvert', + 'tooltip-merge-orginal-btn': 'Acceptez les modifications ORIGINALES pour résoudre le conflit', + 'tooltip-merge-all-reset-btn': 'RÉINITIALISER le fichier ouvert à son état initial', + 'tooltip-merge-all-both-btn': 'Acceptez les DEUX modifications pour résoudre le conflit', + 'tooltip-merge-both-btn': 'Acceptez les DEUX pour toutes les sections de conflit non résolues dans le fichier ouvert', + 'tooltip-merge-all-new-btn': 'Acceptez NEW pour toutes les sections de conflit non résolues dans le fichier ouvert', + 'tooltip-merge-new-btn': 'Acceptez les NOUVELLES modifications pour résoudre les conflits', + 'label-original': 'Originale', + 'label-new': 'Nouvelle', + 'label-reset': 'Réinitialiser', + 'label-both': 'Les deux', + 'label-overwrite': 'Écraser', }; diff --git a/renderer/src/translations/hi.js b/renderer/src/translations/hi.js index e11932d9f..e965763a5 100644 --- a/renderer/src/translations/hi.js +++ b/renderer/src/translations/hi.js @@ -243,4 +243,20 @@ export const Hi = { 'tooltip-save-computer-btn': 'यह क्रिया आपके स्थानीय डेटा को डोर43 डेटा के साथ क्लोन या अपडेट कर देगी', 'label-choose-usfm-files': 'यूएसएफएम फ़ाइलें चुनें', 'label-choose-md-files': 'Markdown फ़ाइलें चुनें', + 'label-merge': 'मर्ज', + 'label-abort': 'बीच में बंद करें', + 'tooltip-star-project': 'स्टार परियोजना', + 'tooltip-un-star-project': 'अनस्टार प्रोजेक्ट', + 'tooltip-merge-all-orginal-btn': 'खोली गई फ़ाइल में सभी गैर-समाधानित संघर्ष अनुभागों के लिए मूल स्वीकार करें', + 'tooltip-merge-orginal-btn': 'संघर्ष को हल करने के लिए मूल परिवर्तन स्वीकार करें', + 'tooltip-merge-all-reset-btn': 'खुली हुई फ़ाइल को आरंभिक स्थिति में रीसेट करें', + 'tooltip-merge-all-both-btn': 'संघर्ष को सुलझाने के लिए दोनों परिवर्तन स्वीकार करें', + 'tooltip-merge-both-btn': 'खोली गई फ़ाइल में सभी गैर-समाधानित संघर्ष अनुभागों के लिए दोनों को स्वीकार करें', + 'tooltip-merge-all-new-btn': 'खोली गई फ़ाइल में सभी गैर-समाधानित संघर्ष अनुभागों के लिए नया स्वीकार करें', + 'tooltip-merge-new-btn': 'संघर्ष को सुलझाने के लिए नए परिवर्तन स्वीकार करें', + 'label-original': 'मूल', + 'label-new': 'नया', + 'label-reset': 'रीसेट', + 'label-both': 'दोनों', + 'label-overwrite': 'ओवरराइट', }; diff --git a/renderer/src/translations/ne.js b/renderer/src/translations/ne.js index 11e0cec96..2c56e2396 100644 --- a/renderer/src/translations/ne.js +++ b/renderer/src/translations/ne.js @@ -243,4 +243,20 @@ export const Ne = { 'tooltip-save-computer-btn': 'यो कार्यले Door43 डाटाको साथ तपाईंको स्थानीय डाटा क्लोन वा अपडेट गर्नेछ', 'label-choose-usfm-files': 'USFM फाइलहरू छान्नुहोस्', 'label-choose-md-files': 'Markdown फाइलहरू छान्नुहोस्', + 'label-merge': 'मर्ज गर्नुहोस्', + 'label-abort': 'रद्द गर्नुहोस्', + 'tooltip-star-project': 'स्टार प्रोजेक्ट', + 'tooltip-un-star-project': 'अनस्टार परियोजना', + 'tooltip-merge-all-orginal-btn': 'खोलिएको फाइलमा समाधान नगरिएका सबै द्वन्द्व खण्डहरूको लागि ORIGINAL स्वीकार गर्नुहोस्', + 'tooltip-merge-orginal-btn': 'विवाद समाधान गर्न मूल परिवर्तनहरू स्वीकार गर्नुहोस्', + 'tooltip-merge-all-reset-btn': 'खोलिएको फाइललाई प्रारम्भिक अवस्थामा रिसेट गर्नुहोस्', + 'tooltip-merge-all-both-btn': 'द्वन्द्व समाधान गर्न दुवै परिवर्तनहरू स्वीकार गर्नुहोस्', + 'tooltip-merge-both-btn': 'खोलिएको फाइलमा समाधान नगरिएका सबै द्वन्द्व खण्डहरूको लागि दुवै स्वीकार गर्नुहोस्', + 'tooltip-merge-all-new-btn': 'खोलिएको फाइलमा समाधान नगरिएका सबै द्वन्द्व खण्डहरूको लागि नयाँ स्वीकार गर्नुहोस्', + 'tooltip-merge-new-btn': 'विवाद समाधान गर्न नयाँ परिवर्तनहरू स्वीकार गर्नुहोस्', + 'label-original': 'मौलिक', + 'label-new': 'नयाँ', + 'label-reset': 'रिसेट गर्नुहोस्', + 'label-both': 'दुबै', + 'label-overwrite': 'अधिलेखन गर्नुहोस्', }; diff --git a/renderer/src/translations/ru.js b/renderer/src/translations/ru.js index fa630d8f1..3ee1e965b 100644 --- a/renderer/src/translations/ru.js +++ b/renderer/src/translations/ru.js @@ -243,4 +243,20 @@ export const Ru = { 'tooltip-save-computer-btn': 'Это действие клонирует или обновит ваши локальные данные данными Door43.', 'label-choose-usfm-files': 'Выберите файлы USFM', 'label-choose-md-files': 'Выберите файлы Markdown', + 'label-merge': 'Объединить', + 'label-abort': 'Прервать', + 'tooltip-star-project': 'Звездный проект', + 'tooltip-un-star-project': 'Снять звезду проекта', + 'tooltip-merge-all-orginal-btn': 'Примите ОРИГИНАЛ для всех неразрешенных конфликтных разделов в открытом файле.', + 'tooltip-merge-orginal-btn': 'Примите ОРИГИНАЛЬНЫЕ изменения для разрешения конфликта.', + 'tooltip-merge-all-reset-btn': 'СБРОСИТЬ открытый файл в исходное состояние', + 'tooltip-merge-all-both-btn': 'Примите ОБА изменения, чтобы разрешить конфликт.', + 'tooltip-merge-both-btn': 'Примите ОБА для всех неразрешенных разделов конфликта в открытом файле.', + 'tooltip-merge-all-new-btn': 'Примите NEW для всех неразрешенных конфликтных разделов в открытом файле.', + 'tooltip-merge-new-btn': 'Примите НОВЫЕ изменения для разрешения конфликта', + 'label-original': 'Оригинал', + 'label-new': 'Новый', + 'label-reset': 'Перезагрузить', + 'label-both': 'Оба', + 'label-overwrite': 'Перезаписать', }; From 3cccf9b8567ed8a45d24b00fedebb2366cd35730 Mon Sep 17 00:00:00 2001 From: sijumoncy <72241997+sijumoncy@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:57:34 +0530 Subject: [PATCH 27/34] added app tranaltions for merge and other ui parts --- .../AudioRecorder/components/Player.js | 12 +++++------ .../CreateProject/AdvancedSettingsDropdown.js | 2 +- .../Gitea/ProjectMerge/ProjectMergePopUp.js | 1 + .../components/Sync/Gitea/SyncFromGitea.js | 4 ++-- .../Sync/Gitea/SyncFromGiteaUtils.js | 4 ++-- renderer/src/layouts/editor/MenuBar.js | 2 +- .../projects/Export/ExportProjectPopUp.js | 2 +- .../projects/Import/ConflictEditor.jsx | 20 ++++++++++--------- .../projects/Import/ConflictResolverUI.jsx | 14 +++++++------ .../projects/Import/ConflictSection.jsx | 8 +++++--- .../projects/Import/ConflictSideBar.jsx | 4 +++- .../layouts/projects/ImportProjectPopUp.js | 2 +- renderer/src/modules/projects/ProjectList.js | 4 ++-- renderer/src/modules/projects/Sync.js | 2 +- renderer/src/translations/en.js | 15 +++++++++++++- renderer/src/translations/fa.js | 13 ++++++++++++ renderer/src/translations/fr.js | 13 ++++++++++++ renderer/src/translations/hi.js | 13 ++++++++++++ renderer/src/translations/ne.js | 13 ++++++++++++ renderer/src/translations/ru.js | 14 +++++++++++++ 20 files changed, 125 insertions(+), 37 deletions(-) diff --git a/renderer/src/components/AudioRecorder/components/Player.js b/renderer/src/components/AudioRecorder/components/Player.js index 2d62919e0..24cfdf29c 100644 --- a/renderer/src/components/AudioRecorder/components/Player.js +++ b/renderer/src/components/AudioRecorder/components/Player.js @@ -45,9 +45,9 @@ const Player = ({ if (url[take]) { setOpenModal({ openModel: true, - title: 'Re-record the Audio', - confirmMessage: 'Do you want to re-record the audio', - buttonName: 'Re-record', + title: t('modal-title-re-record'), + confirmMessage: t('msg-re-record-audio'), + buttonName: t('label-re-record'), }); } else { // Recording for the first time @@ -59,9 +59,9 @@ const Player = ({ if (url[take]) { setOpenModal({ openModel: true, - title: 'Delete the Audio', - confirmMessage: 'Do you want to delete the selected take', - buttonName: 'Delete', + title: t('modal-title-delete-audio'), + confirmMessage: t('msg-delete-audio'), + buttonName: t('label-delete'), }); setTrigger('delete'); } diff --git a/renderer/src/components/ProjectsPage/CreateProject/AdvancedSettingsDropdown.js b/renderer/src/components/ProjectsPage/CreateProject/AdvancedSettingsDropdown.js index 5ac694bfc..5d83d9946 100644 --- a/renderer/src/components/ProjectsPage/CreateProject/AdvancedSettingsDropdown.js +++ b/renderer/src/components/ProjectsPage/CreateProject/AdvancedSettingsDropdown.js @@ -305,7 +305,7 @@ export default function AdvancedSettingsDropdown({ call, project, projectType }) projectType === 'OBS' && ( <>

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

diff --git a/renderer/src/components/Sync/Gitea/ProjectMerge/ProjectMergePopUp.js b/renderer/src/components/Sync/Gitea/ProjectMerge/ProjectMergePopUp.js index d86679e00..db5190522 100644 --- a/renderer/src/components/Sync/Gitea/ProjectMerge/ProjectMergePopUp.js +++ b/renderer/src/components/Sync/Gitea/ProjectMerge/ProjectMergePopUp.js @@ -55,6 +55,7 @@ export default function ProjectMergePop({ selectedGiteaProject, setSelectedGitea null, selectedGiteaProject.localUsername, ignoreFilesPaths, + t, ); setStepCount((prevStepCount) => prevStepCount + 1); setMergeDone(true); diff --git a/renderer/src/components/Sync/Gitea/SyncFromGitea.js b/renderer/src/components/Sync/Gitea/SyncFromGitea.js index 9738d9403..c495618da 100644 --- a/renderer/src/components/Sync/Gitea/SyncFromGitea.js +++ b/renderer/src/components/Sync/Gitea/SyncFromGitea.js @@ -7,7 +7,7 @@ import { checkDuplicate } from '@/core/burrito/importBurrito'; import * as logger from '../../../logger'; import { importServerProject } from './SyncFromGiteaUtils'; -export async function downloadFromGitea(repo, auth, setSyncProgress, notifyStatus, setSelectedGiteaProject, addNotification, branch, setPullPopup, setPullData) { +export async function downloadFromGitea(repo, auth, setSyncProgress, notifyStatus, setSelectedGiteaProject, addNotification, branch, setPullPopup, setPullData, t = undefined) { logger.debug('SyncFromGitea.js', 'in SyncFromGiea : onClick offline sync'); try { const currentUser = await localForage.getItem('userProfile'); @@ -59,7 +59,7 @@ export async function downloadFromGitea(repo, auth, setSyncProgress, notifyStatu // check for project exising - true/ undefined const duplicate = await checkDuplicate(metaDataSB, currentUser?.username, 'projects'); logger.debug('SyncFromGitea.js', 'in SyncFromGiea : new project and import called'); - const status = await importServerProject(false, repo, metaDataSB, auth, branch, { setSyncProgress, notifyStatus }, currentUser.username, duplicate, setPullPopup, setPullData); + const status = await importServerProject(false, repo, metaDataSB, auth, branch, { setSyncProgress, notifyStatus }, currentUser.username, duplicate, setPullPopup, setPullData, t); if (status) { await notifyStatus('success', 'Project Sync to scribe successfull'); await addNotification('Sync', 'Project Sync Successfull', 'success'); diff --git a/renderer/src/components/Sync/Gitea/SyncFromGiteaUtils.js b/renderer/src/components/Sync/Gitea/SyncFromGiteaUtils.js index 8199d4e22..c9c06a23e 100644 --- a/renderer/src/components/Sync/Gitea/SyncFromGiteaUtils.js +++ b/renderer/src/components/Sync/Gitea/SyncFromGiteaUtils.js @@ -173,7 +173,7 @@ export const cloneAndSetProject = async (fs, gitprojectDir, repo, userBranch, au }; // import gitea project to local -export const importServerProject = async (updateBurrito, repo, sbData, auth, userBranch, action, currentUser, duplicate, setPullPopup, setPullData) => { +export const importServerProject = async (updateBurrito, repo, sbData, auth, userBranch, action, currentUser, duplicate, setPullPopup, setPullData, t = undefined) => { try { logger.debug('SyncFromGiteaUtils.js', 'Inside Import Project core'); const fs = window.require('fs'); @@ -313,7 +313,7 @@ export const importServerProject = async (updateBurrito, repo, sbData, auth, use title: 'Sync the Changes', status: true, confirmMessage: oldSyncMessage, - buttonName: 'Accepted', + buttonName: t ? t('label-accepted') : 'Accepted', }); return false; } diff --git a/renderer/src/layouts/editor/MenuBar.js b/renderer/src/layouts/editor/MenuBar.js index 6b5f35506..9bf7658a8 100644 --- a/renderer/src/layouts/editor/MenuBar.js +++ b/renderer/src/layouts/editor/MenuBar.js @@ -82,7 +82,7 @@ export default function TopMenuBar() { />
- + {projectname?.[0]}
diff --git a/renderer/src/layouts/projects/Export/ExportProjectPopUp.js b/renderer/src/layouts/projects/Export/ExportProjectPopUp.js index 67b5e708f..e23a74032 100644 --- a/renderer/src/layouts/projects/Export/ExportProjectPopUp.js +++ b/renderer/src/layouts/projects/Export/ExportProjectPopUp.js @@ -226,7 +226,7 @@ export default function ExportProjectPopUp(props) {
-

Export file path

+

{t('label-export-file-path')}

{ if (resolvedFileNames?.includes(selectedFileName)) { @@ -109,27 +111,27 @@ function ConflictEditor({
- comparison + {t('label-comparison')}
@@ -137,10 +139,10 @@ function ConflictEditor({ type="button" onClick={() => resolveAllTogether(selectedFileContent, 'both')} disabled={resolveAllActive === false} - title="Accept BOTH for all non resolved conflict sections in the opened file" + title={t('tooltip-merge-all-both-btn')} className={`${resolveAllActive ? 'px-2.5 py-0.5 bg-blue-500 text-white font-semibold tracking-wider text-xs uppercase rounded-xl' : 'hidden'}`} > - Both + {t('label-both')} @@ -148,10 +150,10 @@ function ConflictEditor({ type="button" onClick={() => resetAllResolved()} disabled={resetAlll === false} - title="RESET the opened file to initial state" + title={t('tooltip-merge-all-reset-btn')} className={`px-2.5 py-0.5 bg-gray-300 font-semibold tracking-wider text-xs uppercase rounded-xl ${resetAlll ? 'text-black' : 'text-gray-400'}`} > - Reset + {t('label-reset')} diff --git a/renderer/src/layouts/projects/Import/ConflictResolverUI.jsx b/renderer/src/layouts/projects/Import/ConflictResolverUI.jsx index 42546a3e8..52c2daa22 100644 --- a/renderer/src/layouts/projects/Import/ConflictResolverUI.jsx +++ b/renderer/src/layouts/projects/Import/ConflictResolverUI.jsx @@ -4,12 +4,14 @@ import React, { import { Dialog, Transition } from '@headlessui/react'; import { XMarkIcon } from '@heroicons/react/24/outline'; import ConfirmationModal from '@/layouts/editor/ConfirmationModal'; +import { useTranslation } from 'react-i18next'; import * as logger from '../../../logger'; import ConflictSideBar from './ConflictSideBar'; import { copyFilesTempToOrginal, parseObs, updateAndSaveStory } from './mergeObsUtils'; import ConflictEditor from './ConflictEditor'; function ConflictResolverUI({ conflictData, setConflictPopup }) { + const { t } = useTranslation(); const cancelButtonRef = useRef(null); const [selectedFileName, setSelectedFileName] = useState(); const [selectedFileContent, setSelectedFileContent] = useState([]); @@ -79,9 +81,9 @@ function ConflictResolverUI({ conflictData, setConflictPopup }) { // popup with warning setModel({ openModel: true, - title: 'Abort Conflict Resolution', - confirmMessage: 'Do you want to abort conflict Resolution process. If you abort , you will loose all your progress and need to start over.', - buttonName: 'Abort', + title: t('modal-title-abort-conflict-resolution'), + confirmMessage: t('msg-abort-conflict-resolution'), + buttonName: t('label-abort'), }); } }; @@ -143,7 +145,7 @@ function ConflictResolverUI({ conflictData, setConflictPopup }) {
-

RESOLVE CONFLICT

+

{t('label-resolve-conflict')}

{/* close btn section */}
)} @@ -204,7 +206,7 @@ function ConflictResolverUI({ conflictData, setConflictPopup }) { type="button" disabled={!enableSave || resolvedFileNames.includes(selectedFileName)} > - {resolvedFileNames?.includes(selectedFileName) ? 'Resolved' : 'Save'} + {resolvedFileNames?.includes(selectedFileName) ? t('label-resolved') : t('btn-save')}
diff --git a/renderer/src/layouts/projects/Import/ConflictSection.jsx b/renderer/src/layouts/projects/Import/ConflictSection.jsx index e93875474..d6ca856b5 100644 --- a/renderer/src/layouts/projects/Import/ConflictSection.jsx +++ b/renderer/src/layouts/projects/Import/ConflictSection.jsx @@ -5,10 +5,12 @@ import { useState } from 'react'; import { ArrowSmallDownIcon, ArrowSmallUpIcon, ArrowsUpDownIcon, ArrowPathRoundedSquareIcon, } from '@heroicons/react/20/solid'; + import { useTranslation } from 'react-i18next'; const ConflictSection = ({ text, index, setSelectedFileContent, selectedFileContent, handleResetSingle, resolvedFileNames, selectedFileName, }) => { + const { t } = useTranslation(); const [hoveredId, setHoveredId] = useState(''); const handleSelection = (content, index, selectedResolverType) => { @@ -73,7 +75,7 @@ const ConflictSection = ({ onClick={() => { setHoveredId(''); handleSelection(matchedData.current, index, 'current'); }} onMouseEnter={() => setHoveredId('current')} onMouseLeave={() => setHoveredId('')} - title="Accept ORIGINAL changes to resolve conflict" + title={t('tooltip-merge-orginal-btn')} className="bg-black w-6 h-6 rounded-full flex justify-center items-center" > @@ -85,7 +87,7 @@ const ConflictSection = ({ onClick={() => { setHoveredId(''); handleSelection(`${matchedData.current}\t${matchedData.incoming}`, index, 'both'); }} onMouseEnter={() => setHoveredId('both')} onMouseLeave={() => setHoveredId('')} - title="Accept BOTH changes to resolve conflict" + title={t('tooltip-merge-both-btn')} className="bg-blue-500 w-6 h-6 rounded-full flex justify-center items-center" > @@ -97,7 +99,7 @@ const ConflictSection = ({ onClick={() => { setHoveredId(''); handleSelection(matchedData.incoming, index, 'incoming'); }} onMouseEnter={() => setHoveredId('incoming')} onMouseLeave={() => setHoveredId('')} - title="Accept NEW changes to resolve conflict" + title={t('tooltip-merge-new-btn')} className="bg-success w-6 h-6 rounded-full flex justify-center items-center" > diff --git a/renderer/src/layouts/projects/Import/ConflictSideBar.jsx b/renderer/src/layouts/projects/Import/ConflictSideBar.jsx index 21470f12d..685828814 100644 --- a/renderer/src/layouts/projects/Import/ConflictSideBar.jsx +++ b/renderer/src/layouts/projects/Import/ConflictSideBar.jsx @@ -1,13 +1,15 @@ // import { Cog8ToothIcon } from '@heroicons/react/24/outline'; +import { useTranslation } from 'react-i18next'; function ConflictSideBar({ conflictData, setSelectedFileName, selectedFileName, resolvedFileNames, }) { + const { t } = useTranslation(); return (
- {`${conflictData?.data?.files?.filepaths.length || 0} files`} + {`${conflictData?.data?.files?.filepaths.length || 0} ${t('label-files')}`} {/* */}
diff --git a/renderer/src/layouts/projects/ImportProjectPopUp.js b/renderer/src/layouts/projects/ImportProjectPopUp.js index a3ff22e74..cc5b4d32b 100644 --- a/renderer/src/layouts/projects/ImportProjectPopUp.js +++ b/renderer/src/layouts/projects/ImportProjectPopUp.js @@ -355,7 +355,7 @@ export default function ImportProjectPopUp(props) { buttonName2={{ active: merge, loading: processMerge, - name:'Merge', + name:t('label-merge'), action: () => MergeFunction(), }} /> diff --git a/renderer/src/modules/projects/ProjectList.js b/renderer/src/modules/projects/ProjectList.js index 233eed306..3c83005b4 100644 --- a/renderer/src/modules/projects/ProjectList.js +++ b/renderer/src/modules/projects/ProjectList.js @@ -175,7 +175,7 @@ export default function ProjectList() { >