diff --git a/app/components/CollectionLink/CollectionLink.tsx b/app/components/CollectionLink/CollectionLink.tsx index 61371e1..4b45fe8 100644 --- a/app/components/CollectionLink/CollectionLink.tsx +++ b/app/components/CollectionLink/CollectionLink.tsx @@ -49,13 +49,11 @@ export const CollectionLink = (props: any) => { {props.title}

- {props.description && ( -

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

- )} +

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

diff --git a/app/components/Profile/Profile.Activity.tsx b/app/components/Profile/Profile.Activity.tsx index 9438cec..8768363 100644 --- a/app/components/Profile/Profile.Activity.tsx +++ b/app/components/Profile/Profile.Activity.tsx @@ -1,98 +1,49 @@ "use client"; -import { Button, ButtonGroup, Card } from "flowbite-react"; -// import Link from "next/link"; -// import { numberDeclension } from "#/api/utils"; -import { ProfileActivityCollections } from "./Profile.ActivityCollections"; -import { useEffect, useState } from "react"; -import { CollectionCourusel } from "../CollectionCourusel/CollectionCourusel"; -import { ProfileActivityFriends } from "./Profile.ActivityFriends"; +import { Card } from "flowbite-react"; +import Link from "next/link"; +import { numberDeclension } from "#/api/utils"; export function ProfileActivity(props: { profile_id: number; commentCount: number; videoCount: number; collectionCount: number; - collectionPreview: any; friendsCount: number; - friendsPreview: any; }) { - const [tab, setTab] = useState< - "collections" | "comments" | "friends" | "videos" - >("collections"); - - const [collections, setCollections] = useState>({}); - - function _setCollection(array: any[]) { - if (array && array.length == 0) { - return; - } - let _coll = array.filter((col) => { - if (typeof col == "number") { - return false; - } - return true; - }); - _coll.map((col) => { - setCollections((prev) => { - return { - ...prev, - [col.id]: col, - }; - }); - - if ( - col.creator.collections_preview && - col.creator.collections_preview.length > 0 - ) { - _setCollection(col.creator.collections_preview || []); - } - }); - } - - useEffect(() => { - _setCollection(props.collectionPreview || []); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [props.collectionPreview]); - return ( - +

Активность

- - - - - - - - {tab == "collections" && ( - - )} - {tab == "comments" && <>comments} - {tab == "friends" && } - {tab == "videos" && <>videos} +
+
+

+ {props.commentCount}{" "} + {numberDeclension( + props.commentCount, + "комментарий", + "комментария", + "комментариев" + )} +

+

{props.videoCount} видео

+
+
+ +

+ {props.collectionCount}{" "} + {numberDeclension( + props.commentCount, + "коллекция", + "коллекции", + "коллекций" + )} +

+ +

+ {props.friendsCount}{" "} + {numberDeclension(props.commentCount, "друзей", "друга", "друзей")} +

+
+
); } diff --git a/app/components/Profile/Profile.ActivityCollections.tsx b/app/components/Profile/Profile.ActivityCollections.tsx deleted file mode 100644 index 42e0fe7..0000000 --- a/app/components/Profile/Profile.ActivityCollections.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import { Swiper, SwiperSlide } from "swiper/react"; -import "swiper/css"; -import "swiper/css/navigation"; -import "swiper/css/mousewheel"; -import "swiper/css/scrollbar"; -import { Navigation, Mousewheel, Scrollbar } from "swiper/modules"; -import { CollectionLink } from "../CollectionLink/CollectionLink"; -import Link from "next/link"; - -export const ProfileActivityCollections = (props: { - content: any; - profile_id: number; -}) => { - return ( -
- - {props.content && - props.content.length > 0 && - props.content.map((collection) => { - return ( - - -
- -
- -
- ); - })} - - {props.content && props.content.length > 0 ? - - -
- -

Все коллекции

-
- -
- :

У пользователя нет коллекций

} -
-
- ); -}; diff --git a/app/components/Profile/Profile.ActivityFriends.tsx b/app/components/Profile/Profile.ActivityFriends.tsx deleted file mode 100644 index 78e2ac2..0000000 --- a/app/components/Profile/Profile.ActivityFriends.tsx +++ /dev/null @@ -1,70 +0,0 @@ -import { Swiper, SwiperSlide } from "swiper/react"; -import "swiper/css"; -import "swiper/css/navigation"; -import "swiper/css/mousewheel"; -import "swiper/css/scrollbar"; -import { Navigation, Mousewheel, Scrollbar } from "swiper/modules"; -import { CollectionLink } from "../CollectionLink/CollectionLink"; -import Link from "next/link"; -import { Avatar, Button } from "flowbite-react"; - -export const ProfileActivityFriends = (props: { content: any }) => { - return ( -
- - {props.content && - props.content.length > 0 && - props.content.map((profile) => { - return ( - - -
- -

{profile.login}

-
- -
- ); - })} - {props.content && props.content.length > 0 ? - - - - :

У пользователя нет друзей

} -
-
- ); -}; diff --git a/app/pages/Profile.tsx b/app/pages/Profile.tsx index 5721be6..77ce5f1 100644 --- a/app/pages/Profile.tsx +++ b/app/pages/Profile.tsx @@ -131,9 +131,7 @@ export const ProfilePage = (props: any) => { commentCount={user.comment_count} videoCount={user.video_count} collectionCount={user.collection_count} - collectionPreview={user.collections_preview || []} friendsCount={user.friend_count} - friendsPreview={user.friends_preview || []} /> )} {!user.is_stats_hidden && (