Skip to content

Commit 48994e0

Browse files
tellahonpub14vtk7pvazqrq9639qu7e560wnqtl0d53ca4gjuvq6jzf3k2el23qqlwa7ftho
authored
chore(Pulse): gate Follow button behind Pulse feature flag (#1019)
Signed-off-by: tho <80c5f18be5aafa62cf6198c6335963ba3306b595288117c8ea2f805fc9bdc94a@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub14vtk7pvazqrq9639qu7e560wnqtl0d53ca4gjuvq6jzf3k2el23qqlwa7f <ab176f059d100602ea25073d9a69ee9817f7b691c76a897180d48498d959faa2@sprout-oss.stage.blox.sqprod.co> Co-authored-by: tho <80c5f18be5aafa62cf6198c6335963ba3306b595288117c8ea2f805fc9bdc94a@sprout-oss.stage.blox.sqprod.co>
1 parent b7e22f4 commit 48994e0

1 file changed

Lines changed: 20 additions & 28 deletions

File tree

‎desktop/src/features/profile/ui/UserProfilePanelSections.tsx‎

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import { ProfileAvatar } from "@/features/profile/ui/ProfileAvatar";
3838
import { StatusEmoji } from "@/features/user-status/ui/StatusEmoji";
3939
import { BotIdenticon } from "@/features/messages/ui/BotIdenticon";
4040
import type { ManagedAgent, RelayAgent } from "@/shared/api/types";
41+
import { useFeatureEnabled } from "@/shared/features";
4142
import { cn } from "@/shared/lib/cn";
4243
import { useNow } from "@/shared/lib/useNow";
4344
import { Badge } from "@/shared/ui/badge";
@@ -430,38 +431,29 @@ function ProfilePrimaryActions({
430431
pubkey: string;
431432
unfollowMutation: ReturnType<typeof useUnfollowMutation>;
432433
}) {
434+
const showFollowAction = useFeatureEnabled("pulse");
435+
const followToggleMutation = isFollowing ? unfollowMutation : followMutation;
436+
437+
const handleFollowClick = () => {
438+
followToggleMutation.mutate(pubkey, {
439+
onError: (error) =>
440+
toast.error(
441+
`${isFollowing ? "Unfollow" : "Follow"} failed: ${error.message}`,
442+
),
443+
});
444+
};
445+
433446
return (
434447
<div className="flex items-start justify-center gap-8">
435-
{isFollowing ? (
436-
<ProfileQuickAction
437-
active
438-
disabled={unfollowMutation.isPending}
439-
icon={UserMinus}
440-
label="Unfollow"
441-
onClick={() =>
442-
unfollowMutation.mutate(pubkey, {
443-
onError: (error) =>
444-
toast.error(
445-
`Unfollow failed: ${error instanceof Error ? error.message : String(error)}`,
446-
),
447-
})
448-
}
449-
/>
450-
) : (
448+
{showFollowAction ? (
451449
<ProfileQuickAction
452-
disabled={followMutation.isPending}
453-
icon={UserPlus}
454-
label="Follow"
455-
onClick={() =>
456-
followMutation.mutate(pubkey, {
457-
onError: (error) =>
458-
toast.error(
459-
`Follow failed: ${error instanceof Error ? error.message : String(error)}`,
460-
),
461-
})
462-
}
450+
active={isFollowing}
451+
disabled={followToggleMutation.isPending}
452+
icon={isFollowing ? UserMinus : UserPlus}
453+
label={isFollowing ? "Unfollow" : "Follow"}
454+
onClick={handleFollowClick}
463455
/>
464-
)}
456+
) : null}
465457
{onMessage ? (
466458
<ProfileQuickAction
467459
icon={MessageSquare}

0 commit comments

Comments
 (0)