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 { formatDateToMonthDayYear } from "@/lib/utils";
import ChapterDropdown from "@/components/ChapterDropdown";
import Image from "next/image";
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}`}
className="rounded-lg object-cover w-64 h-96"
/>
<div className="flex items-center justify-between mb-4 pt-4">
<h1 className="text-5xl font-bold">{title}</h1>
<h1 className="text-5xl pb-2 font-bold">{title}</h1>
<a
href="https://www.patreon.com/c/nulltranslationgroup/membership?view_as=patron" // Replace with your Patreon URL
target="_blank"
@ -42,7 +40,6 @@ export default async function BookPage(props: { params: paramsType }) {
>
Join Our Patreon for Unreleased Chapters
</a>
</div>
</div>
<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}
</h3>
<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>
</a>
</li>
@ -84,7 +81,7 @@ export default async function BookPage(props: { params: paramsType }) {
Chapter {chapter.number}: {chapter.title}
</h3>
<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>
</a>
</li>

View File

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

View File

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

View File

@ -11,12 +11,11 @@ interface NavigationButtonsProps {
nextChapter: string;
}
const NavigationButtons: React.FC<NavigationButtonsProps> = ({ bookId, documentId, prevChapter, nextChapter }) => {
const NavigationButtons: React.FC<NavigationButtonsProps> = ({ bookId, prevChapter, nextChapter }) => {
const router = useRouter();
const navigateToChapter = (destinationId: string) => {
router.push(`/books/${bookId}/chapters/${destinationId}`);
};
Ad.patreon
const navigateToAllChapters = () => {
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})`);
}
const responseJson = await response.json();
console.log(responseJson)
return responseJson;
} catch (error) {
console.error("Fetch error:", error);

View File

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

View File

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