From 8cf1bb534dfcb12cda47c4c6656a48198ebdb0da Mon Sep 17 00:00:00 2001 From: Radiquum Date: Thu, 3 Apr 2025 21:07:44 +0500 Subject: [PATCH 01/12] refactor: start redesign of user page --- .gitignore | 2 + app/components/Profile/Profile.Role.tsx | 15 ++ app/components/Profile/Profile.Social.tsx | 20 ++ app/components/Profile/Profile.User.tsx | 259 +++++++++++----------- app/pages/Profile.tsx | 100 ++++----- 5 files changed, 211 insertions(+), 185 deletions(-) create mode 100644 app/components/Profile/Profile.Role.tsx create mode 100644 app/components/Profile/Profile.Social.tsx diff --git a/.gitignore b/.gitignore index f6c46f4..8595241 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,5 @@ videos/* !videos/*.js !videos/*.ts public/_next-video + +API-Trace/* \ No newline at end of file diff --git a/app/components/Profile/Profile.Role.tsx b/app/components/Profile/Profile.Role.tsx new file mode 100644 index 0000000..ac1e13a --- /dev/null +++ b/app/components/Profile/Profile.Role.tsx @@ -0,0 +1,15 @@ +interface UserRoleProps { + name: string; + color: string; +} + +export const UserRole = ({ name, color }: UserRoleProps) => { + return ( +
+

{name}

+
+ ); +}; diff --git a/app/components/Profile/Profile.Social.tsx b/app/components/Profile/Profile.Social.tsx new file mode 100644 index 0000000..e9ae218 --- /dev/null +++ b/app/components/Profile/Profile.Social.tsx @@ -0,0 +1,20 @@ +interface UserSocialProps { + icon: string; + url?: string; + nickname: string; + color: string; +} + +export const UserSocial = ({ nickname, icon, color }: UserSocialProps) => { + return ( +
+
+ +

{nickname}

+
+
+ ); +}; diff --git a/app/components/Profile/Profile.User.tsx b/app/components/Profile/Profile.User.tsx index 2cdaa99..e2033cc 100644 --- a/app/components/Profile/Profile.User.tsx +++ b/app/components/Profile/Profile.User.tsx @@ -1,143 +1,150 @@ "use client"; -import { Avatar, Card, Button } from "flowbite-react"; -import Link from "next/link"; -import { useRouter } from "next/navigation"; -import { Chip } from "../Chip/Chip"; -export const ProfileUser = (props: { - isOnline: boolean; +import { Avatar, Card, useThemeMode } from "flowbite-react"; +import { UserRole } from "./Profile.Role"; +import { UserSocial } from "./Profile.Social"; +import Link from "next/link"; + +interface ProfileUserProps { avatar: string; login: string; status: string; - socials: { - isPrivate: boolean; - hasSocials: boolean; - socials: { - name: string; - nickname: any; - icon: string; - urlPrefix?: string | undefined; - }[]; - }; - chips: { - hasChips: boolean; - isMyProfile: boolean; - isVerified: boolean; - isSponsor: boolean; - isBlocked: boolean; - roles?: { - id: number; - name: string; - color: string; - }[]; - }; rating: number; -}) => { - const router = useRouter(); + roles: { + id: number; + name: string; + color: string; + }[]; + isMyProfile: boolean; + isSponsor: boolean; + isBlocked: boolean; + isVerified: boolean; + isOnline: boolean; + socials: { + vk: string; + tg: string; + tt: string; + inst: string; + discord: string; + }; +} + +export const ProfileUser = ({ + avatar, + login, + status, + rating, + roles, + isMyProfile, + isVerified, + isOnline, + isSponsor, + isBlocked, + socials, +}: ProfileUserProps) => { + + const theme = useThemeMode().mode; + return ( - - {props.chips.hasChips && ( -
- {props.chips.isMyProfile && ( - - )} - {props.chips.isVerified && ( - - )} - {props.chips.isSponsor && ( - - )} - {props.chips.isBlocked && ( - - )} - {props.chips.roles && - props.chips.roles.length > 0 && - props.chips.roles.map((role: any) => ( - - ))} + + {(isMyProfile || + isVerified || + isSponsor || + isBlocked || + roles.length > 0) && ( +
+ {isMyProfile && } + {isBlocked && } + {isVerified && } + {isSponsor && } + {roles.map((role) => ( + + ))}
)} - -
-
- {props.login}{" "} +
+ +
+

+ {login} 0 - ? "border-green-500 text-green-500" - : "border-red-500 text-red-500" + className={`border rounded-md px-2 py-1 min-w-8 text-sm flex items-center justify-center ${ + rating > 0 ? + "border-green-500 text-green-500" + : "border-red-500 text-red-500" }`} > - {props.rating} + {rating} -

-
- {props.status} -
+

+

{status}

- - {props.socials.hasSocials && !props.socials.isPrivate && ( -
- {props.socials.socials - .filter((social: any) => { - if (social.nickname == "") { - return false; - } - return true; - }) - .map((social: any) => { - if (social.name == "discord" && social.nickname != "") - return ( - - ); - return ( - - - - ); - })} +
+ {(socials.vk || + socials.tg || + socials.discord || + socials.tt || + socials.inst) && ( +
+ {socials.vk && ( + + + + )} + {socials.tg && ( + + + + )} + {socials.tt && ( + + + + )} + {socials.inst && ( + + + + )} + {socials.discord && ( + + )}
)} diff --git a/app/pages/Profile.tsx b/app/pages/Profile.tsx index 7a81d93..65bd2c3 100644 --- a/app/pages/Profile.tsx +++ b/app/pages/Profile.tsx @@ -59,50 +59,7 @@ export const ProfilePage = (props: any) => { ); } - const hasSocials = - user.vk_page != "" || - user.tg_page != "" || - user.tt_page != "" || - user.inst_page != "" || - user.discord_page != "" || - false; - const socials = [ - { - name: "vk", - nickname: user.vk_page, - icon: "fa6-brands--vk", - urlPrefix: "https://vk.com/", - }, - { - name: "telegram", - nickname: user.tg_page, - icon: "fa6-brands--telegram", - urlPrefix: "https://t.me/", - }, - { - name: "discord", - nickname: user.discord_page, - icon: "fa6-brands--discord", - }, - { - name: "tiktok", - nickname: user.tt_page, - icon: "fa6-brands--tiktok", - urlPrefix: "https://tiktok.com/@", - }, - { - name: "instagram", - nickname: user.inst_page, - icon: "fa6-brands--instagram", - urlPrefix: "https://instagram.com/", - }, - ]; - const hasChips = - user.is_verified || - user.is_blocked || - (user.roles && user.roles.length > 0) || - isMyProfile; const isPrivacy = user.is_stats_hidden || user.is_counts_hidden || user.is_social_hidden; @@ -120,7 +77,45 @@ export const ProfilePage = (props: any) => { is_me_blocked={user.is_me_blocked} />
-
+
+ + {authUser.token && ( + + )} +
+
+
+ {/*
{ )}
- {authUser.token && ( - - )} + {!user.is_stats_hidden && ( <> { )}
-
+
*/} Date: Thu, 3 Apr 2025 21:38:51 +0500 Subject: [PATCH 02/12] refactor: return user stats & made release votes preview as a list --- app/api/utils.ts | 4 +- .../Profile/Profile.ReleaseRatings.tsx | 50 +++++----- app/pages/Profile.tsx | 91 +++++++------------ 3 files changed, 61 insertions(+), 84 deletions(-) diff --git a/app/api/utils.ts b/app/api/utils.ts index af3a4c3..f1f4b8d 100644 --- a/app/api/utils.ts +++ b/app/api/utils.ts @@ -212,9 +212,9 @@ export function unixToDate( " " + date.getFullYear() + ", " + - date.getHours() + + `${date.getHours()}`.padStart(2, "0") + ":" + - date.getMinutes() + `${date.getMinutes()}`.padStart(2, "0") ); if (type === "dayMonth") return date.getDate() + " " + months[date.getMonth()]; diff --git a/app/components/Profile/Profile.ReleaseRatings.tsx b/app/components/Profile/Profile.ReleaseRatings.tsx index 75af80d..0808d0a 100644 --- a/app/components/Profile/Profile.ReleaseRatings.tsx +++ b/app/components/Profile/Profile.ReleaseRatings.tsx @@ -51,33 +51,31 @@ export const ProfileReleaseRatings = (props: any) => { Посмотреть все -
- - {props.ratings.map((release) => { - return ( - -
-
- -
-
-

{release.title_ru}

- - = 1} /> - = 2} /> - = 3} /> - = 4} /> - = 5} /> - -

- {unixToDate(release.voted_at, "full")} -

-
+
+ {props.ratings.map((release) => { + return ( + +
+
+
- - ); - })} - +
+

{release.title_ru}

+ + = 1} /> + = 2} /> + = 3} /> + = 4} /> + = 5} /> + +

+ {unixToDate(release.voted_at, "full")} +

+
+
+ + ); + })}
{ ); } - - const isPrivacy = - user.is_stats_hidden || user.is_counts_hidden || user.is_social_hidden; - return ( <>
@@ -73,23 +69,39 @@ export const ProfilePage = (props: any) => { ban_expires={user.ban_expires} />
-
+
{ edit_setIsOpen={setIsOpen} /> )} -
-
-
- {/*
-
- {!user.is_counts_hidden && ( { /> )} {!user.is_stats_hidden && ( -
+
{user.votes && user.votes.length > 0 && ( { profile_id={user.id} /> )} - {user.history && user.history.length > 0 && ( - - )}
)}
-
- +
{!user.is_stats_hidden && ( <> { profile_id={user.id} /> -
+
{user.votes && user.votes.length > 0 && ( { profile_id={user.id} /> )} - {user.history && user.history.length > 0 && ( - - )}
+ {user.history && user.history.length > 0 && ( + + )} )}
-
*/} +
Date: Thu, 3 Apr 2025 21:59:18 +0500 Subject: [PATCH 03/12] refactor: user recently watched --- .../Profile/Profile.ReleaseHistory.tsx | 106 +++++++++++------- .../Profile/Profile.ReleaseRatings.tsx | 29 +---- 2 files changed, 69 insertions(+), 66 deletions(-) diff --git a/app/components/Profile/Profile.ReleaseHistory.tsx b/app/components/Profile/Profile.ReleaseHistory.tsx index b579c11..2401f32 100644 --- a/app/components/Profile/Profile.ReleaseHistory.tsx +++ b/app/components/Profile/Profile.ReleaseHistory.tsx @@ -1,49 +1,79 @@ -import { Card, Carousel } from "flowbite-react"; -import type { - FlowbiteCarouselIndicatorsTheme, - FlowbiteCarouselControlTheme, - CustomFlowbiteTheme, -} from "flowbite-react"; -import { ReleaseLink } from "../ReleaseLink/ReleaseLinkUpdate"; +import { Card } from "flowbite-react"; -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", -}; +import { ReleaseChips } from "../ReleasePoster/Chips"; +import { Poster } from "../ReleasePoster/Poster"; +import Link from "next/link"; -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-[375px]", - }, - indicators: CarouselIndicatorsTheme, - control: CarouselControlsTheme, +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 ProfileReleaseHistory = (props: any) => { return (

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

-
- - {props.history.map((release) => { - return ( - - ); - })} - +
+ {props.history.map((release) => { + 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 ( + +
+
+ +
+
+ +
+ {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} +

+ )} +
+
+ + ); + })}
); diff --git a/app/components/Profile/Profile.ReleaseRatings.tsx b/app/components/Profile/Profile.ReleaseRatings.tsx index 0808d0a..ffdeee9 100644 --- a/app/components/Profile/Profile.ReleaseRatings.tsx +++ b/app/components/Profile/Profile.ReleaseRatings.tsx @@ -1,16 +1,11 @@ import { Card, - Carousel, RatingStar, Rating, Modal, Button, } from "flowbite-react"; -import type { - FlowbiteCarouselIndicatorsTheme, - FlowbiteCarouselControlTheme, -} from "flowbite-react"; -import Image from "next/image"; + import { unixToDate, useSWRfetcher } from "#/api/utils"; import Link from "next/link"; import { useCallback, useEffect, useState } from "react"; @@ -19,28 +14,6 @@ import useSWRInfinite from "swr/infinite"; import { Spinner } from "../Spinner/Spinner"; import { Poster } from "../ReleasePoster/Poster"; -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", - }, - base: "h-3 w-3 rounded-full", - 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", -}; - -const CarouselTheme = { - root: { - base: "relative h-full w-full max-w-[700px]", - }, - indicators: CarouselIndicatorsTheme, - control: CarouselControlsTheme, -}; - export const ProfileReleaseRatings = (props: any) => { const [modal, setModal] = useState(false); return ( From 4aa48f589bc624d4ad914084bbb0ee04ef1aa1c4 Mon Sep 17 00:00:00 2001 From: Radiquum Date: Thu, 3 Apr 2025 22:10:58 +0500 Subject: [PATCH 04/12] small changes --- .../Profile/Profile.ReleaseRatings.tsx | 6 +- app/components/Profile/Profile.User.tsx | 118 +++++++++--------- app/pages/Profile.tsx | 3 +- 3 files changed, 65 insertions(+), 62 deletions(-) diff --git a/app/components/Profile/Profile.ReleaseRatings.tsx b/app/components/Profile/Profile.ReleaseRatings.tsx index ffdeee9..c93e69f 100644 --- a/app/components/Profile/Profile.ReleaseRatings.tsx +++ b/app/components/Profile/Profile.ReleaseRatings.tsx @@ -28,12 +28,12 @@ export const ProfileReleaseRatings = (props: any) => { {props.ratings.map((release) => { return ( -
+
-
-

{release.title_ru}

+
+

{release.title_ru}

= 1} /> = 2} /> diff --git a/app/components/Profile/Profile.User.tsx b/app/components/Profile/Profile.User.tsx index e2033cc..538cd62 100644 --- a/app/components/Profile/Profile.User.tsx +++ b/app/components/Profile/Profile.User.tsx @@ -27,6 +27,7 @@ interface ProfileUserProps { inst: string; discord: string; }; + is_social_hidden: boolean; } export const ProfileUser = ({ @@ -41,8 +42,8 @@ export const ProfileUser = ({ isSponsor, isBlocked, socials, + is_social_hidden, }: ProfileUserProps) => { - const theme = useThemeMode().mode; return ( @@ -88,65 +89,66 @@ export const ProfileUser = ({

{status}

- {(socials.vk || - socials.tg || - socials.discord || - socials.tt || - socials.inst) && ( -
- {socials.vk && ( - + {!is_social_hidden && + (socials.vk || + socials.tg || + socials.discord || + socials.tt || + socials.inst) && ( +
+ {socials.vk && ( + + + + )} + {socials.tg && ( + + + + )} + {socials.tt && ( + + + + )} + {socials.inst && ( + + + + )} + {socials.discord && ( - - )} - {socials.tg && ( - - - - )} - {socials.tt && ( - - - - )} - {socials.inst && ( - - - - )} - {socials.discord && ( - - )} -
- )} + )} +
+ )} ); }; diff --git a/app/pages/Profile.tsx b/app/pages/Profile.tsx index 6e5d043..77ce5f1 100644 --- a/app/pages/Profile.tsx +++ b/app/pages/Profile.tsx @@ -88,7 +88,7 @@ export const ProfilePage = (props: any) => { ) ? "mt-4" : "" - }`} + } mb-4`} >
{ inst: user.inst_page || null, discord: user.discord_page || null, }} + is_social_hidden={user.is_social_hidden} /> {authUser.token && ( Date: Thu, 3 Apr 2025 22:56:07 +0500 Subject: [PATCH 05/12] feat: add view of user blocklist --- app/api/config.ts | 1 + .../Profile/Profile.BlockedUsersModal.tsx | 177 ++++++++++++++++++ app/components/Profile/Profile.EditModal.tsx | 17 +- 3 files changed, 193 insertions(+), 2 deletions(-) create mode 100644 app/components/Profile/Profile.BlockedUsersModal.tsx diff --git a/app/api/config.ts b/app/api/config.ts index d3a25d0..a4fc159 100644 --- a/app/api/config.ts +++ b/app/api/config.ts @@ -18,6 +18,7 @@ export const ENDPOINTS = { bookmark: `${API_PREFIX}/profile/list`, history: `${API_PREFIX}/history`, favorite: `${API_PREFIX}/favorite`, + blocklist: `${API_PREFIX}/profile/blocklist`, settings: { my: `${API_PREFIX}/profile/preference/my`, login: { diff --git a/app/components/Profile/Profile.BlockedUsersModal.tsx b/app/components/Profile/Profile.BlockedUsersModal.tsx new file mode 100644 index 0000000..d127a87 --- /dev/null +++ b/app/components/Profile/Profile.BlockedUsersModal.tsx @@ -0,0 +1,177 @@ +import { ENDPOINTS } from "#/api/config"; +import { tryCatchAPI, unixToDate, useSWRfetcher } from "#/api/utils"; +import { Avatar, Button, Modal, useThemeMode } from "flowbite-react"; +import { useCallback, useEffect, useState } from "react"; +import useSWRInfinite from "swr/infinite"; +import { Spinner } from "../Spinner/Spinner"; +import { toast } from "react-toastify"; + +export const ProfileBlockedUsersModal = (props: { + isOpen: boolean; + setIsOpen: (isOpen: boolean) => void; + token: string; + profile_id: number; +}) => { + const [currentRef, setCurrentRef] = useState(null); + const theme = useThemeMode(); + const [actionsDisabled, setActionsDisabled] = useState(false); + const [unblockedUsers, setUnblockedUsers] = useState([]); + + const modalRef = useCallback((ref) => { + setCurrentRef(ref); + }, []); + + const getKey = (pageIndex: number, previousPageData: any) => { + if (previousPageData && !previousPageData.content.length) return null; + let url = `${ENDPOINTS.user.blocklist}/all/${pageIndex}?token=${props.token}`; + return url; + }; + + const { data, error, isLoading, size, setSize } = useSWRInfinite( + getKey, + useSWRfetcher, + { initialSize: 2 } + ); + + async function _addToBlocklist(profile_id) { + setActionsDisabled(true); + + const tid = toast.loading( + unblockedUsers.includes(profile_id) ? + "Блокируем пользователя..." + : "Разблокируем пользователя...", + { + position: "bottom-center", + hideProgressBar: true, + closeOnClick: false, + pauseOnHover: false, + draggable: false, + theme: theme.mode == "light" ? "light" : "dark", + } + ); + + let url = `${ENDPOINTS.user.blocklist}`; + unblockedUsers.includes(profile_id) ? + (url += "/add/") + : (url += "/remove/"); + url += `${profile_id}?token=${props.token}`; + + const { data, error } = await tryCatchAPI(fetch(url)); + if (error) { + toast.update(tid, { + render: + unblockedUsers.includes(profile_id) ? + "Ошибка блокировки" + : "Ошибка разблокировки", + type: "error", + autoClose: 2500, + isLoading: false, + closeOnClick: true, + draggable: true, + }); + setActionsDisabled(false); + return; + } + + toast.update(tid, { + render: + unblockedUsers.includes(profile_id) ? + "Пользователь заблокирован" + : "Пользователь разблокирован", + type: "success", + autoClose: 2500, + isLoading: false, + closeOnClick: true, + draggable: true, + }); + + if (unblockedUsers.includes(profile_id)) { + setUnblockedUsers((prev) => { + return prev.filter((item) => item !== profile_id); + }); + } else { + setUnblockedUsers((prev) => { + return [...prev, profile_id]; + }); + } + setActionsDisabled(false); + } + + const [content, setContent] = useState([]); + useEffect(() => { + if (data) { + let allReleases = []; + for (let i = 0; i < data.length; i++) { + allReleases.push(...data[i].content); + } + setContent(allReleases); + } + }, [data]); + + const [scrollPosition, setScrollPosition] = useState(0); + function handleScroll() { + const height = currentRef.scrollHeight - currentRef.clientHeight; + const windowScroll = currentRef.scrollTop; + const scrolled = (windowScroll / height) * 100; + setScrollPosition(Math.floor(scrolled)); + } + + useEffect(() => { + if (scrollPosition >= 95 && scrollPosition <= 96) { + setSize(size + 1); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [scrollPosition]); + return ( + <> + props.setIsOpen(false)} + size={"7xl"} + > + Заблокированные пользователи +
+ {content && content.length > 0 ? + content.map((user) => { + return ( +
+
+ +
+

{user.login}

+

Заблокирован: {unixToDate(user.added_date, "full")}

+
+
+ +
+ ); + }) + : "Нет заблокированных пользователей"} + {isLoading && } +
+
+ + ); +}; diff --git a/app/components/Profile/Profile.EditModal.tsx b/app/components/Profile/Profile.EditModal.tsx index 897f3a7..3b01f0b 100644 --- a/app/components/Profile/Profile.EditModal.tsx +++ b/app/components/Profile/Profile.EditModal.tsx @@ -14,6 +14,7 @@ import { useSWRConfig } from "swr"; import { useUserStore } from "#/store/auth"; import { ProfileEditLoginModal } from "./Profile.EditLoginModal"; import { toast } from "react-toastify"; +import { ProfileBlockedUsersModal } from "./Profile.BlockedUsersModal"; export const ProfileEditModal = (props: { isOpen: boolean; @@ -25,6 +26,7 @@ export const ProfileEditModal = (props: { const [statusModalOpen, setStatusModalOpen] = useState(false); const [socialModalOpen, setSocialModalOpen] = useState(false); const [loginModalOpen, setLoginModalOpen] = useState(false); + const [blockedModalOpen, setBlockedModalOpen] = useState(false); const [privacyModalSetting, setPrivacyModalSetting] = useState("none"); const [privacySettings, setPrivacySettings] = useState({ privacy_stats: 9, @@ -355,13 +357,18 @@ export const ProfileEditModal = (props: { }

- {/* */} +
@@ -431,6 +438,12 @@ export const ProfileEditModal = (props: { setLogin={setLogin} profile_id={props.profile_id} /> + : ""} From 329448c9fca8e5c10bdb4e9ecf11e123dd456a14 Mon Sep 17 00:00:00 2001 From: Radiquum Date: Fri, 4 Apr 2025 00:29:19 +0500 Subject: [PATCH 06/12] chore: migrate to new flowbite-react --- .flowbite-react/.gitignore | 2 + .flowbite-react/config.json | 9 + app/App.tsx | 12 +- .../ChangelogModal/ChangelogModal.tsx | 28 +- app/components/Comments/Comments.Add.tsx | 12 +- app/components/Comments/Comments.Comment.tsx | 10 +- app/components/Comments/Comments.Edit.tsx | 12 +- app/components/Comments/Comments.Main.tsx | 6 +- app/components/CropModal/CropModal.tsx | 12 +- .../Profile/Profile.BlockedUsersModal.tsx | 4 +- .../Profile/Profile.EditLoginModal.tsx | 12 +- app/components/Profile/Profile.EditModal.tsx | 8 +- .../Profile/Profile.EditPrivacyModal.tsx | 8 +- .../Profile/Profile.EditSocialModal.tsx | 31 +- .../Profile/Profile.EditStatusModal.tsx | 12 +- .../Profile/Profile.ReleaseRatings.tsx | 10 +- .../ReleaseInfo/ReleaseInfo.Info.tsx | 78 ++-- .../ReleaseInfo/ReleaseInfo.Rating.tsx | 132 ++++--- .../ReleaseInfo/ReleaseInfo.UserList.tsx | 8 +- .../ReleasePlayer/ReleasePlayer.tsx | 10 +- .../ReleasePlayer/SourceSelector.tsx | 6 +- .../ReleasePlayer/VoiceoverSelector.tsx | 10 +- .../SettingsModal/SettingsModal.tsx | 42 ++- app/pages/BookmarksCategory.tsx | 10 +- app/pages/CreateCollection.tsx | 25 +- app/pages/Favorites.tsx | 6 +- app/pages/IndexCategory.tsx | 6 +- app/pages/Search.tsx | 24 +- next.config.js | 71 ++-- package-lock.json | 357 +++++++++++++++--- package.json | 7 +- tailwind.config.js | 14 +- 32 files changed, 650 insertions(+), 344 deletions(-) create mode 100644 .flowbite-react/.gitignore create mode 100644 .flowbite-react/config.json diff --git a/.flowbite-react/.gitignore b/.flowbite-react/.gitignore new file mode 100644 index 0000000..da26dfd --- /dev/null +++ b/.flowbite-react/.gitignore @@ -0,0 +1,2 @@ +class-list.json +pid \ No newline at end of file diff --git a/.flowbite-react/config.json b/.flowbite-react/config.json new file mode 100644 index 0000000..d04ad92 --- /dev/null +++ b/.flowbite-react/config.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://unpkg.com/flowbite-react/schema.json", + "components": [], + "dark": true, + "prefix": "", + "path": "src/components", + "tsx": true, + "rsc": true +} \ No newline at end of file diff --git a/app/App.tsx b/app/App.tsx index 69d1288..3733cd1 100644 --- a/app/App.tsx +++ b/app/App.tsx @@ -4,7 +4,7 @@ import { usePreferencesStore } from "./store/preferences"; import { Navbar } from "./components/Navbar/NavbarUpdate"; import { Inter } from "next/font/google"; import { useEffect, useState } from "react"; -import { Button, Modal } from "flowbite-react"; +import { Button, Modal, ModalBody, ModalFooter, ModalHeader } from "flowbite-react"; import { Spinner } from "./components/Spinner/Spinner"; import { ChangelogModal } from "#/components/ChangelogModal/ChangelogModal"; import PlausibleProvider from "next-plausible"; @@ -80,8 +80,8 @@ export const App = (props) => { show={preferencesStore.params.isFirstLaunch} onClose={() => preferencesStore.setParams({ isFirstLaunch: false })} > - Внимание - + Внимание +

Данный сайт не связан с разработчиками приложения Anixart, это неофициальная имплементация веб клиента для этого приложения. @@ -94,15 +94,15 @@ export const App = (props) => { На сайте могут присутствовать ошибки и не доработки, а так-же отсутствующий функционал.

-
- + + - + {preferencesStore.flags.enableAnalytics && ( props.setIsOpen(false)}> - Список изменений v{props.version} - + Список изменений v{props.version} + {currentVersionChangelog} @@ -46,8 +54,8 @@ export const ChangelogModal = (props: { {props.previousVersions.length > 0 && props.previousVersions.map((version) => { return ( - - + { if (!previousVersionsChangelog.hasOwnProperty(version)) { _fetchVersionChangelog(version).then((data) => { @@ -62,19 +70,19 @@ export const ChangelogModal = (props: { }} > Список изменений v{version} - - + + {previousVersionsChangelog.hasOwnProperty(version) ? {previousVersionsChangelog[version]} :
Загрузка ...
} -
-
+ + ); })} -
+ ); }; diff --git a/app/components/Comments/Comments.Add.tsx b/app/components/Comments/Comments.Add.tsx index 66ffee8..edec270 100644 --- a/app/components/Comments/Comments.Add.tsx +++ b/app/components/Comments/Comments.Add.tsx @@ -1,4 +1,4 @@ -import { Button, Modal, ToggleSwitch, Label, Textarea } from "flowbite-react"; +import { Button, Label, Modal, ModalBody, ModalHeader, Textarea, ToggleSwitch } from "flowbite-react"; import { CommentsComment } from "./Comments.Comment"; import { useState } from "react"; import { ENDPOINTS } from "#/api/config"; @@ -68,12 +68,12 @@ export const CommentsAddModal = (props: { show={props.isOpen} onClose={() => props.setIsOpen(false)} > - +

{props.isReply ? "Ответ на комментарий" : "Оставить комментарий"}

-
- + + {props.isReply && (
_sendComment(e)}>
-