Fixing nextjs linting shenanigans, fixed datetime, remove random Ad.patreon remove logs

This commit is contained in:
Hieuhuy Pham 2025-01-12 05:33:43 -05:00
parent 49c5f87610
commit 522bf5ab56
7 changed files with 12 additions and 15 deletions

View File

@ -1,8 +1,7 @@
import { fetchBookById, fetchBookChapterLinks } from "@/lib/api"; import { fetchBookById } from "@/lib/api";
import { Book } from "@/lib/types"; import { Book } from "@/lib/types";
import { formatDateToMonthDayYear } from "@/lib/utils"; import { formatDateToMonthDayYear } from "@/lib/utils";
import ChapterDropdown from "@/components/ChapterDropdown"; import ChapterDropdown from "@/components/ChapterDropdown";
import Image from "next/image";
export type paramsType = Promise<{ bookId: string}>; export type paramsType = Promise<{ bookId: string}>;
@ -32,8 +31,7 @@ export default async function BookPage(props: { params: paramsType }) {
alt={cover_media?.alternativeText || `Cover of ${book.title}`} alt={cover_media?.alternativeText || `Cover of ${book.title}`}
className="rounded-lg object-cover w-64 h-96" className="rounded-lg object-cover w-64 h-96"
/> />
<div className="flex items-center justify-between mb-4 pt-4"> <h1 className="text-5xl pb-2 font-bold">{title}</h1>
<h1 className="text-5xl font-bold">{title}</h1>
<a <a
href="https://www.patreon.com/c/nulltranslationgroup/membership?view_as=patron" // Replace with your Patreon URL href="https://www.patreon.com/c/nulltranslationgroup/membership?view_as=patron" // Replace with your Patreon URL
target="_blank" target="_blank"
@ -42,7 +40,6 @@ export default async function BookPage(props: { params: paramsType }) {
> >
Join Our Patreon for Unreleased Chapters Join Our Patreon for Unreleased Chapters
</a> </a>
</div>
</div> </div>
<p className="text-lg text-gray-600 dark:text-gray-400 mb-4"> <p className="text-lg text-gray-600 dark:text-gray-400 mb-4">
@ -64,7 +61,7 @@ export default async function BookPage(props: { params: paramsType }) {
Chapter {chapter.number}: {chapter.title} Chapter {chapter.number}: {chapter.title}
</h3> </h3>
<p className="text-sm text-gray-500 dark:text-gray-400 mt-2"> <p className="text-sm text-gray-500 dark:text-gray-400 mt-2">
<strong>Release Date:</strong> {formatDateToMonthDayYear(new Date(chapter.release_date))} <strong>Release Date:</strong> {formatDateToMonthDayYear(new Date(chapter.release_datetime))}
</p> </p>
</a> </a>
</li> </li>
@ -84,7 +81,7 @@ export default async function BookPage(props: { params: paramsType }) {
Chapter {chapter.number}: {chapter.title} Chapter {chapter.number}: {chapter.title}
</h3> </h3>
<p className="text-sm text-gray-500 dark:text-gray-400 mt-2"> <p className="text-sm text-gray-500 dark:text-gray-400 mt-2">
<strong>Release Date:</strong> {formatDateToMonthDayYear(new Date(chapter.release_date))} <strong>Release Date:</strong> {formatDateToMonthDayYear(new Date(chapter.release_datetime))}
</p> </p>
</a> </a>
</li> </li>

View File

@ -1,6 +1,5 @@
import { Book } from "@/lib/types"; import { Book } from "@/lib/types";
import { fetchBooks } from "@/lib/api"; import { fetchBooks } from "@/lib/api";
import Image from "next/image";
export default async function HomePage() { export default async function HomePage() {
let books: Book[] = []; let books: Book[] = [];

View File

@ -27,7 +27,7 @@ export default function Navbar() {
<Link href="/" className="hover:text-gray-400"> <Link href="/" className="hover:text-gray-400">
Book List Book List
</Link> </Link>
<Link href="https://patreon.com/NullTranslationGroup" className="hover:text-gray-400"> <Link href={Ad.patreon} className="hover:text-gray-400">
Patreon Patreon
</Link> </Link>
</nav> </nav>
@ -60,7 +60,7 @@ export default function Navbar() {
<Link href="/" className="block py-2 hover:text-gray-400"> <Link href="/" className="block py-2 hover:text-gray-400">
Book List Book List
</Link> </Link>
<Link href="https://patreon/NullTranslationGroup" className="block py-2 hover:text-gray-400"> <Link href={Ad.patreon} className="block py-2 hover:text-gray-400">
Patreon Patreon
</Link> </Link>
</div> </div>

View File

@ -11,12 +11,11 @@ interface NavigationButtonsProps {
nextChapter: string; nextChapter: string;
} }
const NavigationButtons: React.FC<NavigationButtonsProps> = ({ bookId, documentId, prevChapter, nextChapter }) => { const NavigationButtons: React.FC<NavigationButtonsProps> = ({ bookId, prevChapter, nextChapter }) => {
const router = useRouter(); const router = useRouter();
const navigateToChapter = (destinationId: string) => { const navigateToChapter = (destinationId: string) => {
router.push(`/books/${bookId}/chapters/${destinationId}`); router.push(`/books/${bookId}/chapters/${destinationId}`);
}; };
Ad.patreon
const navigateToAllChapters = () => { const navigateToAllChapters = () => {
router.push(`/books/${bookId}`); router.push(`/books/${bookId}`);

View File

@ -32,7 +32,6 @@ export async function fetchFromAPI<T>(
throw new Error(errorData.message || `API fetch error (status: ${response.status})`); throw new Error(errorData.message || `API fetch error (status: ${response.status})`);
} }
const responseJson = await response.json(); const responseJson = await response.json();
console.log(responseJson)
return responseJson; return responseJson;
} catch (error) { } catch (error) {
console.error("Fetch error:", error); console.error("Fetch error:", error);

View File

@ -5,7 +5,7 @@ export interface Chapter {
number: number; number: number;
title: string; title: string;
editor?: Editor; editor?: Editor;
release_date: string; release_datetime: string;
content: string; content: string;
book?: Book; book?: Book;
} }
@ -58,7 +58,7 @@ export interface Book {
raw_author: string; raw_author: string;
cover: Media[] | null; cover: Media[] | null;
description: string; description: string;
release_date: string; release_datetime: string;
chapters: Chapter[]; chapters: Chapter[];
glossary: Glossary; glossary: Glossary;
} }

View File

@ -3,5 +3,8 @@ export function formatDateToMonthDayYear(date: Date): string {
month: "long", month: "long",
day: "numeric", day: "numeric",
year: "numeric", year: "numeric",
hour: "numeric",
minute: "numeric",
timeZoneName: "short",
}); });
} }