mirror of
https://github.com/Radiquum/AniX.git
synced 2025-04-29 01:19:41 +05:00
feat: add another user profile bookmarks viewing
This commit is contained in:
parent
05b4fc3325
commit
b0eed16d18
8 changed files with 150 additions and 21 deletions
47
app/profile/[id]/bookmarks/[slug]/page.tsx
Normal file
47
app/profile/[id]/bookmarks/[slug]/page.tsx
Normal file
|
@ -0,0 +1,47 @@
|
|||
import { BookmarksCategoryPage } from "#/pages/BookmarksCategory";
|
||||
import { fetchDataViaGet } from "#/api/utils";
|
||||
import type { Metadata, ResolvingMetadata } from "next";
|
||||
|
||||
const SectionTitleMapping = {
|
||||
watching: "Смотрю",
|
||||
planned: "В планах",
|
||||
watched: "Просмотрено",
|
||||
delayed: "Отложено",
|
||||
abandoned: "Заброшено",
|
||||
};
|
||||
|
||||
export async function generateMetadata(
|
||||
{ params },
|
||||
parent: ResolvingMetadata
|
||||
): Promise<Metadata> {
|
||||
const id: string = params.id;
|
||||
const profile: any = await fetchDataViaGet(
|
||||
`https://api.anixart.tv/profile/${id}`
|
||||
);
|
||||
const previousOG = (await parent).openGraph;
|
||||
|
||||
return {
|
||||
title: SectionTitleMapping[params.slug] + " - " + profile.profile.login,
|
||||
description: profile.profile.status,
|
||||
openGraph: {
|
||||
...previousOG,
|
||||
images: [
|
||||
{
|
||||
url: profile.profile.avatar, // Must be an absolute URL
|
||||
width: 600,
|
||||
height: 600,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default function Index({ params }) {
|
||||
return (
|
||||
<BookmarksCategoryPage
|
||||
slug={params.slug}
|
||||
SectionTitleMapping={SectionTitleMapping}
|
||||
profile_id={params.id}
|
||||
/>
|
||||
);
|
||||
}
|
33
app/profile/[id]/bookmarks/page.tsx
Normal file
33
app/profile/[id]/bookmarks/page.tsx
Normal file
|
@ -0,0 +1,33 @@
|
|||
import { BookmarksPage } from "#/pages/Bookmarks";
|
||||
import { fetchDataViaGet } from "#/api/utils";
|
||||
import type { Metadata, ResolvingMetadata } from "next";
|
||||
|
||||
export async function generateMetadata(
|
||||
{ params },
|
||||
parent: ResolvingMetadata
|
||||
): Promise<Metadata> {
|
||||
const id: string = params.id;
|
||||
const profile: any = await fetchDataViaGet(
|
||||
`https://api.anixart.tv/profile/${id}`
|
||||
);
|
||||
const previousOG = (await parent).openGraph;
|
||||
|
||||
return {
|
||||
title: "Закладки - " + profile.profile.login,
|
||||
description: profile.profile.status,
|
||||
openGraph: {
|
||||
...previousOG,
|
||||
images: [
|
||||
{
|
||||
url: profile.profile.avatar, // Must be an absolute URL
|
||||
width: 600,
|
||||
height: 600,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default function Index({ params }) {
|
||||
return <BookmarksPage profile_id={params.id}/>;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue