From 0db210e995ba4810b89ef5bb1aeea86bb0617e7e Mon Sep 17 00:00:00 2001
From: sijumoncy <72241997+sijumoncy@users.noreply.github.com>
Date: Thu, 4 Jan 2024 16:12:08 +0530
Subject: [PATCH 1/3] loading added for helps resources
---
.../Reference/TranslationHelpsCard.js | 32 +++++++++++--------
1 file changed, 18 insertions(+), 14 deletions(-)
diff --git a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js
index 6bfad3fa5..f7592104f 100644
--- a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js
+++ b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js
@@ -4,6 +4,7 @@ import {
useContent,
} from 'translation-helps-rcl';
import localForage from 'localforage';
+import LoadingScreen from '@/components/Loading/LoadingScreen';
import ReferenceCard from './ReferenceCard';
import * as logger from '../../../logger';
import packageInfo from '../../../../../package.json';
@@ -221,20 +222,23 @@ export default function TranslationHelpsCard({
markdown = offlineResource?.offline ? offlineMarkdown : markdown;
return (
-
+ (markdown || items) ? (
+
+ ) :
+
);
}
From 9d2176ef05c26ceb77d3bb8b939c53d91c1e8a93 Mon Sep 17 00:00:00 2001
From: sijumoncy <72241997+sijumoncy@users.noreply.github.com>
Date: Fri, 5 Jan 2024 09:25:44 +0530
Subject: [PATCH 2/3] added fix for infinite loading
---
.../EditorPage/Reference/TranslationHelpsCard.js | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js
index f7592104f..5938319d8 100644
--- a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js
+++ b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js
@@ -105,6 +105,7 @@ export default function TranslationHelpsCard({
};
}).filter((data) => data.Chapter === chapter && data.Verse === verse);
setOfflineItemsDisable(false);
+ console.log({ json });
setOfflineItems(json);
}
}
@@ -178,7 +179,7 @@ export default function TranslationHelpsCard({
setOfflineItemsDisable(true);
setOfflineMarkdown(filecontent);
} else {
- setOfflineMarkdown('');
+ setOfflineMarkdown({ error: true, data: 'No Content Avaialble' });
}
}
});
@@ -192,6 +193,8 @@ export default function TranslationHelpsCard({
const filecontent = fs.readFileSync(path.join(folder, projectName, projectId, filePath), 'utf8');
setOfflineItemsDisable(true);
setOfflineMarkdown(filecontent);
+ } else {
+ setOfflineMarkdown({ error: true, data: 'No Content Available' });
}
break;
@@ -202,6 +205,8 @@ export default function TranslationHelpsCard({
const filecontent = fs.readFileSync(path.join(folder, projectName, 'bible', filePath), 'utf8');
setOfflineItemsDisable(true);
setOfflineMarkdown(filecontent);
+ } else {
+ setOfflineMarkdown({ error: true, data: 'No Content Available' });
}
break;
@@ -221,6 +226,10 @@ export default function TranslationHelpsCard({
items = !offlineItemsDisable && offlineResource?.offline ? offlineItems : items;
markdown = offlineResource?.offline ? offlineMarkdown : markdown;
+ console.log({
+ markdown, isLoading, items, offlineMarkdown, offlineItems,
+});
+
return (
(markdown || items) ? (
Date: Fri, 5 Jan 2024 09:27:30 +0530
Subject: [PATCH 3/3] lint fix
---
.../components/EditorPage/Reference/TranslationHelpsCard.js | 5 -----
1 file changed, 5 deletions(-)
diff --git a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js
index 5938319d8..303ca2020 100644
--- a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js
+++ b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js
@@ -105,7 +105,6 @@ export default function TranslationHelpsCard({
};
}).filter((data) => data.Chapter === chapter && data.Verse === verse);
setOfflineItemsDisable(false);
- console.log({ json });
setOfflineItems(json);
}
}
@@ -226,10 +225,6 @@ export default function TranslationHelpsCard({
items = !offlineItemsDisable && offlineResource?.offline ? offlineItems : items;
markdown = offlineResource?.offline ? offlineMarkdown : markdown;
- console.log({
- markdown, isLoading, items, offlineMarkdown, offlineItems,
-});
-
return (
(markdown || items) ? (