OhMyDitzzy commited on
Commit
a852a48
·
1 Parent(s): a2befa6
Files changed (1) hide show
  1. src/modules/comic/ComicReader.tsx +6 -6
src/modules/comic/ComicReader.tsx CHANGED
@@ -35,7 +35,7 @@ export function ComicReader() {
35
  const [showControls, setShowControls] = useState(true);
36
  const [showPageJump, setShowPageJump] = useState(false);
37
  const [jumpPage, setJumpPage] = useState('');
38
- const [ws, setWs] = useState<WebSocket | null>(null);
39
 
40
  const imageRefs = useRef<{ [key: number]: HTMLImageElement | null }>({});
41
  const controlsTimeout = useRef<number | null>(null);
@@ -139,7 +139,7 @@ export function ComicReader() {
139
  if (currentPage < data.totalImages) {
140
  setCurrentPage(currentPage + 1);
141
  } else if (data.nextChapter) {
142
- handleChapterNavigation(data.nextChapter.slug);
143
  }
144
  };
145
 
@@ -147,11 +147,11 @@ export function ComicReader() {
147
  if (currentPage > 1) {
148
  setCurrentPage(currentPage - 1);
149
  } else if (data?.prevChapter) {
150
- handleChapterNavigation(data.prevChapter.slug);
151
  }
152
  };
153
 
154
- const handleChapterNavigation = (chapterSlug: string) => {
155
  // Go back to comic landing and let it handle chapter loading
156
  navigate(-1);
157
 
@@ -334,7 +334,7 @@ export function ComicReader() {
334
  {data.prevChapter && (
335
  <button
336
  className="chapter-nav-btn"
337
- onClick={() => handleChapterNavigation(data.prevChapter!.slug)}
338
  >
339
  ← {data.prevChapter.chapter}
340
  </button>
@@ -353,7 +353,7 @@ export function ComicReader() {
353
  {data.nextChapter && (
354
  <button
355
  className="chapter-nav-btn"
356
- onClick={() => handleChapterNavigation(data.nextChapter!.slug)}
357
  >
358
  {data.nextChapter.chapter} →
359
  </button>
 
35
  const [showControls, setShowControls] = useState(true);
36
  const [showPageJump, setShowPageJump] = useState(false);
37
  const [jumpPage, setJumpPage] = useState('');
38
+ const [_, setWs] = useState<WebSocket | null>(null);
39
 
40
  const imageRefs = useRef<{ [key: number]: HTMLImageElement | null }>({});
41
  const controlsTimeout = useRef<number | null>(null);
 
139
  if (currentPage < data.totalImages) {
140
  setCurrentPage(currentPage + 1);
141
  } else if (data.nextChapter) {
142
+ handleChapterNavigation();
143
  }
144
  };
145
 
 
147
  if (currentPage > 1) {
148
  setCurrentPage(currentPage - 1);
149
  } else if (data?.prevChapter) {
150
+ handleChapterNavigation();
151
  }
152
  };
153
 
154
+ const handleChapterNavigation = () => {
155
  // Go back to comic landing and let it handle chapter loading
156
  navigate(-1);
157
 
 
334
  {data.prevChapter && (
335
  <button
336
  className="chapter-nav-btn"
337
+ onClick={() => handleChapterNavigation()}
338
  >
339
  ← {data.prevChapter.chapter}
340
  </button>
 
353
  {data.nextChapter && (
354
  <button
355
  className="chapter-nav-btn"
356
+ onClick={() => handleChapterNavigation()}
357
  >
358
  {data.nextChapter.chapter} →
359
  </button>