-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
744 additions
and
755 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,5 +11,6 @@ | |
"**/.vscode": true, | ||
"**/logs": true, | ||
"**/node_modules": false | ||
} | ||
}, | ||
"editor.defaultFormatter": "biomejs.biome" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json", | ||
"organizeImports": { | ||
"enabled": true | ||
}, | ||
"linter": { | ||
"enabled": true, | ||
"rules": { | ||
"recommended": true, | ||
"style": { | ||
"useImportType": { | ||
"level": "warn", | ||
"fix": "none" | ||
} | ||
}, | ||
"complexity": { | ||
"noUselessTypeConstraint": { | ||
"level": "warn", | ||
"fix": "none" | ||
} | ||
} | ||
} | ||
}, | ||
"javascript": { | ||
"formatter": { | ||
"quoteStyle": "single", | ||
"semicolons": "asNeeded", | ||
"trailingCommas": "es5", | ||
"arrowParentheses": "asNeeded", | ||
"bracketSpacing": true, | ||
"jsxQuoteStyle": "single", | ||
"quoteProperties": "asNeeded", | ||
"lineWidth": 120, | ||
"indentWidth": 2 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,38 @@ | ||
{ | ||
"name": "n-anime-app", | ||
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "next dev --turbo", | ||
"tscheck": "tsc --noEmit", | ||
"build": "next build", | ||
"start": "next start", | ||
"lint": "next lint", | ||
"format:fix": "prettier --write --ignore-path .gitignore .", | ||
"preview": "next build && next start" | ||
}, | ||
"dependencies": { | ||
"@algolia/autocomplete-core": "1.17.0", | ||
"clsx": "2.1.1", | ||
"next": "^14.2.2", | ||
"next-view-transitions": "^0.1.1", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"react-hotkeys-hook": "4.5.0", | ||
"sharp": "^0.33.1" | ||
}, | ||
"devDependencies": { | ||
"@locator/babel-jsx": "^0.4.3", | ||
"@types/node": "20.12.7", | ||
"@types/react": "18.2.79", | ||
"@types/react-dom": "18.2.25", | ||
"eslint": "8.57.0", | ||
"eslint-config-next": "^14.1.4", | ||
"eslint-config-prettier": "^9.1.0", | ||
"prettier": "^3.2.5", | ||
"prettier-plugin-css-order": "^2.1.2", | ||
"typescript": "5.4.5" | ||
} | ||
} | ||
"name": "n-anime-app", | ||
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "next dev --turbo", | ||
"tscheck": "tsc --noEmit", | ||
"build": "next build", | ||
"start": "next start", | ||
"lint": "next lint", | ||
"format:fix": "prettier --write --ignore-path .gitignore .", | ||
"preview": "next build && next start" | ||
}, | ||
"dependencies": { | ||
"@algolia/autocomplete-core": "1.17.4", | ||
"clsx": "2.1.1", | ||
"cmdk": "^1.0.0", | ||
"next": "^15.0.0-rc.0", | ||
"next-view-transitions": "^0.3.0", | ||
"react": "^19.0.0-rc-378b305958-20240710", | ||
"react-dom": "^19.0.0-rc-378b305958-20240710", | ||
"react-hotkeys-hook": "4.5.0", | ||
"sharp": "0.33.1" | ||
}, | ||
"devDependencies": { | ||
"@biomejs/biome": "1.8.3", | ||
"@locator/babel-jsx": "^0.4.3", | ||
"@types/node": "22.1.0", | ||
"@types/react": "18.3.3", | ||
"@types/react-dom": "18.3.0", | ||
"eslint": "8.57.0", | ||
"eslint-config-next": "^14.2.5", | ||
"eslint-config-prettier": "^9.1.0", | ||
"prettier": "^3.3.3", | ||
"prettier-plugin-css-order": "^2.1.2", | ||
"typescript": "5.5.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
import { AnimeCarousel } from '@/components/AnimePage/AnimeCarousel' | ||
import { AnimeMain } from '@/components/AnimePage/AnimeMain' | ||
import { Metadata } from 'next' | ||
import { PageProps, generateMetadataFromAnimeId, generatePageStaticParams } from './pageMisc' | ||
import type { Metadata } from 'next' | ||
import { generateMetadataFromAnimeId, generatePageStaticParams, type PageProps } from './pageMisc' | ||
|
||
export default async function AnimePage({ params, searchParams }: PageProps) { | ||
const { animeId } = params | ||
const { limit } = searchParams | ||
export default async function AnimePage({ params }: PageProps) { | ||
const { animeId } = params | ||
|
||
return ( | ||
<> | ||
<AnimeCarousel animeId={animeId} /> | ||
<AnimeMain animeId={animeId} limit={limit} /> | ||
</> | ||
) | ||
return ( | ||
<> | ||
<AnimeCarousel animeId={animeId} /> | ||
<AnimeMain animeId={animeId} /> | ||
</> | ||
) | ||
} | ||
|
||
export const generateMetadata = ({ params }: PageProps): Promise<Metadata> => | ||
generateMetadataFromAnimeId(params.animeId) | ||
generateMetadataFromAnimeId(params.animeId) | ||
export const generateStaticParams = generatePageStaticParams |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,39 @@ | ||
import { getAnime } from '@/services/getAnime' | ||
import { getBroadcastAnimes } from '@/services/getBroadcastAnimes' | ||
import { getRatingAnimes } from '@/services/getRatingAnimes' | ||
import { Anime } from '@/types' | ||
import type { Anime } from '@/types' | ||
import { normalizeAnimeId } from '@/utils/normalizeAnimeId' | ||
import { Metadata } from 'next' | ||
import type { Metadata } from 'next' | ||
|
||
export interface PageProps { | ||
params: { animeId: string } | ||
searchParams: { limit: string } | ||
params: { animeId: string } | ||
} | ||
|
||
export async function generateMetadataFromAnimeId( | ||
animeId: PageProps['params']['animeId'] | ||
): Promise<Metadata> { | ||
const anime = await getAnime(animeId) | ||
if (!anime) return {} | ||
|
||
return { | ||
title: anime.title ?? normalizeAnimeId(animeId), | ||
description: anime.description, | ||
keywords: `${anime.genres.join(', ')} ${anime.title} ${anime.otherTitles.join(', ')}` | ||
} | ||
export async function generateMetadataFromAnimeId(animeId: PageProps['params']['animeId']): Promise<Metadata> { | ||
const anime = await getAnime(animeId) | ||
if (!anime) return {} | ||
|
||
return { | ||
title: anime.title ?? normalizeAnimeId(animeId), | ||
description: anime.description, | ||
keywords: `${anime.genres.join(', ')} ${anime.title} ${anime.otherTitles.join(', ')}`, | ||
} | ||
} | ||
|
||
export async function generatePageStaticParams(): Promise<{ animeId: string }[]> { | ||
const animesPromises = [getRatingAnimes(25), getBroadcastAnimes()] | ||
const animesPromises = [getRatingAnimes(25), getBroadcastAnimes()] | ||
|
||
const animesIdSettled = await Promise.allSettled( | ||
animesPromises.map(animePromise => | ||
animePromise.then(anime => anime.map(({ animeId }) => animeId)) | ||
) | ||
) | ||
const animesIdSettled = await Promise.allSettled( | ||
animesPromises.map(animePromise => animePromise.then(anime => anime.map(({ animeId }) => animeId))) | ||
) | ||
|
||
const filteredAnimesId = animesIdSettled.filter( | ||
(animesId): animesId is PromiseFulfilledResult<Anime['animeId'][]> => | ||
animesId.status === 'fulfilled' | ||
) | ||
const filteredAnimesId = animesIdSettled.filter( | ||
(animesId): animesId is PromiseFulfilledResult<Anime['animeId'][]> => animesId.status === 'fulfilled' | ||
) | ||
|
||
const mappedAnimesId = filteredAnimesId.flatMap(filteredAnimesId => | ||
filteredAnimesId.value.map(animeId => ({ animeId })) | ||
) | ||
const mappedAnimesId = filteredAnimesId.flatMap(filteredAnimesId => | ||
filteredAnimesId.value.map(animeId => ({ animeId })) | ||
) | ||
|
||
return mappedAnimesId | ||
return mappedAnimesId | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.