Skip to content

Commit

Permalink
loading added for helps resources (#287)
Browse files Browse the repository at this point in the history
* loading added for helps resources

* added fix for infinite loading

* lint fix
  • Loading branch information
sijumoncy authored Jan 5, 2024
1 parent 3048b88 commit 926534d
Showing 1 changed file with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -177,7 +178,7 @@ export default function TranslationHelpsCard({
setOfflineItemsDisable(true);
setOfflineMarkdown(filecontent);
} else {
setOfflineMarkdown('');
setOfflineMarkdown({ error: true, data: 'No Content Avaialble' });
}
}
});
Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -221,20 +226,23 @@ export default function TranslationHelpsCard({
markdown = offlineResource?.offline ? offlineMarkdown : markdown;

return (
<ReferenceCard
items={items}
filters={['OccurrenceNote']}
markdown={markdown}
isLoading={isLoading}
languageId={languageId}
title={title}
viewMode={viewMode}
selectedQuote={selectedQuote}
setQuote={setQuote}
font={font}
setResetTrigger={setResetTrigger}
resetTrigger={resetTrigger}
/>
(markdown || items) ? (
<ReferenceCard
items={items}
filters={['OccurrenceNote']}
markdown={markdown}
isLoading={isLoading}
languageId={languageId}
title={title}
viewMode={viewMode}
selectedQuote={selectedQuote}
setQuote={setQuote}
font={font}
setResetTrigger={setResetTrigger}
resetTrigger={resetTrigger}
/>
) : <LoadingScreen />

);
}

Expand Down

0 comments on commit 926534d

Please sign in to comment.