Skip to content

Commit

Permalink
fix: add manga and novel pages for person and character
Browse files Browse the repository at this point in the history
  • Loading branch information
olexh committed Jun 22, 2024
1 parent cb06f8b commit 84dd611
Show file tree
Hide file tree
Showing 12 changed files with 182 additions and 62 deletions.
4 changes: 2 additions & 2 deletions app/(pages)/(content)/anime/[slug]/layout.queries.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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<Metadata> {
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 (
<div className="flex flex-col gap-12">
<Manga extended />
</div>
);
};

export default CharacterMangaPage;
Original file line number Diff line number Diff line change
@@ -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<Metadata> {
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 (
<div className="flex flex-col gap-12">
<Novel extended />
</div>
);
};

export default CharacterNovelPage;
4 changes: 4 additions & 0 deletions app/(pages)/(content)/characters/[slug]/layout.queries.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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' }),
]);
Expand Down
2 changes: 2 additions & 0 deletions app/(pages)/(content)/manga/[slug]/layout.queries.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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,
]);
};
Expand Down
2 changes: 2 additions & 0 deletions app/(pages)/(content)/novel/[slug]/layout.queries.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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,
]);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -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<Metadata> {
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 (
<div className="flex flex-col gap-12">
<Manga extended />
</div>
);
};

export default PersonMangaPage;
Original file line number Diff line number Diff line change
@@ -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<Metadata> {
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 (
<div className="flex flex-col gap-12">
<Novel extended />
</div>
);
};

export default PersonNovelPage;
4 changes: 4 additions & 0 deletions app/(pages)/(content)/people/[slug]/layout.queries.ts
Original file line number Diff line number Diff line change
@@ -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: {
Expand All @@ -10,6 +12,8 @@ interface Props {
const prefetchQueries = async ({ params: { slug } }: Props) => {
await Promise.all([
prefetchPersonAnime({ slug }),
prefetchPersonManga({ slug }),
prefetchPersonNovel({ slug }),
prefetchPersonCharacters({ slug }),
]);
};
Expand Down
2 changes: 1 addition & 1 deletion features/users/list-stats/list-stats.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const ListStats = () => {
</Link>
</TabsTrigger>
<TabsTrigger value="manga" className="flex-1 gap-2">
Манга{' '}
Манґа{' '}
<Link
href={`/u/${params.username}/list/manga?status=planned&sort=read_score`}
>
Expand Down
56 changes: 0 additions & 56 deletions services/hooks/anime/use-franchise.ts

This file was deleted.

26 changes: 23 additions & 3 deletions utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ export const OST: Hikka.FilterProperty<API.OSTType> = {

export const SOURCE: Hikka.FilterProperty<API.Source> = {
digital_manga: {
title_ua: 'Цифрова Манга',
title_ua: 'Цифрова Манґа',
title_en: 'Digital Manga',
},
picture_book: {
Expand All @@ -271,7 +271,7 @@ export const SOURCE: Hikka.FilterProperty<API.Source> = {
title_en: 'Visual Novel',
},
'4_koma_manga': {
title_ua: 'Чотирьохпанельна Манга',
title_ua: 'Чотирьохпанельна Манґа',
title_en: 'Yonkoma manga',
},
light_novel: {
Expand All @@ -291,7 +291,7 @@ export const SOURCE: Hikka.FilterProperty<API.Source> = {
title_en: 'Original',
},
manga: {
title_ua: 'Манга',
title_ua: 'Манґа',
title_en: 'Manga',
},
music: {
Expand Down Expand Up @@ -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[] = [
Expand All @@ -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: 'Персонажі',
Expand Down

0 comments on commit 84dd611

Please sign in to comment.