OhMyDitzzy commited on
Commit ·
164f198
1
Parent(s): 407ba4e
anything
Browse files
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
|
| 180 |
-
if (
|
| 181 |
-
|
| 182 |
-
scrollToPage(currentPage + 1);
|
| 183 |
}
|
| 184 |
};
|
| 185 |
|
| 186 |
-
const
|
| 187 |
-
if (
|
| 188 |
-
|
| 189 |
}
|
| 190 |
};
|
| 191 |
|
|
@@ -360,8 +360,8 @@ export function ComicReader() {
|
|
| 360 |
<div className="page-controls">
|
| 361 |
<button
|
| 362 |
className="nav-control-btn"
|
| 363 |
-
onClick={
|
| 364 |
-
disabled={
|
| 365 |
>
|
| 366 |
← Prev
|
| 367 |
</button>
|
|
@@ -380,36 +380,12 @@ export function ComicReader() {
|
|
| 380 |
|
| 381 |
<button
|
| 382 |
className="nav-control-btn"
|
| 383 |
-
onClick={
|
| 384 |
-
disabled={
|
| 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 |
);
|