From 03ee33618ec1efab5eb4f31535d4f886af0af8ee Mon Sep 17 00:00:00 2001 From: vipinpaul Date: Fri, 12 Jan 2024 16:52:22 +0530 Subject: [PATCH] Added book and chapter overview for tN --- .../EditorPage/Reference/TabSelector.js | 2 +- .../Reference/TranslationHelpsCard.js | 33 ++++++++++++------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/renderer/src/components/EditorPage/Reference/TabSelector.js b/renderer/src/components/EditorPage/Reference/TabSelector.js index 027dc0565..a99e27b32 100644 --- a/renderer/src/components/EditorPage/Reference/TabSelector.js +++ b/renderer/src/components/EditorPage/Reference/TabSelector.js @@ -9,7 +9,7 @@ function classNames(...classes) { function TabSelector({ currentTab, setCurrentTab, tabData }) { return (
- + {tabData.map((data) => ( { if (currentTnTab === 1) { setCurrentChapterVerse({ chapter, verse: 'intro' }); - } else if (currentTnTab === 2) { + } else if (currentTnTab === 0) { setCurrentChapterVerse({ verse: 'intro', chapter: 'front' }); } else { setCurrentChapterVerse({ verse, chapter }); @@ -124,7 +124,7 @@ export default function TranslationHelpsCard({ return { Book, Chapter, Verse, ID, [noteName]: file.split('\t')[indexOfNote], }; - }).filter((data) => data.Chapter === chapter && data.Verse === verse); + }).filter((data) => data.Chapter === currentChapterVerse.chapter && data.Verse === currentChapterVerse.verse); setOfflineItemsDisable(false); setOfflineItems(json); } @@ -246,13 +246,21 @@ export default function TranslationHelpsCard({ items = !offlineItemsDisable && offlineResource?.offline ? offlineItems : items; markdown = offlineResource?.offline ? offlineMarkdown : markdown; - console.log({ currentTnTab }); + if (resourceId === 'tn' && items) { + if (items[0]?.Note) { + items[0].Note = (items[0].Note).replace(/(
|\\n)/gm, '\n'); + } + if (items[0]?.OccurrenceNote) { + items[0].OccurrenceNote = (items[0].OccurrenceNote).replace(/(
|\\n)/gm, '\n'); + } + } return ( - (markdown || items) ? ( - <> - {resourceId === 'tn' && ()} + <> + {resourceId === 'tn' && ()} + {(markdown || items) ? ( - - ) : + ) + : } + ); }