diff --git a/app/components/Chip/Chip.tsx b/app/components/Chip/Chip.tsx index a7e8e7f..bd0225c 100644 --- a/app/components/Chip/Chip.tsx +++ b/app/components/Chip/Chip.tsx @@ -6,26 +6,22 @@ export const Chip = (props: { devider?: string; bg_color?: string; style?: React.CSSProperties; + className?: string; }) => { return ( -
+
{props.icon_name && ( )} -

+

{props.name} {props.name && props.devider ? props.devider : " "} {props.name_2} diff --git a/app/components/Profile/Profile.ReleaseHistory.tsx b/app/components/Profile/Profile.ReleaseHistory.tsx index e17c2d9..b579c11 100644 --- a/app/components/Profile/Profile.ReleaseHistory.tsx +++ b/app/components/Profile/Profile.ReleaseHistory.tsx @@ -1,25 +1,29 @@ -import { Card, Carousel, RatingStar, Rating } from "flowbite-react"; +import { Card, Carousel } from "flowbite-react"; import type { FlowbiteCarouselIndicatorsTheme, FlowbiteCarouselControlTheme, + CustomFlowbiteTheme, } from "flowbite-react"; -import { ReleaseLink } from "../ReleaseLink/ReleaseLink"; +import { ReleaseLink } from "../ReleaseLink/ReleaseLinkUpdate"; const CarouselIndicatorsTheme: FlowbiteCarouselIndicatorsTheme = { active: { - off: "bg-gray-300/50 hover:bg-gray-400 dark:bg-gray-400/50 dark:hover:bg-gray-200", - on: "bg-gray-600 dark:bg-gray-200", + off: "bg-gray-400/50 hover:bg-gray-200", + on: "bg-gray-200", }, - base: "h-3 w-3 rounded-full", + base: "h-3 w-3 rounded-full max-w-[300px]", wrapper: "absolute bottom-5 left-1/2 flex -translate-x-1/2 space-x-3", }; const CarouselControlsTheme: FlowbiteCarouselControlTheme = { - base: "inline-flex h-8 w-8 items-center justify-center rounded-full bg-gray-600/30 group-hover:bg-gray-600/50 group-focus:outline-none group-focus:ring-4 group-focus:ring-gray-600 dark:bg-gray-400/30 dark:group-hover:bg-gray-400/60 dark:group-focus:ring-gray-400/70 sm:h-10 sm:w-10", - icon: "h-5 w-5 text-gray-600 dark:text-gray-400 sm:h-6 sm:w-6", + base: "inline-flex h-8 w-8 items-center justify-center rounded-full group-focus:outline-none group-focus:ring-4 bg-gray-400/30 group-hover:bg-gray-400/60 group-focus:ring-gray-400/70 sm:h-10 sm:w-10", + icon: "h-5 w-5 text-gray-400 sm:h-6 sm:w-6", }; -const CarouselTheme = { +const CarouselTheme: CustomFlowbiteTheme["carousel"] = { + root: { + base: "relative h-full w-full max-w-[375px]", + }, indicators: CarouselIndicatorsTheme, control: CarouselControlsTheme, }; @@ -28,10 +32,16 @@ export const ProfileReleaseHistory = (props: any) => { return (

Недавно просмотренные

-
+
{props.history.map((release) => { - return ; + return ( + + ); })}
diff --git a/app/components/Profile/Profile.ReleaseRatings.tsx b/app/components/Profile/Profile.ReleaseRatings.tsx index 6c6f978..75af80d 100644 --- a/app/components/Profile/Profile.ReleaseRatings.tsx +++ b/app/components/Profile/Profile.ReleaseRatings.tsx @@ -17,6 +17,7 @@ import { useCallback, useEffect, useState } from "react"; import { ENDPOINTS } from "#/api/config"; import useSWRInfinite from "swr/infinite"; import { Spinner } from "../Spinner/Spinner"; +import { Poster } from "../ReleasePoster/Poster"; const CarouselIndicatorsTheme: FlowbiteCarouselIndicatorsTheme = { active: { @@ -33,6 +34,9 @@ const CarouselControlsTheme: FlowbiteCarouselControlTheme = { }; const CarouselTheme = { + root: { + base: "relative h-full w-full max-w-[700px]", + }, indicators: CarouselIndicatorsTheme, control: CarouselControlsTheme, }; @@ -47,19 +51,15 @@ export const ProfileReleaseRatings = (props: any) => { Посмотреть все
-
+
{props.ratings.map((release) => { return (
- +
+ +

{release.title_ru}

@@ -155,7 +155,7 @@ const ProfileReleaseRatingsModal = (props: { ref={modalRef} > {isLoading && } - {content && content.length > 0 ? ( + {content && content.length > 0 ? content.map((release) => { return (
- +
+ +

{release.title_ru}

@@ -200,9 +196,7 @@ const ProfileReleaseRatingsModal = (props: { ); }) - ) : ( -

Оценок нет

- )} + :

Оценок нет

}
); diff --git a/app/components/ReleaseCourusel/ReleaseCourusel.tsx b/app/components/ReleaseCourusel/ReleaseCourusel.tsx index d7e333a..503c814 100644 --- a/app/components/ReleaseCourusel/ReleaseCourusel.tsx +++ b/app/components/ReleaseCourusel/ReleaseCourusel.tsx @@ -1,5 +1,5 @@ "use client"; -import { ReleaseLink } from "../ReleaseLink/ReleaseLink"; +import { ReleaseLink } from "../ReleaseLink/ReleaseLinkUpdate"; import Link from "next/link"; import { Swiper, SwiperSlide } from 'swiper/react'; @@ -42,7 +42,7 @@ export const ReleaseCourusel = (props: { allowTouchMove={true} breakpoints={{ 1800: { - initialSlide: 1, + initialSlide: 2, centeredSlides: true } }} @@ -52,7 +52,7 @@ export const ReleaseCourusel = (props: { return ( diff --git a/app/components/ReleaseInfo/ReleaseInfo.Basics.tsx b/app/components/ReleaseInfo/ReleaseInfo.Basics.tsx index c23cf4f..63a576c 100644 --- a/app/components/ReleaseInfo/ReleaseInfo.Basics.tsx +++ b/app/components/ReleaseInfo/ReleaseInfo.Basics.tsx @@ -2,6 +2,7 @@ import { Card, Button } from "flowbite-react"; import { useState } from "react"; import Image from "next/image"; import { ReleaseInfoStreaming } from "./ReleaseInfo.LicensedPlatforms"; +import { Poster } from "../ReleasePoster/Poster"; export const ReleaseInfoBasics = (props: { release_id: number; @@ -14,14 +15,20 @@ export const ReleaseInfoBasics = (props: { return ( -
- +
+
+
+ + +
+ +

@@ -54,7 +61,6 @@ export const ReleaseInfoBasics = (props: { > {isFullDescription ? "Скрыть" : "Показать полностью"} -

diff --git a/app/components/ReleaseInfo/ReleaseInfo.LicensedPlatforms.tsx b/app/components/ReleaseInfo/ReleaseInfo.LicensedPlatforms.tsx index 6a1c72b..25f4d24 100644 --- a/app/components/ReleaseInfo/ReleaseInfo.LicensedPlatforms.tsx +++ b/app/components/ReleaseInfo/ReleaseInfo.LicensedPlatforms.tsx @@ -23,17 +23,17 @@ export const ReleaseInfoStreaming = (props: { release_id: number }) => { : !(data.content.length > 0) ? "" :
-

Официальные источники:

-
+
{data.content.map((item: any) => { return ( -

{item.name}

+

{item.name}

); })} diff --git a/app/components/ReleaseInfo/ReleaseInfo.Related.tsx b/app/components/ReleaseInfo/ReleaseInfo.Related.tsx index dbd6c40..80a5cac 100644 --- a/app/components/ReleaseInfo/ReleaseInfo.Related.tsx +++ b/app/components/ReleaseInfo/ReleaseInfo.Related.tsx @@ -1,13 +1,29 @@ "use client"; -import { Card, Carousel, CustomFlowbiteTheme } from "flowbite-react"; -import { ReleaseLink } from "#/components/ReleaseLink/ReleaseLink"; +import { Card, Carousel, CustomFlowbiteTheme, FlowbiteCarouselControlTheme, FlowbiteCarouselIndicatorsTheme } from "flowbite-react"; +import { ReleaseLink } from "#/components/ReleaseLink/ReleaseLinkUpdate"; import Link from "next/link"; +const CarouselIndicatorsTheme: FlowbiteCarouselIndicatorsTheme = { + active: { + off: "bg-gray-400/50 hover:bg-gray-200", + on: "bg-gray-200", + }, + base: "h-3 w-3 rounded-full max-w-[300px]", + wrapper: "absolute bottom-5 left-1/2 flex -translate-x-1/2 space-x-3", +}; + +const CarouselControlsTheme: FlowbiteCarouselControlTheme = { + base: "inline-flex h-8 w-8 items-center justify-center rounded-full group-focus:outline-none group-focus:ring-4 bg-gray-400/30 group-hover:bg-gray-400/60 group-focus:ring-gray-400/70 sm:h-10 sm:w-10", + icon: "h-5 w-5 text-gray-400 sm:h-6 sm:w-6", +}; + const CarouselTheme: CustomFlowbiteTheme["carousel"] = { root: { base: "relative h-full w-full max-w-[300px]", }, + indicators: CarouselIndicatorsTheme, + control: CarouselControlsTheme, }; export const ReleaseInfoRelated = (props: { @@ -39,7 +55,11 @@ export const ReleaseInfoRelated = (props: { }) .map((release: any) => { return ( - + ); })} diff --git a/app/components/ReleaseLink/ReleaseLink.16_9FullImage.tsx b/app/components/ReleaseLink/ReleaseLink.16_9FullImage.tsx deleted file mode 100644 index b62e0ce..0000000 --- a/app/components/ReleaseLink/ReleaseLink.16_9FullImage.tsx +++ /dev/null @@ -1,133 +0,0 @@ -import Link from "next/link"; -import { sinceUnixDate } from "#/api/utils"; -import { Chip } from "#/components/Chip/Chip"; -import Image from "next/image"; - -const profile_lists = { - // 0: "Не смотрю", - 1: { name: "Смотрю", bg_color: "bg-green-500" }, - 2: { name: "В планах", bg_color: "bg-purple-500" }, - 3: { name: "Просмотрено", bg_color: "bg-blue-500" }, - 4: { name: "Отложено", bg_color: "bg-yellow-500" }, - 5: { name: "Брошено", bg_color: "bg-red-500" }, -}; - -export const ReleaseLink169 = (props: any) => { - const grade = props.grade ? props.grade.toFixed(1) : null; - const profile_list_status = props.profile_list_status; - let user_list = null; - if (profile_list_status != null || profile_list_status != 0) { - user_list = profile_lists[profile_list_status]; - } - return ( - -
-
- {props.title -
- {grade ? ( - - ) : ( - "" - )} - {user_list && ( - - )} - {props.status ? ( - - ) : ( - props.status_id != 0 && ( - - ) - )} - - {props.last_view_episode && ( - - )} - {props.category && } - {props.is_favorite && ( -
- -
- )} -
-
-
- {props.genres && ( -

- {props.genres} -

- )} -

- {props.title_ru} -

-
-

- {`${props.description.slice(0, 125)}${ - props.description.length > 125 ? "..." : "" - }`} -

-
-
-
- - ); -}; diff --git a/app/components/ReleaseLink/ReleaseLink.16_9Poster.tsx b/app/components/ReleaseLink/ReleaseLink.16_9Poster.tsx deleted file mode 100644 index 384c914..0000000 --- a/app/components/ReleaseLink/ReleaseLink.16_9Poster.tsx +++ /dev/null @@ -1,124 +0,0 @@ -import Link from "next/link"; -import { sinceUnixDate } from "#/api/utils"; -import { Chip } from "#/components/Chip/Chip"; -import Image from "next/image"; - -const profile_lists = { - // 0: "Не смотрю", - 1: { name: "Смотрю", bg_color: "bg-green-500" }, - 2: { name: "В планах", bg_color: "bg-purple-500" }, - 3: { name: "Просмотрено", bg_color: "bg-blue-500" }, - 4: { name: "Отложено", bg_color: "bg-yellow-500" }, - 5: { name: "Брошено", bg_color: "bg-red-500" }, -}; - -export const ReleaseLink169Poster = (props: any) => { - const grade = props.grade ? props.grade.toFixed(1) : null; - const profile_list_status = props.profile_list_status; - let user_list = null; - if (profile_list_status != null || profile_list_status != 0) { - user_list = profile_lists[profile_list_status]; - } - return ( - -
-
-
- {props.title -
-
-
- {props.genres && ( -

- {props.genres} -

- )} -

- {`${props.title_ru.slice(0, 47)}${ - props.title_ru.length > 47 ? "..." : "" - }`} -

-

- {`${props.description.slice(0, 97)}${ - props.description.length > 97 ? "..." : "" - }`} -

-
-
- {grade ? : ""} - {user_list && ( - - )} - {props.status ? ( - - ) : ( - props.status_id != 0 && ( - - ) - )} - - {props.last_view_episode && ( - - )} - {props.category && } - {props.is_favorite && ( -
- -
- )} -
-
-
-
- - ); -}; diff --git a/app/components/ReleaseLink/ReleaseLink.16_9Related.tsx b/app/components/ReleaseLink/ReleaseLink.16_9Related.tsx deleted file mode 100644 index aa2959f..0000000 --- a/app/components/ReleaseLink/ReleaseLink.16_9Related.tsx +++ /dev/null @@ -1,136 +0,0 @@ -import Link from "next/link"; -import { sinceUnixDate } from "#/api/utils"; -import { Chip } from "#/components/Chip/Chip"; -import Image from "next/image"; - -const profile_lists = { - // 0: "Не смотрю", - 1: { name: "Смотрю", bg_color: "bg-green-500" }, - 2: { name: "В планах", bg_color: "bg-purple-500" }, - 3: { name: "Просмотрено", bg_color: "bg-blue-500" }, - 4: { name: "Отложено", bg_color: "bg-yellow-500" }, - 5: { name: "Брошено", bg_color: "bg-red-500" }, -}; -const YearSeason = ["_", "Зима", "Весна", "Лето", "Осень"]; - -export const ReleaseLink169Related = (props: any) => { - const grade = props.grade.toFixed(1); - const profile_list_status = props.profile_list_status; - let user_list = null; - if (profile_list_status != null || profile_list_status != 0) { - user_list = profile_lists[profile_list_status]; - } - return ( - -
-

- {props.season ? YearSeason[props.season] : ""} -
- {props.year ? props.year : ""} -

-
-
-
-
- {props.title -
-
-
- {props.genres && ( -

- {props.genres} -

- )} -

- {`${props.title_ru.slice(0, 47)}${ - props.title_ru.length > 47 ? "..." : "" - }`} -

-

- {`${props.description.slice(0, 97)}${ - props.description.length > 97 ? "..." : "" - }`} -

-

- {props.title_ru} -

-

- {props.description} -

-
-
- - {user_list && ( - - )} - {props.status ? ( - - ) : ( - props.status_id != 0 && ( - - ) - )} - - {props.category && } - {props.season || props.year ? ( - - ) : ( - "" - )} - {props.is_favorite && ( -
- -
- )} -
-
-
-
- - ); -}; diff --git a/app/components/ReleaseLink/ReleaseLink.Poster.tsx b/app/components/ReleaseLink/ReleaseLink.Poster.tsx deleted file mode 100644 index 438b7b6..0000000 --- a/app/components/ReleaseLink/ReleaseLink.Poster.tsx +++ /dev/null @@ -1,84 +0,0 @@ -import Link from "next/link"; -import { Chip } from "#/components/Chip/Chip"; - -const profile_lists = { - // 0: "Не смотрю", - 1: { name: "Смотрю", bg_color: "bg-green-500" }, - 2: { name: "В планах", bg_color: "bg-purple-500" }, - 3: { name: "Просмотрено", bg_color: "bg-blue-500" }, - 4: { name: "Отложено", bg_color: "bg-yellow-500" }, - 5: { name: "Брошено", bg_color: "bg-red-500" }, -}; - -export const ReleaseLinkPoster = (props: any) => { - const grade = props.grade.toFixed(1); - const profile_list_status = props.profile_list_status; - let user_list = null; - if (profile_list_status != null || profile_list_status != 0) { - user_list = profile_lists[profile_list_status]; - } - return ( - -
-
- - {props.status ? ( - - ) : ( - - )} - -
-
- {props.title_ru && ( -

- {props.title_ru} -

- )} - {props.title_original && ( -

- {props.title_original} -

- )} -
-
- - ); -}; diff --git a/app/components/ReleaseLink/ReleaseLink.tsx b/app/components/ReleaseLink/ReleaseLink.tsx deleted file mode 100644 index f81e277..0000000 --- a/app/components/ReleaseLink/ReleaseLink.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { ReleaseLink169 } from "./ReleaseLink.16_9FullImage"; -import { ReleaseLink169Poster } from "./ReleaseLink.16_9Poster"; -import { ReleaseLinkPoster } from "./ReleaseLink.Poster"; - -export const ReleaseLink = (props: {type?: "16_9"|"poster"}) => { - const type = props.type || "16_9"; - - if (type == "16_9") { - return ( - <> -
-
- - ) - } - if (type == "poster") { - return ; - } -}; diff --git a/app/components/ReleaseLink/ReleaseLinkUpdate.tsx b/app/components/ReleaseLink/ReleaseLinkUpdate.tsx new file mode 100644 index 0000000..e448809 --- /dev/null +++ b/app/components/ReleaseLink/ReleaseLinkUpdate.tsx @@ -0,0 +1,43 @@ +import Link from "next/link"; +import { PosterWithStuff } from "../ReleasePoster/PosterWithStuff"; + +export const ReleaseLink = (props: { + image: string; + title_ru: string; + title_original: string; + description?: string; + genres?: string; + grade?: number; + id: number; + settings?: { + showGenres?: boolean; + showDescription?: boolean; + }; + chipsSettings?: { + enabled: boolean; + gradeHidden?: boolean; + statusHidden?: boolean; + categoryHidden?: boolean; + episodesHidden?: boolean; + listHidden?: boolean; + favHidden?: boolean; + lastWatchedHidden?: boolean; + }; + profile_list_status?: number; + status?: { + name: string; + }; + category?: { + name: string; + }; + status_id?: number; + episodes_released?: string; + episodes_total?: string; + is_favorite?: boolean; +}) => { + return ( + + + + ); +}; diff --git a/app/components/ReleasePoster/Chips.tsx b/app/components/ReleasePoster/Chips.tsx new file mode 100644 index 0000000..8e1784b --- /dev/null +++ b/app/components/ReleasePoster/Chips.tsx @@ -0,0 +1,103 @@ +import { sinceUnixDate } from "#/api/utils"; +import { Chip } from "../Chip/Chip"; + +interface ChipProps { + settings?: any; + grade?: any; + status?: any; + status_id?: any; + user_list?: any; + episodes_released?: any; + episodes_total?: any; + category?: any; + is_favorite?: any; + last_view_episode?: any; + last_view_timestamp?: any; +} + +export const ReleaseChips = ({ + settings, + grade, + status, + status_id, + user_list, + episodes_released, + episodes_total, + category, + is_favorite, + last_view_episode, + last_view_timestamp, +}: ChipProps) => { + const chipSettings = { + enabled: true, + gradeHidden: false, + statusHidden: false, + categoryHidden: false, + episodesHidden: false, + listHidden: false, + favHidden: false, + lastWatchedHidden: true, + ...settings, + }; + + return ( +
+ {!chipSettings.gradeHidden && grade ? + + : ""} + {!chipSettings.listHidden && user_list && ( + + )} + {!chipSettings.statusHidden && status ? + + : status_id != 0 && ( + + ) + } + {!chipSettings.episodesHidden && ( + + )} + {!chipSettings.categoryHidden && category && } + {!chipSettings.favHidden && is_favorite && ( +
+ +
+ )} + {!chipSettings.lastWatchedHidden && last_view_episode && ( + + )} +
+ ); +}; diff --git a/app/components/ReleasePoster/Poster.tsx b/app/components/ReleasePoster/Poster.tsx new file mode 100644 index 0000000..4d500cb --- /dev/null +++ b/app/components/ReleasePoster/Poster.tsx @@ -0,0 +1,22 @@ +import Image from "next/image"; + +export const Poster = (props: { + image: string; + alt?: string; + className?: string; +}) => { + return ( + {props.alt + ); +}; diff --git a/app/components/ReleasePoster/PosterWithStuff.tsx b/app/components/ReleasePoster/PosterWithStuff.tsx new file mode 100644 index 0000000..adffc49 --- /dev/null +++ b/app/components/ReleasePoster/PosterWithStuff.tsx @@ -0,0 +1,117 @@ +import { Poster } from "./Poster"; +import { ReleaseChips } from "./Chips"; + +const profile_lists = { + // 0: "Не смотрю", + 1: { name: "Смотрю", bg_color: "bg-green-500" }, + 2: { name: "В планах", bg_color: "bg-purple-500" }, + 3: { name: "Просмотрено", bg_color: "bg-blue-500" }, + 4: { name: "Отложено", bg_color: "bg-yellow-500" }, + 5: { name: "Брошено", bg_color: "bg-red-500" }, +}; + +export const PosterWithStuff = (props: { + image: string; + title_ru: string; + title_original: string; + description?: string; + genres?: string; + grade?: number; + id: number; + settings?: { + showGenres?: boolean; + showDescription?: boolean; + }; + chipsSettings?: { + enabled: boolean; + gradeHidden?: boolean; + statusHidden?: boolean; + categoryHidden?: boolean; + episodesHidden?: boolean; + listHidden?: boolean; + favHidden?: boolean; + lastWatchedHidden?: boolean; + }; + profile_list_status?: number; + status?: { + name: string; + }; + category?: { + name: string; + }; + status_id?: number; + episodes_released?: string; + episodes_total?: string; + is_favorite?: boolean; +}) => { + const genres = []; + const settings = { + showGenres: true, + showDescription: true, + ...props.settings, + }; + const chipsSettings = props.chipsSettings || {} + + const grade = props.grade ? Number(props.grade.toFixed(1)) : null; + const profile_list_status = props.profile_list_status || null; + let user_list = null; + if (profile_list_status != null || profile_list_status != 0) { + user_list = profile_lists[profile_list_status]; + } + if (props.genres) { + const genres_array = props.genres.split(","); + genres_array.forEach((genre) => { + genres.push(genre.trim()); + }); + } + + return ( +
+
+ +
+
+
+ {settings.showGenres && + genres.length > 0 && + genres.map((genre: string, index: number) => { + return ( + + {index > 0 && ", "} + {genre} + + ); + })} + {props.title_ru && ( +

+ {props.title_ru} +

+ )} + {props.title_original && ( +

+ {props.title_original} +

+ )} +
+ {settings.showDescription && props.description && ( +

+ {props.description} +

+ )} +
+
+ +
+ ); +}; diff --git a/app/components/ReleaseSection/ReleaseSection.tsx b/app/components/ReleaseSection/ReleaseSection.tsx index 734e388..b826085 100644 --- a/app/components/ReleaseSection/ReleaseSection.tsx +++ b/app/components/ReleaseSection/ReleaseSection.tsx @@ -1,4 +1,4 @@ -import { ReleaseLink } from "../ReleaseLink/ReleaseLink"; +import { ReleaseLink } from "../ReleaseLink/ReleaseLinkUpdate"; export const ReleaseSection = (props: { sectionTitle?: string; @@ -14,15 +14,22 @@ export const ReleaseSection = (props: {
)}
-
+
{props.content.map((release) => { return ( -
- +
+
); })} - {props.content.length == 1 &&
}
diff --git a/app/pages/CreateCollection.tsx b/app/pages/CreateCollection.tsx index e943634..cd0c3b7 100644 --- a/app/pages/CreateCollection.tsx +++ b/app/pages/CreateCollection.tsx @@ -15,7 +15,7 @@ import { Modal, useThemeMode, } from "flowbite-react"; -import { ReleaseLink } from "#/components/ReleaseLink/ReleaseLink"; +import { PosterWithStuff } from "#/components/ReleasePoster/PosterWithStuff"; import { CropModal } from "#/components/CropModal/CropModal"; import { b64toBlob, tryCatchAPI } from "#/api/utils"; @@ -462,20 +462,17 @@ export const CreateCollectionPage = () => {
-
+
{addedReleases.map((release) => { return ( -
+
- +
); })} @@ -592,6 +589,9 @@ export const ReleasesEditModal = (props: { return; } + const newContent = content.filter((r) => r.id !== release.id); + + setContent(newContent); props.setReleases([...props.releases, release]); props.setReleasesIds([...props.releasesIds, release.id]); } @@ -611,11 +611,7 @@ export const ReleasesEditModal = (props: { >
{ - e.preventDefault(); - setContent([]); - setQuery(e.target[0].value.trim()); - }} + onSubmit={(e) => e.preventDefault()} >
-
+
{content.map((release) => { return ( ); })} - {content.length == 1 &&
}
{isLoading && (
diff --git a/app/pages/Related.tsx b/app/pages/Related.tsx index beb5d05..9865c8a 100644 --- a/app/pages/Related.tsx +++ b/app/pages/Related.tsx @@ -5,11 +5,24 @@ import { useState, useEffect } from "react"; import { useScrollPosition } from "#/hooks/useScrollPosition"; import { useUserStore } from "../store/auth"; import { ENDPOINTS } from "#/api/config"; -import { ReleaseLink169Related } from "#/components/ReleaseLink/ReleaseLink.16_9Related"; import { useSWRfetcher } from "#/api/utils"; +import { Card } from "flowbite-react"; +import { Poster } from "#/components/ReleasePoster/Poster"; +import { ReleaseChips } from "#/components/ReleasePoster/Chips"; +import { PosterWithStuff } from "#/components/ReleasePoster/PosterWithStuff"; +import Link from "next/link"; +const profile_lists = { + // 0: "Не смотрю", + 1: { name: "Смотрю", bg_color: "bg-green-500" }, + 2: { name: "В планах", bg_color: "bg-purple-500" }, + 3: { name: "Просмотрено", bg_color: "bg-blue-500" }, + 4: { name: "Отложено", bg_color: "bg-yellow-500" }, + 5: { name: "Брошено", bg_color: "bg-red-500" }, +}; +const YearSeason = ["_", "Зима", "Весна", "Лето", "Осень"]; -export function RelatedPage(props: {id: number|string, title: string}) { +export function RelatedPage(props: { id: number | string; title: string }) { const token = useUserStore((state) => state.token); const getKey = (pageIndex: number, previousPageData: any) => { @@ -52,22 +65,95 @@ export function RelatedPage(props: {id: number|string, title: string}) { Франшиза {props.title}
- {content && content.length > 0 ? ( + {content && content.length > 0 ?
{content.map((release, index) => { - return + const genres = []; + const grade = + release.grade ? Number(release.grade.toFixed(1)) : null; + const profile_list_status = release.profile_list_status || null; + let user_list = null; + if (profile_list_status != null || profile_list_status != 0) { + user_list = profile_lists[profile_list_status]; + } + if (release.genres) { + const genres_array = release.genres.split(","); + genres_array.forEach((genre) => { + genres.push(genre.trim()); + }); + } + return ( + + +
+
+

+ {release.season ? YearSeason[release.season] : ""} + {release.season ? +
+ : ""} + {release.year ? release.year : ""} +

+
+
+
+ +
+
+
+ +
+
+ +
+ {genres.length > 0 && + genres.map((genre: string, index: number) => { + return ( + + {index > 0 && ", "} + {genre} + + ); + })} +
+ {release.title_ru && ( +

+ {release.title_ru} +

+ )} + {release.title_original && ( +

+ {release.title_original} +

+ )} + {release.description && ( +

+ {release.description} +

+ )} +
+
+
+ + ); })}
- ) : isLoading ? ( + : isLoading ?
- ) : ( -
+ :

В франшизе пока ничего нет...

- )} + } {data && data[data.length - 1].current_page < data[data.length - 1].total_page_count && (