|
@@ -1,5 +1,6 @@
|
|
|
-import Link from "next/link";
|
|
|
|
|
|
|
+import clsx from "clsx";
|
|
|
import moment from "moment";
|
|
import moment from "moment";
|
|
|
|
|
+import Link from "next/link";
|
|
|
import { useMemo } from "react";
|
|
import { useMemo } from "react";
|
|
|
import { useRouter } from "next/router";
|
|
import { useRouter } from "next/router";
|
|
|
import Tab from "@mui/base/TabUnstyled";
|
|
import Tab from "@mui/base/TabUnstyled";
|
|
@@ -37,9 +38,9 @@ function mergeHistory(
|
|
|
img: detail.img,
|
|
img: detail.img,
|
|
|
name: detail.name,
|
|
name: detail.name,
|
|
|
status: detail.status,
|
|
status: detail.status,
|
|
|
- chapterUri: history?.chapterUri ?? chapters[0].uri,
|
|
|
|
|
- chapterName: history?.chapterName ?? chapters[0].name,
|
|
|
|
|
- chapterCount: history?.chapterCount ?? chapters.length,
|
|
|
|
|
|
|
+ chapterUri: chapters[0].uri,
|
|
|
|
|
+ chapterName: chapters[0].name,
|
|
|
|
|
+ chapterCount: chapters.length,
|
|
|
chapterIndex: history?.chapterIndex ?? 1,
|
|
chapterIndex: history?.chapterIndex ?? 1,
|
|
|
isReading: history?.isReading ?? 0,
|
|
isReading: history?.isReading ?? 0,
|
|
|
isFavorite: 1,
|
|
isFavorite: 1,
|
|
@@ -250,23 +251,8 @@ const Novel: NextPage<NovelPageProps> = (props) => {
|
|
|
src={detail.img}
|
|
src={detail.img}
|
|
|
/>
|
|
/>
|
|
|
<div className={styles["nove-info-body"]}>
|
|
<div className={styles["nove-info-body"]}>
|
|
|
- <h1>
|
|
|
|
|
- {detail.name}
|
|
|
|
|
- {/* <small>{detail.status}</small> */}
|
|
|
|
|
- </h1>
|
|
|
|
|
|
|
+ <h1>{detail.name}</h1>
|
|
|
<h2>
|
|
<h2>
|
|
|
- {/* {detail.genres && detail.genres.length > 0 ? (
|
|
|
|
|
- <Link
|
|
|
|
|
- title={detail.genres[0].name}
|
|
|
|
|
- href={`/novels/${detail.genres[0].uri}`}
|
|
|
|
|
- >
|
|
|
|
|
- <svg>
|
|
|
|
|
- <title>Genre: </title>
|
|
|
|
|
- <use xlinkHref="/icons.svg#paper"></use>
|
|
|
|
|
- </svg>
|
|
|
|
|
- <span>{detail.genres[0].name}</span>
|
|
|
|
|
- </Link>
|
|
|
|
|
- ) : null} */}
|
|
|
|
|
<strong>
|
|
<strong>
|
|
|
<svg>
|
|
<svg>
|
|
|
<title>Chapters: </title>
|
|
<title>Chapters: </title>
|
|
@@ -297,20 +283,39 @@ const Novel: NextPage<NovelPageProps> = (props) => {
|
|
|
</h2>
|
|
</h2>
|
|
|
<div className={styles["btns"]}>
|
|
<div className={styles["btns"]}>
|
|
|
<Link
|
|
<Link
|
|
|
- href={`/novel/${chapters.chapters[0].uri}`}
|
|
|
|
|
- className={styles["button"]}
|
|
|
|
|
|
|
+ href={`/novel/${
|
|
|
|
|
+ history?.isReading
|
|
|
|
|
+ ? history?.chapterUri
|
|
|
|
|
+ : chapters.chapters[0].uri
|
|
|
|
|
+ }`}
|
|
|
|
|
+ className={clsx(styles["button"], styles["button-reading"])}
|
|
|
>
|
|
>
|
|
|
- <strong>Start Reading</strong>
|
|
|
|
|
- <span>{chapters.chapters[0].name}</span>
|
|
|
|
|
|
|
+ <strong>
|
|
|
|
|
+ {history?.isReading ? "Continue Reading" : "Start Reading"}
|
|
|
|
|
+ </strong>
|
|
|
|
|
+ {history?.isReading ? (
|
|
|
|
|
+ <small>{history.chapterName}</small>
|
|
|
|
|
+ ) : null}
|
|
|
</Link>
|
|
</Link>
|
|
|
<button
|
|
<button
|
|
|
className={styles["button"]}
|
|
className={styles["button"]}
|
|
|
onClick={handleTogleFavorite}
|
|
onClick={handleTogleFavorite}
|
|
|
>
|
|
>
|
|
|
<strong>
|
|
<strong>
|
|
|
- {history && history.isFavorite
|
|
|
|
|
- ? "In Library"
|
|
|
|
|
- : "Add to Library"}
|
|
|
|
|
|
|
+ <svg>
|
|
|
|
|
+ <use
|
|
|
|
|
+ xlinkHref={`/icons.svg#${
|
|
|
|
|
+ history && history.isFavorite
|
|
|
|
|
+ ? "favorite"
|
|
|
|
|
+ : "unfavorite"
|
|
|
|
|
+ }`}
|
|
|
|
|
+ ></use>
|
|
|
|
|
+ </svg>
|
|
|
|
|
+ <span>
|
|
|
|
|
+ {history && history.isFavorite
|
|
|
|
|
+ ? "In Library"
|
|
|
|
|
+ : "Add to Library"}
|
|
|
|
|
+ </span>
|
|
|
</strong>
|
|
</strong>
|
|
|
</button>
|
|
</button>
|
|
|
</div>
|
|
</div>
|
|
@@ -318,8 +323,11 @@ const Novel: NextPage<NovelPageProps> = (props) => {
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <Tabs defaultValue={0} className="container bg-paper py-3">
|
|
|
|
|
- <TabsList className="tabs">
|
|
|
|
|
|
|
+ <Tabs
|
|
|
|
|
+ defaultValue={0}
|
|
|
|
|
+ className={clsx(styles["novel-page"], "bg-paper", "py-3")}
|
|
|
|
|
+ >
|
|
|
|
|
+ <TabsList className={clsx("tabs", styles["novel-tabs"])}>
|
|
|
<Tab value={0} className="tab">
|
|
<Tab value={0} className="tab">
|
|
|
About
|
|
About
|
|
|
</Tab>
|
|
</Tab>
|
|
@@ -351,7 +359,7 @@ const Novel: NextPage<NovelPageProps> = (props) => {
|
|
|
<TabPanel value={1}>
|
|
<TabPanel value={1}>
|
|
|
<h3 className="sub-title">{detail.name} Chapters</h3>
|
|
<h3 className="sub-title">{detail.name} Chapters</h3>
|
|
|
<Tabs defaultValue={0}>
|
|
<Tabs defaultValue={0}>
|
|
|
- <TabsList className="tabs">
|
|
|
|
|
|
|
+ <TabsList className={clsx("tabs", styles["novel-tabs"], styles["chapter-tabs"])}>
|
|
|
{chapterLists.map((chapter, idx) => (
|
|
{chapterLists.map((chapter, idx) => (
|
|
|
<Tab value={idx} className="tab" key={chapter.title}>
|
|
<Tab value={idx} className="tab" key={chapter.title}>
|
|
|
{chapter.title}
|
|
{chapter.title}
|