OhMyDitzzy commited on
Commit
164f198
·
1 Parent(s): 407ba4e
Files changed (1) hide show
  1. src/modules/comic/ComicReader.tsx +11 -35
src/modules/comic/ComicReader.tsx CHANGED
@@ -45,6 +45,7 @@ export function ComicReader() {
45
  const chapterData = location.state?.chapterData;
46
  const password = location.state?.password;
47
  const originalSessionId = location.state?.sessionId;
 
48
  useEffect(() => {
49
  if (!password || !originalSessionId) return;
50
 
@@ -176,16 +177,15 @@ export function ComicReader() {
176
  }
177
  };
178
 
179
- const nextPage = () => {
180
- if (!data) return;
181
- if (currentPage < data.totalImages) {
182
- scrollToPage(currentPage + 1);
183
  }
184
  };
185
 
186
- const prevPage = () => {
187
- if (currentPage > 1) {
188
- scrollToPage(currentPage - 1);
189
  }
190
  };
191
 
@@ -360,8 +360,8 @@ export function ComicReader() {
360
  <div className="page-controls">
361
  <button
362
  className="nav-control-btn"
363
- onClick={prevPage}
364
- disabled={currentPage === 1}
365
  >
366
  ← Prev
367
  </button>
@@ -380,36 +380,12 @@ export function ComicReader() {
380
 
381
  <button
382
  className="nav-control-btn"
383
- onClick={nextPage}
384
- disabled={currentPage === data.totalImages}
385
  >
386
  Next →
387
  </button>
388
  </div>
389
-
390
- {(data.prevChapter || data.nextChapter) && (
391
- <div className="chapter-navigation">
392
- {data.prevChapter && (
393
- <button
394
- className="chapter-nav-btn prev"
395
- onClick={() => handleChapterNavigation(data.prevChapter!.slug)}
396
- >
397
- ← {data.prevChapter.chapter}
398
- </button>
399
- )}
400
-
401
- <div className="chapter-spacer"></div>
402
-
403
- {data.nextChapter && (
404
- <button
405
- className="chapter-nav-btn next"
406
- onClick={() => handleChapterNavigation(data.nextChapter!.slug)}
407
- >
408
- {data.nextChapter.chapter} →
409
- </button>
410
- )}
411
- </div>
412
- )}
413
  </div>
414
  </div>
415
  );
 
45
  const chapterData = location.state?.chapterData;
46
  const password = location.state?.password;
47
  const originalSessionId = location.state?.sessionId;
48
+
49
  useEffect(() => {
50
  if (!password || !originalSessionId) return;
51
 
 
177
  }
178
  };
179
 
180
+ const nextChapter = () => {
181
+ if (data?.nextChapter) {
182
+ handleChapterNavigation(data.nextChapter.slug);
 
183
  }
184
  };
185
 
186
+ const prevChapter = () => {
187
+ if (data?.prevChapter) {
188
+ handleChapterNavigation(data.prevChapter.slug);
189
  }
190
  };
191
 
 
360
  <div className="page-controls">
361
  <button
362
  className="nav-control-btn"
363
+ onClick={prevChapter}
364
+ disabled={!data.prevChapter}
365
  >
366
  ← Prev
367
  </button>
 
380
 
381
  <button
382
  className="nav-control-btn"
383
+ onClick={nextChapter}
384
+ disabled={!data.nextChapter}
385
  >
386
  Next →
387
  </button>
388
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
389
  </div>
390
  </div>
391
  );