From fc75cec4ae85425bc37f1f0aba0a155c194219eb Mon Sep 17 00:00:00 2001 From: vipinpaul Date: Wed, 14 Aug 2024 12:57:20 +0530 Subject: [PATCH] Chapter range selection --- .../scope-management/ScopeManagement.jsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/renderer/src/components/ProjectManagement/scope-management/ScopeManagement.jsx b/renderer/src/components/ProjectManagement/scope-management/ScopeManagement.jsx index 9e3aca6e..0a4edd96 100644 --- a/renderer/src/components/ProjectManagement/scope-management/ScopeManagement.jsx +++ b/renderer/src/components/ProjectManagement/scope-management/ScopeManagement.jsx @@ -77,7 +77,13 @@ function ScopeManagement({ metadata }) { start = end; end = temp; } - console.log({ start, end }); + const numberArray = Array(end - start + 1).fill().map((_, idx) => start + idx); + const stringArray = numberArray.map(String); + setCurrentScope((prev) => { + // check and change the selectedChapters + setSelectedChaptersSet(new Set(stringArray)); + return ({ ...prev, [bookId.toUpperCase()]: stringArray }); + }); // e.target.start.value = ''; // e.target.end.value = ''; }; @@ -99,7 +105,6 @@ function ScopeManagement({ metadata }) { if (bukId in currentScope) { setCurrentScope((prev) => { const currentCh = new Set(prev[bukId] || new Set([])); - console.log(currentCh.size); if (currentCh.has(chapter)) { currentCh.delete(chapter); } else { @@ -199,18 +204,18 @@ function ScopeManagement({ metadata }) { name="start" min={1} required - max={149} + max={(chapterList && chapterList.length - 1) || 149} />