From 688cf43b8a4aa44a05fa174d2c9c7a197f08ec1e Mon Sep 17 00:00:00 2001 From: Innei Date: Sun, 28 Jul 2024 16:18:46 +0800 Subject: [PATCH] fix: update user profile modal edit or add follow Signed-off-by: Innei --- .../modules/profile/user-profile-modal.tsx | 122 ++++++++++-------- 1 file changed, 65 insertions(+), 57 deletions(-) diff --git a/src/renderer/src/modules/profile/user-profile-modal.tsx b/src/renderer/src/modules/profile/user-profile-modal.tsx index cd0849d89..fa2044c34 100644 --- a/src/renderer/src/modules/profile/user-profile-modal.tsx +++ b/src/renderer/src/modules/profile/user-profile-modal.tsx @@ -16,7 +16,11 @@ import { defineQuery } from "@renderer/lib/defineQuery" import { nextFrame } from "@renderer/lib/dom" import type { FeedViewType } from "@renderer/lib/enum" import { cn } from "@renderer/lib/utils" +import type { SubscriptionModel } from "@renderer/models" import { useUserSubscriptionsQuery } from "@renderer/modules/profile/hooks" +import { + useSubscriptionStore, +} from "@renderer/store/subscription" import { useAnimationControls } from "framer-motion" import type { FC } from "react" import { Fragment, useEffect, useState } from "react" @@ -42,7 +46,6 @@ export const UserProfileModalContent: FC<{ nextFrame(() => controller.start("enter")) }, [controller]) - const { present } = useModalStack() const winHeight = useState(() => window.innerHeight)[0] return ( @@ -85,7 +88,7 @@ export const UserProfileModalContent: FC<{ {user.data && ( -
+
{user.data.name?.slice(0, 2)} @@ -94,7 +97,7 @@ export const UserProfileModalContent: FC<{

{user.data.name}

-
+
{user.data.handle}
@@ -107,60 +110,10 @@ export const UserProfileModalContent: FC<{
{subscriptions.data?.[category].map((subscription) => ( - + subscription={subscription} + /> ))}
@@ -170,9 +123,64 @@ export const UserProfileModalContent: FC<{ )} {!user.data && ( - + )} ) } + +const SubscriptionItem: FC<{ + subscription: SubscriptionModel +}> = ({ subscription }) => { + const isFollowed = !!useSubscriptionStore( + (state) => state.data[subscription.feedId], + ) + const { present } = useModalStack() + return ( + + ) +}