Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions desktop/src/features/profile/ui/UserProfilePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
import { EditAgentDialog } from "@/features/agents/ui/EditAgentDialog";
import { useChannelsQuery } from "@/features/channels/hooks";
import { usePresenceQuery } from "@/features/presence/hooks";
import { useFeatureEnabled } from "@/shared/features";
import {
useContactListQuery,
useFollowMutation,
Expand Down Expand Up @@ -183,6 +184,12 @@ export function UserProfilePanel({
const isSelf =
currentPubkey !== undefined && pubkeyLower === currentPubkey.toLowerCase();
const canViewActivity = isOwner === true && Boolean(onOpenAgentSession);
// The people-follow graph (kind:3) is only surfaced for consumption inside
// Pulse. When Pulse is off there's nowhere to consume the graph, so we hide
// the Follow affordance entirely rather than let users write follows that go
// nowhere. (Thread-following in features/messages is unrelated localStorage
// state and is not gated here.)
const showFollowAction = useFeatureEnabled("pulse");
const isFollowing =
!isSelf &&
(contactListQuery.data?.contacts.some(
Expand Down Expand Up @@ -320,6 +327,7 @@ export function UserProfilePanel({
profile={profile}
pubkey={pubkey}
relayAgent={relayAgent}
showFollowAction={showFollowAction}
unfollowMutation={unfollowMutation}
userStatus={userStatus}
/>
Expand Down
67 changes: 37 additions & 30 deletions desktop/src/features/profile/ui/UserProfilePanelSections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export type ProfileSummaryViewProps = {
profile: ReturnType<typeof useUserProfileQuery>["data"];
pubkey: string;
relayAgent: RelayAgent | undefined;
showFollowAction: boolean;
unfollowMutation: ReturnType<typeof useUnfollowMutation>;
userStatus: { text: string; emoji: string } | null | undefined;
};
Expand Down Expand Up @@ -113,6 +114,7 @@ export function ProfileSummaryView({
profile,
pubkey,
relayAgent,
showFollowAction,
unfollowMutation,
userStatus,
}: ProfileSummaryViewProps) {
Expand Down Expand Up @@ -157,6 +159,7 @@ export function ProfileSummaryView({
isFollowing={isFollowing}
onMessage={onOpenDm ? handleMessage : undefined}
pubkey={pubkey}
showFollowAction={showFollowAction}
unfollowMutation={unfollowMutation}
/>
) : null}
Expand Down Expand Up @@ -372,6 +375,7 @@ function ProfilePrimaryActions({
onEditAgent,
onMessage,
pubkey,
showFollowAction,
unfollowMutation,
}: {
canEditAgent: boolean;
Expand All @@ -380,40 +384,43 @@ function ProfilePrimaryActions({
onEditAgent: () => void;
onMessage?: () => void;
pubkey: string;
showFollowAction: boolean;
unfollowMutation: ReturnType<typeof useUnfollowMutation>;
}) {
return (
<div className="flex items-start justify-center gap-8">
{isFollowing ? (
<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)}`,
),
})
}
/>
) : (
<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)}`,
),
})
}
/>
)}
{showFollowAction ? (
isFollowing ? (
<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)}`,
),
})
}
/>
) : (
<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}
Expand Down
Loading