Skip to content

Commit

Permalink
Chapter range selection
Browse files Browse the repository at this point in the history
  • Loading branch information
vipinpaul committed Aug 14, 2024
1 parent cc84dbb commit fc75cec
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
};
Expand All @@ -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 {
Expand Down Expand Up @@ -199,18 +204,18 @@ function ScopeManagement({ metadata }) {
name="start"
min={1}
required
max={149}
max={(chapterList && chapterList.length - 1) || 149}
/>
</div>
<div className="flex gap-1 items-center">
<label>End :</label>
<input
type="text"
type="number"
className="w-12 h-full px-1 text-xs border-gray-400 outline-none rounded-[4px]"
name="end"
min={1}
required
max={150}
max={chapterList?.length || 150}
/>
</div>

Expand Down

0 comments on commit fc75cec

Please sign in to comment.