From cd4ada56574d9c2cae606a97816435e3ca006ef1 Mon Sep 17 00:00:00 2001 From: Kentai Radiquum Date: Wed, 20 Nov 2024 21:24:48 +0500 Subject: [PATCH] refactor: update card style for mobile --- .../ReleaseCourusel/ReleaseCourusel.tsx | 7 +- ...16_9.tsx => ReleaseLink.16_9FullImage.tsx} | 0 .../ReleaseLink/ReleaseLink.16_9Poster.tsx | 124 ++++++++++++++++++ app/components/ReleaseLink/ReleaseLink.tsx | 10 +- .../ReleaseSection/ReleaseSection.tsx | 4 +- app/home/[slug]/page.tsx | 2 +- app/pages/Index.tsx | 2 +- 7 files changed, 137 insertions(+), 12 deletions(-) rename app/components/ReleaseLink/{ReleaseLink.16_9.tsx => ReleaseLink.16_9FullImage.tsx} (100%) create mode 100644 app/components/ReleaseLink/ReleaseLink.16_9Poster.tsx diff --git a/app/components/ReleaseCourusel/ReleaseCourusel.tsx b/app/components/ReleaseCourusel/ReleaseCourusel.tsx index 06d3a77..d7e333a 100644 --- a/app/components/ReleaseCourusel/ReleaseCourusel.tsx +++ b/app/components/ReleaseCourusel/ReleaseCourusel.tsx @@ -52,7 +52,7 @@ export const ReleaseCourusel = (props: { return ( @@ -71,11 +71,6 @@ export const ReleaseCourusel = (props: { } > - {/*
-
-
- -
*/} ); diff --git a/app/components/ReleaseLink/ReleaseLink.16_9.tsx b/app/components/ReleaseLink/ReleaseLink.16_9FullImage.tsx similarity index 100% rename from app/components/ReleaseLink/ReleaseLink.16_9.tsx rename to app/components/ReleaseLink/ReleaseLink.16_9FullImage.tsx diff --git a/app/components/ReleaseLink/ReleaseLink.16_9Poster.tsx b/app/components/ReleaseLink/ReleaseLink.16_9Poster.tsx new file mode 100644 index 0000000..2b5320a --- /dev/null +++ b/app/components/ReleaseLink/ReleaseLink.16_9Poster.tsx @@ -0,0 +1,124 @@ +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.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.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 ? "..." : "" + }`} +

+
+
+
+
+ + {user_list && ( + + )} + {props.status ? ( + + ) : ( + props.status_id != 0 && ( + + ) + )} + + {props.last_view_episode && ( + + )} + {props.category && } + {props.is_favorite && ( +
+ +
+ )} +
+
+ + ); +}; diff --git a/app/components/ReleaseLink/ReleaseLink.tsx b/app/components/ReleaseLink/ReleaseLink.tsx index 6d6c640..f81e277 100644 --- a/app/components/ReleaseLink/ReleaseLink.tsx +++ b/app/components/ReleaseLink/ReleaseLink.tsx @@ -1,11 +1,17 @@ -import { ReleaseLink169 } from "./ReleaseLink.16_9"; +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 ; + return ( + <> +
+
+ + ) } if (type == "poster") { return ; diff --git a/app/components/ReleaseSection/ReleaseSection.tsx b/app/components/ReleaseSection/ReleaseSection.tsx index c1642db..734e388 100644 --- a/app/components/ReleaseSection/ReleaseSection.tsx +++ b/app/components/ReleaseSection/ReleaseSection.tsx @@ -14,10 +14,10 @@ export const ReleaseSection = (props: { )}
-
+
{props.content.map((release) => { return ( -
+
); diff --git a/app/home/[slug]/page.tsx b/app/home/[slug]/page.tsx index ded7fd9..3a79984 100644 --- a/app/home/[slug]/page.tsx +++ b/app/home/[slug]/page.tsx @@ -3,7 +3,7 @@ import { IndexCategoryPage } from "#/pages/IndexCategory"; const SectionTitleMapping = { last: "Последние релизы", finished: "Завершенные релизы", - ongoing: "В эфире", + ongoing: "Выходит", announce: "Анонсированные релизы", films: "Фильмы", }; diff --git a/app/pages/Index.tsx b/app/pages/Index.tsx index 4af1680..0051e38 100644 --- a/app/pages/Index.tsx +++ b/app/pages/Index.tsx @@ -61,7 +61,7 @@ export function IndexPage() { )} {ongoingReleasesData && (