diff --git a/app/(api)/generate/preview/anime/[slug]/route.tsx b/app/(api)/generate/preview/anime/[slug]/route.tsx index 8d84a66d..267d2fbf 100644 --- a/app/(api)/generate/preview/anime/[slug]/route.tsx +++ b/app/(api)/generate/preview/anime/[slug]/route.tsx @@ -24,21 +24,22 @@ export async function GET( return new ImageResponse( (

{anime.title_ua || anime.title_en || - anime.title_ja}{' '} + anime.title_ja}

{anime.score > 0 && (
{ @@ -202,6 +203,12 @@ export async function GET(
+ + +
), { diff --git a/app/(api)/generate/preview/u/[username]/route.tsx b/app/(api)/generate/preview/u/[username]/route.tsx index 99a99a12..219ca2d6 100644 --- a/app/(api)/generate/preview/u/[username]/route.tsx +++ b/app/(api)/generate/preview/u/[username]/route.tsx @@ -1,5 +1,3 @@ -import { createElement } from 'react'; - import { ImageResponse } from 'next/og'; import getUserInfo from '@/services/api/user/getUserInfo'; @@ -8,6 +6,49 @@ import { WATCH_STATUS } from '@/utils/constants'; export const runtime = 'edge'; +const RadialProgress = ({ progress }: { progress: number }) => ( +
+
+

497

+
+ + + + +
+); + export async function GET( request: Request, { params: { username } }: { params: { username: string } }, @@ -21,149 +62,159 @@ export async function GET( const user = await getUserInfo({ username }); const watchStats = await getWatchStats({ username }); + const stats = ['completed', 'watching', 'planned']; + + const filteredStats = Object.keys(watchStats).filter( + (stat) => stat in WATCH_STATUS && stats.includes(stat), + ); return new ImageResponse( (
-
- avatar -
-

- {user.username} -

-

+

+ avatar +
- {user.description} -

-
-
- {watchStats && ( -
- {Object.keys(watchStats) - .filter((stat) => stat in WATCH_STATUS) - .map((stat, index) => ( -
+
+

+ {user.username} +

+

+ {user.description} +

+
+
+ {watchStats && (
-

- { - WATCH_STATUS[ - stat as API.WatchStatus - ].title_ua - } -

-
- {createElement( - WATCH_STATUS[ - stat as API.WatchStatus - ].icon!, + {filteredStats.map( + (stat, index) => ( +
+
+
+

+ { + WATCH_STATUS[ + stat as API.WatchStatus + ].title_ua + } +

+
+
+

+ { + watchStats[ + stat as API.WatchStatus + ] + } +

+ {index !== + filteredStats.length - 1 && ( +

+ / +

+ )} +
+
+ ), )}
-

- {watchStats[stat as API.WatchStatus]} -

-
- ))} + )} +
+
- )} +
+ + +
), { diff --git a/app/layout.tsx b/app/layout.tsx index e90187ec..fc4dec49 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -81,7 +81,7 @@ export default async function RootLayout({ >