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 = ({