diff --git a/app/components/Profile/Profile.Stats.tsx b/app/components/Profile/Profile.Stats.tsx index e264905..b31f77d 100644 --- a/app/components/Profile/Profile.Stats.tsx +++ b/app/components/Profile/Profile.Stats.tsx @@ -3,12 +3,21 @@ import Link from "next/link"; import ApexCharts from "apexcharts"; import { useEffect } from "react"; import { minutesToTime } from "#/api/utils"; +import { ReleaseInfoSearchLink } from "../ReleaseInfo/ReleaseInfo.SearchLink"; + +type preferredItem = { + name: string; + percentage: number; +}; export const ProfileStats = (props: { lists: Array; watched_count: number; watched_time: number; - profile_id: number + profile_id: number; + preferred_genres: Array; + preferred_audiences: Array; + preferred_themes: Array; }) => { const getChartOptions = () => { return { @@ -81,41 +90,95 @@ export const ProfileStats = (props: {
-

- {" "} - Смотрю {props.lists[0]} -

-

- {" "} - В планах {props.lists[1]} -

-

- {" "} - Просмотрено {props.lists[2]} -

-

- {" "} - Отложено {props.lists[3]} -

-

- {" "} - Брошено {props.lists[4]} -

+
+

+ {" "} + Смотрю {props.lists[0]} +

+

+ {" "} + В планах {props.lists[1]} +

+

+ {" "} + Просмотрено {props.lists[2]} +

+

+ {" "} + Отложено {props.lists[3]} +

+

+ {" "} + Брошено {props.lists[4]} +

+
+
+

+ Жанры:{" "} + + {props.preferred_genres.map((item, index) => { + return ( +

+ {index > 0 && ", "} + {" "} + {item.percentage}% +
+ ); + })} + +

+

+ Аудитория:{" "} + + {props.preferred_audiences.map((item, index) => { + return ( +

+ {index > 0 && ", "} + {" "} + {item.percentage}% +
+ ); + })} + +

+

+ Тематика:{" "} + + {props.preferred_themes.map((item, index) => { + return ( +

+ {index > 0 && ", "} + {" "} + {item.percentage}% +
+ ); + })} + +

+ +

+ Просмотрено серий:{" "} + {props.watched_count} +

+

+ Время просмотра:{" "} + + ~{minutesToTime(props.watched_time)} + +

+
-
-

- Просмотрено серий:{" "} - {props.watched_count} -

-

- Время просмотра:{" "} - - ~{minutesToTime(props.watched_time)} - -

-
); }; diff --git a/app/components/ReleaseInfo/ReleaseInfo.SearchLink.tsx b/app/components/ReleaseInfo/ReleaseInfo.SearchLink.tsx index db19124..f7524a8 100644 --- a/app/components/ReleaseInfo/ReleaseInfo.SearchLink.tsx +++ b/app/components/ReleaseInfo/ReleaseInfo.SearchLink.tsx @@ -1,19 +1,11 @@ import Link from "next/link"; -// const searchBy = { -// title: 0, -// studio: 1, -// director: 2, -// author: 3, -// genre: 4 -// } - // TODO: сделать какую-нибудь анимацию на ссылке при наведении и фокусе -export const ReleaseInfoSearchLink = (props: { title: string, searchBy: string | number | null }) => { +export const ReleaseInfoSearchLink = (props: { title: string, searchBy: string }) => { return ( {props.title} diff --git a/app/pages/Profile.tsx b/app/pages/Profile.tsx index fdd44b4..6eab266 100644 --- a/app/pages/Profile.tsx +++ b/app/pages/Profile.tsx @@ -164,6 +164,9 @@ export const ProfilePage = (props: any) => { watched_count={user.watched_episode_count} watched_time={user.watched_time} profile_id={user.id} + preferred_genres={user.preferred_genres || []} + preferred_audiences={user.preferred_audiences || []} + preferred_themes={user.preferred_themes || []} />