diff --git a/src/app/books/[bookId]/page.tsx b/src/app/books/[bookId]/page.tsx index c1be3d1..d9e7e89 100644 --- a/src/app/books/[bookId]/page.tsx +++ b/src/app/books/[bookId]/page.tsx @@ -1,10 +1,12 @@ import { fetchBookById } from "@/lib/api"; import { Book, Chapter } from "@/lib/types"; -import { formatDateToMonthDayYear, markdownToHtml } from "@/lib/utils"; +import { encodeId, formatDateToMonthDayYear, markdownToHtml } from "@/lib/utils"; import ChapterDropdown from "@/components/ChapterDropdown"; import { Ad } from "@/lib/types"; +import { Countdown } from "@/components/Countdown"; +import Link from "next/link"; -export type paramsType = Promise<{ bookId: string}>; +export type paramsType = Promise<{ bookId: string }>; export const metadata = { title: 'Null Translation Group', @@ -25,63 +27,45 @@ export default async function BookPage(props: { params: paramsType }) { ); } - const {title, author, description, chapters, cover, translator_note, glossary} = book; + const { title, author, description, chapters, cover, translator_note, glossary } = book; const english_glossary = glossary?.english_english; const translator_note_html = await markdownToHtml(translator_note); - const sorted_chapters:Chapter[] = chapters.sort((a, b) => a.number - b.number); - + const sorted_chapters: Chapter[] = chapters.sort((a, b) => a.number - b.number); + const current_chapters = sorted_chapters.filter(chapter => new Date(chapter.release_datetime) < new Date()); + const next_chapter = sorted_chapters.find((chapter) => new Date(chapter.release_datetime) > new Date()); + const next_chapters = sorted_chapters.filter(chapter => new Date(chapter.release_datetime) > new Date()) const cover_media = cover?.at(0); - const recentChapters = sorted_chapters.length > 6 ? sorted_chapters.slice(sorted_chapters.length - 6, sorted_chapters.length) : sorted_chapters; - + const recentChapters = sorted_chapters.length > 8 ? sorted_chapters.slice(sorted_chapters.length - 8, sorted_chapters.length - 2) : current_chapters; return ( -
- Author: {author}
-
- Translator: Null Translation Group
-
Description: {description}
- -- Release Date: {formatDateToMonthDayYear(new Date(chapter.release_datetime))} -
- -
+ Author: {author}
+
+ Translator: Null Translation Group
+
Description: {description}
+ ++ Release Date:{" "} + {formatDateToMonthDayYear(new Date(chapter.release_datetime))} +
+ + + {/* Overlay */} + +
+
+ Release Date:{" "} + {formatDateToMonthDayYear(new Date(chapter.release_datetime))} +
+ ++ Release Date:{" "} + {formatDateToMonthDayYear(new Date(chapter.release_datetime))} +
+ + + {/* Overlay */} + +
+
+ Get early access to chapters by completing Google Offerwall tasks. Read ahead by 1 chapter ! +
++ Tasks vary from watching an ad video to completing surveys and more. +
++ Want to read even further? Join our Patreon to unlock more chapters! +
+ + + Join Our Patreon – Read More Ahead! + ++ Click to Unlock Chapter +
+ +- Release date:{" "} - {formatDateToMonthDayYear( - new Date(chapter.release_datetime) - )} -
+