diff --git a/app/(pages)/(content)/anime/[slug]/layout.queries.ts b/app/(pages)/(content)/anime/[slug]/layout.queries.ts index 8e2c930f..80f0ccd2 100644 --- a/app/(pages)/(content)/anime/[slug]/layout.queries.ts +++ b/app/(pages)/(content)/anime/[slug]/layout.queries.ts @@ -1,7 +1,7 @@ import { prefetchCharacters } from '@/services/hooks/anime/use-characters'; -import { prefetchFranchise } from '@/services/hooks/anime/use-franchise'; import { prefetchStaff } from '@/services/hooks/anime/use-staff'; import { prefetchFavorite } from '@/services/hooks/favorite/use-favorite'; +import { prefetchFranchise } from '@/services/hooks/related/use-franchise'; import { prefetchFollowingWatchList } from '@/services/hooks/watch/use-following-watch-list'; import { prefetchWatch } from '@/services/hooks/watch/use-watch'; import { getCookie } from '@/utils/cookies'; @@ -17,7 +17,7 @@ const prefetchQueries = async ({ params: { slug } }: Props) => { await Promise.all([ prefetchCharacters({ slug }), - prefetchFranchise({ slug }), + prefetchFranchise({ slug, content_type: 'anime' }), prefetchStaff({ slug }), auth ? prefetchWatch({ slug }) : undefined, auth ? prefetchFavorite({ slug, content_type: 'anime' }) : undefined, diff --git a/app/(pages)/(content)/characters/[slug]/(character-details)/manga/page.tsx b/app/(pages)/(content)/characters/[slug]/(character-details)/manga/page.tsx new file mode 100644 index 00000000..afafdd38 --- /dev/null +++ b/app/(pages)/(content)/characters/[slug]/(character-details)/manga/page.tsx @@ -0,0 +1,36 @@ +import { Metadata, ResolvingMetadata } from 'next'; + +import Manga from '@/features/characters/character-view/manga.component'; + +export async function generateMetadata( + { params }: { params: { slug: string } }, + parent: ResolvingMetadata, +): Promise { + const parentMetadata = await parent; + + return { + title: 'Аніме', + description: parentMetadata.openGraph?.description, + openGraph: { + siteName: parentMetadata.openGraph?.siteName, + description: parentMetadata.openGraph?.description, + images: parentMetadata.openGraph?.images, + title: 'Аніме', + }, + twitter: { + description: parentMetadata.openGraph?.description, + images: parentMetadata.twitter?.images, + title: 'Аніме', + }, + }; +} + +const CharacterMangaPage = async () => { + return ( +
+ +
+ ); +}; + +export default CharacterMangaPage; diff --git a/app/(pages)/(content)/characters/[slug]/(character-details)/novel/page.tsx b/app/(pages)/(content)/characters/[slug]/(character-details)/novel/page.tsx new file mode 100644 index 00000000..5b74e155 --- /dev/null +++ b/app/(pages)/(content)/characters/[slug]/(character-details)/novel/page.tsx @@ -0,0 +1,36 @@ +import { Metadata, ResolvingMetadata } from 'next'; + +import Novel from '@/features/characters/character-view/novel.component'; + +export async function generateMetadata( + { params }: { params: { slug: string } }, + parent: ResolvingMetadata, +): Promise { + const parentMetadata = await parent; + + return { + title: 'Ранобе', + description: parentMetadata.openGraph?.description, + openGraph: { + siteName: parentMetadata.openGraph?.siteName, + description: parentMetadata.openGraph?.description, + images: parentMetadata.openGraph?.images, + title: 'Ранобе', + }, + twitter: { + description: parentMetadata.openGraph?.description, + images: parentMetadata.twitter?.images, + title: 'Ранобе', + }, + }; +} + +const CharacterNovelPage = async () => { + return ( +
+ +
+ ); +}; + +export default CharacterNovelPage; diff --git a/app/(pages)/(content)/characters/[slug]/layout.queries.ts b/app/(pages)/(content)/characters/[slug]/layout.queries.ts index d6eaeaf8..26c3b061 100644 --- a/app/(pages)/(content)/characters/[slug]/layout.queries.ts +++ b/app/(pages)/(content)/characters/[slug]/layout.queries.ts @@ -1,4 +1,6 @@ import { prefetchCharacterAnime } from '@/services/hooks/characters/use-character-anime'; +import { prefetchCharacterManga } from '@/services/hooks/characters/use-character-manga'; +import { prefetchCharacterNovel } from '@/services/hooks/characters/use-character-novel'; import { prefetchCharacterVoices } from '@/services/hooks/characters/use-character-voices'; import { prefetchFavorite } from '@/services/hooks/favorite/use-favorite'; @@ -11,6 +13,8 @@ interface Props { const prefetchQueries = async ({ params: { slug } }: Props) => { await Promise.all([ prefetchCharacterAnime({ slug }), + prefetchCharacterManga({ slug }), + prefetchCharacterNovel({ slug }), prefetchCharacterVoices({ slug }), prefetchFavorite({ slug, content_type: 'character' }), ]); diff --git a/app/(pages)/(content)/manga/[slug]/layout.queries.ts b/app/(pages)/(content)/manga/[slug]/layout.queries.ts index c49b876e..5a51713f 100644 --- a/app/(pages)/(content)/manga/[slug]/layout.queries.ts +++ b/app/(pages)/(content)/manga/[slug]/layout.queries.ts @@ -1,5 +1,6 @@ import { prefetchFavorite } from '@/services/hooks/favorite/use-favorite'; import { prefetchMangaCharacters } from '@/services/hooks/manga/use-manga-characters'; +import { prefetchFranchise } from '@/services/hooks/related/use-franchise'; import { getCookie } from '@/utils/cookies'; interface Props { @@ -13,6 +14,7 @@ const prefetchQueries = async ({ params: { slug } }: Props) => { await Promise.all([ prefetchMangaCharacters({ slug }), + prefetchFranchise({ slug, content_type: 'manga' }), auth ? prefetchFavorite({ slug, content_type: 'manga' }) : undefined, ]); }; diff --git a/app/(pages)/(content)/novel/[slug]/layout.queries.ts b/app/(pages)/(content)/novel/[slug]/layout.queries.ts index 45c2c0a0..8d996ea1 100644 --- a/app/(pages)/(content)/novel/[slug]/layout.queries.ts +++ b/app/(pages)/(content)/novel/[slug]/layout.queries.ts @@ -1,5 +1,6 @@ import { prefetchFavorite } from '@/services/hooks/favorite/use-favorite'; import { prefetchNovelCharacters } from '@/services/hooks/novel/use-novel-characters'; +import { prefetchFranchise } from '@/services/hooks/related/use-franchise'; import { getCookie } from '@/utils/cookies'; interface Props { @@ -13,6 +14,7 @@ const prefetchQueries = async ({ params: { slug } }: Props) => { await Promise.all([ prefetchNovelCharacters({ slug }), + prefetchFranchise({ slug, content_type: 'novel' }), auth ? prefetchFavorite({ slug, content_type: 'novel' }) : undefined, ]); }; diff --git a/app/(pages)/(content)/people/[slug]/(person-details)/manga/page.tsx b/app/(pages)/(content)/people/[slug]/(person-details)/manga/page.tsx new file mode 100644 index 00000000..2343fe14 --- /dev/null +++ b/app/(pages)/(content)/people/[slug]/(person-details)/manga/page.tsx @@ -0,0 +1,36 @@ +import { Metadata, ResolvingMetadata } from 'next'; + +import Manga from '@/features/people/person-view/manga.component'; + +export async function generateMetadata( + { params }: { params: { slug: string } }, + parent: ResolvingMetadata, +): Promise { + const parentMetadata = await parent; + + return { + title: 'Манґа', + description: parentMetadata.openGraph?.description, + openGraph: { + siteName: parentMetadata.openGraph?.siteName, + description: parentMetadata.openGraph?.description, + images: parentMetadata.openGraph?.images, + title: 'Манґа', + }, + twitter: { + description: parentMetadata.openGraph?.description, + images: parentMetadata.twitter?.images, + title: 'Манґа', + }, + }; +} + +const PersonMangaPage = async () => { + return ( +
+ +
+ ); +}; + +export default PersonMangaPage; diff --git a/app/(pages)/(content)/people/[slug]/(person-details)/novel/page.tsx b/app/(pages)/(content)/people/[slug]/(person-details)/novel/page.tsx new file mode 100644 index 00000000..e35a8fb6 --- /dev/null +++ b/app/(pages)/(content)/people/[slug]/(person-details)/novel/page.tsx @@ -0,0 +1,36 @@ +import { Metadata, ResolvingMetadata } from 'next'; + +import Novel from '@/features/people/person-view/novel.component'; + +export async function generateMetadata( + { params }: { params: { slug: string } }, + parent: ResolvingMetadata, +): Promise { + const parentMetadata = await parent; + + return { + title: 'Ранобе', + description: parentMetadata.openGraph?.description, + openGraph: { + siteName: parentMetadata.openGraph?.siteName, + description: parentMetadata.openGraph?.description, + images: parentMetadata.openGraph?.images, + title: 'Ранобе', + }, + twitter: { + description: parentMetadata.openGraph?.description, + images: parentMetadata.twitter?.images, + title: 'Ранобе', + }, + }; +} + +const PersonNovelPage = async () => { + return ( +
+ +
+ ); +}; + +export default PersonNovelPage; diff --git a/app/(pages)/(content)/people/[slug]/layout.queries.ts b/app/(pages)/(content)/people/[slug]/layout.queries.ts index f6fd017b..e0bb0f89 100644 --- a/app/(pages)/(content)/people/[slug]/layout.queries.ts +++ b/app/(pages)/(content)/people/[slug]/layout.queries.ts @@ -1,5 +1,7 @@ import { prefetchPersonAnime } from '@/services/hooks/people/use-person-anime'; import { prefetchPersonCharacters } from '@/services/hooks/people/use-person-characters'; +import { prefetchPersonManga } from '@/services/hooks/people/use-person-manga'; +import { prefetchPersonNovel } from '@/services/hooks/people/use-person-novel'; interface Props { params: { @@ -10,6 +12,8 @@ interface Props { const prefetchQueries = async ({ params: { slug } }: Props) => { await Promise.all([ prefetchPersonAnime({ slug }), + prefetchPersonManga({ slug }), + prefetchPersonNovel({ slug }), prefetchPersonCharacters({ slug }), ]); }; diff --git a/features/users/list-stats/list-stats.component.tsx b/features/users/list-stats/list-stats.component.tsx index ee778c32..70d0baf6 100644 --- a/features/users/list-stats/list-stats.component.tsx +++ b/features/users/list-stats/list-stats.component.tsx @@ -35,7 +35,7 @@ const ListStats = () => { - Манга{' '} + Манґа{' '} diff --git a/services/hooks/anime/use-franchise.ts b/services/hooks/anime/use-franchise.ts deleted file mode 100644 index e33eca85..00000000 --- a/services/hooks/anime/use-franchise.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { QueryKey } from '@tanstack/react-query'; - -import getAnimeFranchise, { - Params, -} from '@/services/api/anime/getAnimeFranchise'; -import useInfiniteList from '@/services/hooks/use-infinite-list'; -import { useSettingsContext } from '@/services/providers/settings-provider'; -import getQueryClient from '@/utils/get-query-client'; -import { convertTitleList } from '@/utils/title-adapter'; - -export const paramsBuilder = (props: Params): Params => ({ - slug: props.slug || '', -}); - -export const key = (params: Params): QueryKey => ['franchise', params.slug]; - -const useFranchise = (props: Params) => { - const { titleLanguage } = useSettingsContext(); - const params = paramsBuilder(props); - - return useInfiniteList({ - queryKey: key(params), - queryFn: ({ pageParam = 1 }) => - getAnimeFranchise({ - params, - page: pageParam, - }), - select: (data) => ({ - ...data, - pages: data.pages.map((a) => ({ - ...a, - list: convertTitleList({ - data: a.list, - titleLanguage: titleLanguage!, - }), - })), - }), - }); -}; - -export const prefetchFranchise = (props: Params) => { - const queryClient = getQueryClient(); - const params = paramsBuilder(props); - - return queryClient.prefetchInfiniteQuery({ - initialPageParam: 1, - queryKey: key(params), - queryFn: ({ pageParam = 1 }) => - getAnimeFranchise({ - params, - page: pageParam, - }), - }); -}; - -export default useFranchise; diff --git a/utils/constants.ts b/utils/constants.ts index 6713f1b4..e39dd33d 100644 --- a/utils/constants.ts +++ b/utils/constants.ts @@ -259,7 +259,7 @@ export const OST: Hikka.FilterProperty = { export const SOURCE: Hikka.FilterProperty = { digital_manga: { - title_ua: 'Цифрова Манга', + title_ua: 'Цифрова Манґа', title_en: 'Digital Manga', }, picture_book: { @@ -271,7 +271,7 @@ export const SOURCE: Hikka.FilterProperty = { title_en: 'Visual Novel', }, '4_koma_manga': { - title_ua: 'Чотирьохпанельна Манга', + title_ua: 'Чотирьохпанельна Манґа', title_en: 'Yonkoma manga', }, light_novel: { @@ -291,7 +291,7 @@ export const SOURCE: Hikka.FilterProperty = { title_en: 'Original', }, manga: { - title_ua: 'Манга', + title_ua: 'Манґа', title_en: 'Manga', }, music: { @@ -600,6 +600,16 @@ export const CHARACTER_NAV_ROUTES: Hikka.NavRoute[] = [ title_ua: 'Аніме', url: '/anime', }, + { + slug: 'anime', + title_ua: 'Манґа', + url: '/manga', + }, + { + slug: 'anime', + title_ua: 'Ранобе', + url: '/novel', + }, ]; export const PERSON_NAV_ROUTES: Hikka.NavRoute[] = [ @@ -613,6 +623,16 @@ export const PERSON_NAV_ROUTES: Hikka.NavRoute[] = [ title_ua: 'Аніме', url: '/anime', }, + { + slug: 'anime', + title_ua: 'Манґа', + url: '/manga', + }, + { + slug: 'anime', + title_ua: 'Ранобе', + url: '/novel', + }, { slug: 'characters', title_ua: 'Персонажі',