mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
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>
This commit is contained in:
co-authored by
npub14vtk7pvazqrq9639qu7e560wnqtl0d53ca4gjuvq6jzf3k2el23qqlwa7f
tho
parent
b7e22f4b5c
commit
48994e01bc
@@ -38,6 +38,7 @@ import { ProfileAvatar } from "@/features/profile/ui/ProfileAvatar";
|
||||
import { StatusEmoji } from "@/features/user-status/ui/StatusEmoji";
|
||||
import { BotIdenticon } from "@/features/messages/ui/BotIdenticon";
|
||||
import type { ManagedAgent, RelayAgent } from "@/shared/api/types";
|
||||
import { useFeatureEnabled } from "@/shared/features";
|
||||
import { cn } from "@/shared/lib/cn";
|
||||
import { useNow } from "@/shared/lib/useNow";
|
||||
import { Badge } from "@/shared/ui/badge";
|
||||
@@ -430,38 +431,29 @@ function ProfilePrimaryActions({
|
||||
pubkey: string;
|
||||
unfollowMutation: ReturnType<typeof useUnfollowMutation>;
|
||||
}) {
|
||||
const showFollowAction = useFeatureEnabled("pulse");
|
||||
const followToggleMutation = isFollowing ? unfollowMutation : followMutation;
|
||||
|
||||
const handleFollowClick = () => {
|
||||
followToggleMutation.mutate(pubkey, {
|
||||
onError: (error) =>
|
||||
toast.error(
|
||||
`${isFollowing ? "Unfollow" : "Follow"} failed: ${error.message}`,
|
||||
),
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex items-start justify-center gap-8">
|
||||
{isFollowing ? (
|
||||
{showFollowAction ? (
|
||||
<ProfileQuickAction
|
||||
active
|
||||
disabled={unfollowMutation.isPending}
|
||||
icon={UserMinus}
|
||||
label="Unfollow"
|
||||
onClick={() =>
|
||||
unfollowMutation.mutate(pubkey, {
|
||||
onError: (error) =>
|
||||
toast.error(
|
||||
`Unfollow failed: ${error instanceof Error ? error.message : String(error)}`,
|
||||
),
|
||||
})
|
||||
}
|
||||
active={isFollowing}
|
||||
disabled={followToggleMutation.isPending}
|
||||
icon={isFollowing ? UserMinus : UserPlus}
|
||||
label={isFollowing ? "Unfollow" : "Follow"}
|
||||
onClick={handleFollowClick}
|
||||
/>
|
||||
) : (
|
||||
<ProfileQuickAction
|
||||
disabled={followMutation.isPending}
|
||||
icon={UserPlus}
|
||||
label="Follow"
|
||||
onClick={() =>
|
||||
followMutation.mutate(pubkey, {
|
||||
onError: (error) =>
|
||||
toast.error(
|
||||
`Follow failed: ${error instanceof Error ? error.message : String(error)}`,
|
||||
),
|
||||
})
|
||||
}
|
||||
/>
|
||||
)}
|
||||
) : null}
|
||||
{onMessage ? (
|
||||
<ProfileQuickAction
|
||||
icon={MessageSquare}
|
||||
|
||||
Reference in New Issue
Block a user