diff --git a/apps/renderer/src/modules/profile/user-profile-modal.tsx b/apps/renderer/src/modules/profile/user-profile-modal.tsx index 876c01f73..2a97917ec 100644 --- a/apps/renderer/src/modules/profile/user-profile-modal.tsx +++ b/apps/renderer/src/modules/profile/user-profile-modal.tsx @@ -1,15 +1,16 @@ import { env } from "@follow/shared/env" -import { useAnimationControls } from "framer-motion" +import { AnimatePresence, useAnimationControls } from "framer-motion" import { useAtom } from "jotai" import { atomWithStorage } from "jotai/utils" import { throttle } from "lodash-es" import type { FC } from "react" -import { Fragment, useEffect, useMemo, useRef, useState } from "react" +import { Fragment, memo, useEffect, useMemo, useRef, useState } from "react" import { useTranslation } from "react-i18next" import { m } from "~/components/common/Motion" import { FeedIcon } from "~/components/feed-icon" import { FollowIcon } from "~/components/icons/follow" +import { AutoResizeHeight } from "~/components/ui/auto-resize-height" import { Avatar, AvatarFallback, AvatarImage } from "~/components/ui/avatar" import { ActionButton, Button } from "~/components/ui/button" import { LoadingCircle, LoadingWithIcon } from "~/components/ui/loading" @@ -298,20 +299,12 @@ export const UserProfileModalContent: FC<{ ) : ( subscriptions.data && Object.keys(subscriptions.data).map((category) => ( -
-
-

{category}

-
-
- {subscriptions.data?.[category].map((subscription) => ( - - ))} -
-
+ )) )} @@ -324,6 +317,46 @@ export const UserProfileModalContent: FC<{ ) } +const SubscriptionGroup: FC<{ + category: string + subscriptions: SubscriptionModel[] + itemStyle: ItemVariant +}> = memo(({ category, subscriptions, itemStyle }) => { + const [isOpened, setIsOpened] = useState(true) + return ( +
+ + + + {isOpened && ( + + {subscriptions.map((subscription) => ( + + ))} + + )} + + +
+ ) +}) + const SubscriptionItem: FC<{ subscription: SubscriptionModel @@ -334,7 +367,8 @@ const SubscriptionItem: FC<{ const { present } = useModalStack() const isLoose = variant === "loose" return ( -
@@ -391,6 +425,6 @@ const SubscriptionItem: FC<{
- + ) }