From 926534da4452a051aac6e8ce6c59ef510d91af53 Mon Sep 17 00:00:00 2001 From: Siju Moncy <72241997+sijumoncy@users.noreply.github.com> Date: Fri, 5 Jan 2024 10:54:46 +0530 Subject: [PATCH] loading added for helps resources (#287) * loading added for helps resources * added fix for infinite loading * lint fix --- .../Reference/TranslationHelpsCard.js | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js index 6bfad3fa5..303ca2020 100644 --- a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js +++ b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js @@ -4,6 +4,7 @@ import { useContent, } from 'translation-helps-rcl'; import localForage from 'localforage'; +import LoadingScreen from '@/components/Loading/LoadingScreen'; import ReferenceCard from './ReferenceCard'; import * as logger from '../../../logger'; import packageInfo from '../../../../../package.json'; @@ -177,7 +178,7 @@ export default function TranslationHelpsCard({ setOfflineItemsDisable(true); setOfflineMarkdown(filecontent); } else { - setOfflineMarkdown(''); + setOfflineMarkdown({ error: true, data: 'No Content Avaialble' }); } } }); @@ -191,6 +192,8 @@ export default function TranslationHelpsCard({ const filecontent = fs.readFileSync(path.join(folder, projectName, projectId, filePath), 'utf8'); setOfflineItemsDisable(true); setOfflineMarkdown(filecontent); + } else { + setOfflineMarkdown({ error: true, data: 'No Content Available' }); } break; @@ -201,6 +204,8 @@ export default function TranslationHelpsCard({ const filecontent = fs.readFileSync(path.join(folder, projectName, 'bible', filePath), 'utf8'); setOfflineItemsDisable(true); setOfflineMarkdown(filecontent); + } else { + setOfflineMarkdown({ error: true, data: 'No Content Available' }); } break; @@ -221,20 +226,23 @@ export default function TranslationHelpsCard({ markdown = offlineResource?.offline ? offlineMarkdown : markdown; return ( - + (markdown || items) ? ( + + ) : + ); }