+
diff --git a/src/app/page.tsx b/src/app/page.tsx
index 7953dff..f17d659 100644
--- a/src/app/page.tsx
+++ b/src/app/page.tsx
@@ -1,6 +1,6 @@
import { Book } from "@/lib/types";
import { fetchBooks } from "@/lib/api";
-
+import Image from "next/image";
export default async function HomePage() {
let books: Book[] = [];
@@ -17,7 +17,6 @@ export default async function HomePage() {
return (
- {/* Patreon Advertisement */}
- {/* Books Grid */}
- {books.map((book: Book) => (
+ {books.map((book: Book) => {
+ const cover = book.cover?.at(0);
+ return (
- {book.Cover?.url && (
+ {book.cover?.at(0)?.url && (
)}
-
{book.Name}
+
{book.title}
- Author: {book.Author}
+ Author: {book.author}
-
{book.Description}
+
{book.description}
- ))}
+ )})}
);
diff --git a/src/components/ChapterDropdown.tsx b/src/components/ChapterDropdown.tsx
index d4ad739..c1245ea 100644
--- a/src/components/ChapterDropdown.tsx
+++ b/src/components/ChapterDropdown.tsx
@@ -4,7 +4,7 @@ export default function ChapterDropdown({
chapters,
bookId,
}: {
- chapters: { id: number; documentId: string; Chapter_Number: number; Name: string }[];
+ chapters: { id: number; documentId: string; number: number; title: string }[];
bookId: string;
}) {
@@ -24,7 +24,7 @@ export default function ChapterDropdown({
{chapters.map((chapter) => (
))}
diff --git a/src/components/NavigationBar.tsx b/src/components/NavigationBar.tsx
index e532325..a7a9af0 100644
--- a/src/components/NavigationBar.tsx
+++ b/src/components/NavigationBar.tsx
@@ -2,6 +2,7 @@
import React, { useState } from "react";
import Image from "next/image";
import Link from "next/link";
+import { Ad } from "@/lib/types";
export default function Navbar() {
const [isMenuOpen, setIsMenuOpen] = useState(false);
@@ -11,6 +12,8 @@ export default function Navbar() {
diff --git a/src/components/NavigationButtons.tsx b/src/components/NavigationButtons.tsx
index f7c649a..5058a9c 100644
--- a/src/components/NavigationButtons.tsx
+++ b/src/components/NavigationButtons.tsx
@@ -2,7 +2,7 @@
import React from "react";
import { useRouter } from "next/navigation";
-
+import { Ad } from "@/lib/types";
interface NavigationButtonsProps {
bookId: string;
@@ -13,10 +13,10 @@ interface NavigationButtonsProps {
const NavigationButtons: React.FC
= ({ bookId, documentId, prevChapter, nextChapter }) => {
const router = useRouter();
- console.log(documentId)
const navigateToChapter = (destinationId: string) => {
router.push(`/books/${bookId}/chapters/${destinationId}`);
};
+ Ad.patreon
const navigateToAllChapters = () => {
router.push(`/books/${bookId}`);
@@ -24,14 +24,14 @@ const NavigationButtons: React.FC = ({ bookId, documentI
return (
-
+
-
+ {nextChapter !== "" ? (
+
+ ) : (
+
+ Unreleased Chapters
+
+ )
+ }
);
};
diff --git a/src/lib/api.tsx b/src/lib/api.tsx
index d905f4d..de7640b 100644
--- a/src/lib/api.tsx
+++ b/src/lib/api.tsx
@@ -50,8 +50,8 @@ export async function fetchBooks(): Promise
{
}
export async function fetchBookChapterLinks(bookId: string): Promise {
- const currentDate = new Date().toISOString().split("T")[0];
- const data = await fetchFromAPI<{ data: Book }>(`/api/books/${bookId}?populate[chapters][filters][ReleaseDate][$lte]=${currentDate}`);
+ const currentDateTime = new Date().toISOString();
+ const data = await fetchFromAPI<{ data: Book }>(`/api/books/${bookId}?populate[chapters][filters][release_datetime][$lte]=${currentDateTime}`);
return data.data
}
@@ -60,9 +60,9 @@ export async function fetchBookChapterLinks(bookId: string): Promise {
* Filters chapters by release date to include only valid ones.
*/
export async function fetchBookById(bookId: string): Promise {
- const currentDate = new Date().toISOString().split("T")[0];
+ const currentDateTime = new Date().toISOString();
const data = await fetchFromAPI<{ data: Book }>(
- `/api/books/${bookId}?populate[chapters][filters][ReleaseDate][$lte]=${currentDate}`
+ `/api/books/${bookId}?populate[chapters][filters][release_datetime][$lte]=${currentDateTime}&populate=cover`
);
return data.data;
}
diff --git a/src/lib/types.tsx b/src/lib/types.tsx
index 6b000d0..91c9246 100644
--- a/src/lib/types.tsx
+++ b/src/lib/types.tsx
@@ -2,10 +2,11 @@
export interface Chapter {
id: number;
documentId: string;
- Name: string;
- Chapter_Number: number;
- ReleaseDate: string;
- Content: string;
+ number: number;
+ title: string;
+ editor?: Editor;
+ release_date: string;
+ content: string;
book?: Book;
}
@@ -13,13 +14,14 @@ export interface Editor {
id: number;
name: string;
email: string;
- books: Book[];
+ discord: string;
+ chapters: Chapter[];
}
export interface Glossary {
id: number;
- name: string;
- entries: string[];
+ chinese_english: JSON;
+ english_english: JSON;
}
export interface Media {
@@ -50,16 +52,18 @@ export interface Media {
export interface Book {
id: number;
documentId: string;
- Name: string;
- ReleaseDate: string;
+ title: string;
+ raw_title: string;
+ author: string;
+ raw_author: string;
+ cover: Media[] | null;
+ description: string;
+ release_date: string;
chapters: Chapter[];
- Cover: Media | null;
- Author: string;
- Complete: boolean;
- editors: Editor[];
- RawName: string;
- RawAuthor: string;
glossary: Glossary;
- Description: string;
}
+
+export const Ad = {
+ patreon: "https://patreon.com/nulltranslationgroup",
+}
\ No newline at end of file