Show own status in sidebar footer, remove Recent Notes (#450)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Wes
2026-05-02 00:42:30 +00:00
committed by GitHub
co-authored by Claude Opus 4.6
parent 56f5062b74
commit 04605e1dc4
4 changed files with 12 additions and 53 deletions
-21
View File
@@ -1,7 +1,6 @@
import { useEffect } from "react";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { getUserNotes } from "@/shared/api/social";
import {
getProfile,
searchUsers,
@@ -12,7 +11,6 @@ import {
import type {
Profile,
UpdateProfileInput,
UserNotesResponse,
UserSearchResult,
UsersBatchResponse,
} from "@/shared/api/types";
@@ -75,25 +73,6 @@ export function useUsersBatchQuery(
return query;
}
export function useUserNotesQuery(
pubkey?: string,
options?: {
enabled?: boolean;
limit?: number;
},
) {
const resolvedPubkey = typeof pubkey === "string" ? pubkey : "";
const enabled = (options?.enabled ?? true) && resolvedPubkey.length > 0;
return useQuery<UserNotesResponse>({
enabled,
queryKey: ["user-notes", resolvedPubkey.toLowerCase(), options?.limit ?? 3],
queryFn: () => getUserNotes(resolvedPubkey, { limit: options?.limit ?? 3 }),
staleTime: 60_000,
gcTime: 5 * 60 * 1_000,
});
}
export function useUserSearchQuery(
query: string,
options?: {
@@ -1,10 +1,7 @@
import * as React from "react";
import { Activity } from "lucide-react";
import {
useUserNotesQuery,
useUserProfileQuery,
} from "@/features/profile/hooks";
import { useUserProfileQuery } from "@/features/profile/hooks";
import {
useRelayAgentsQuery,
useManagedAgentsQuery,
@@ -12,7 +9,6 @@ import {
import { usePresenceQuery } from "@/features/presence/hooks";
import { useUserStatusQuery } from "@/features/user-status/hooks";
import { PresenceBadge } from "@/features/presence/ui/PresenceBadge";
import { formatRelativeTime } from "@/features/forum/lib/time";
import { rewriteRelayUrl } from "@/shared/lib/mediaUrl";
import { useAgentSession } from "@/shared/context/AgentSessionContext";
@@ -63,9 +59,6 @@ export function UserProfilePopover({
}: UserProfilePopoverProps) {
const [open, setOpen] = React.useState(false);
const profileQuery = useUserProfileQuery(open ? pubkey : undefined);
const notesQuery = useUserNotesQuery(open ? pubkey : undefined, {
limit: 1,
});
const relayAgentsQuery = useRelayAgentsQuery({
enabled: open && role === "bot",
});
@@ -87,7 +80,6 @@ export function UserProfilePopover({
managedAgent?.backend.type === "local" &&
Boolean(onOpenAgentSession);
const profile = profileQuery.data;
const latestNote = (notesQuery.data?.notes ?? [])[0] ?? null;
const presenceStatus = presenceQuery.data?.[pubkey.toLowerCase()];
const userStatus = userStatusQuery.data?.[pubkey.toLowerCase()];
@@ -152,20 +144,6 @@ export function UserProfilePopover({
</p>
) : null}
{!notesQuery.isLoading && !notesQuery.isError && latestNote ? (
<div
className="rounded-lg bg-muted/30 px-3 py-2"
data-testid="user-profile-latest-note"
>
<p className="line-clamp-2 text-xs text-foreground">
{latestNote.content}
</p>
<p className="mt-1 text-[10px] text-muted-foreground/70">
{formatRelativeTime(latestNote.createdAt)}
</p>
</div>
) : null}
{role === "bot" && (managedAgent || relayAgent) ? (
<div className="flex flex-wrap gap-1.5">
{managedAgent?.agentCommand ? (
@@ -202,12 +180,6 @@ export function UserProfilePopover({
View activity log
</button>
) : null}
{notesQuery.isError ? (
<p className="text-xs text-muted-foreground">
Recent notes are unavailable right now.
</p>
) : null}
</div>
</PopoverContent>
</Popover>
@@ -576,6 +576,14 @@ export function AppSidebar({
>
{resolvedDisplayName}
</p>
{selfUserStatus?.text || selfUserStatus?.emoji ? (
<p className="truncate text-xs text-sidebar-foreground/50">
{selfUserStatus.emoji ? (
<span className="mr-1">{selfUserStatus.emoji}</span>
) : null}
{selfUserStatus.text}
</p>
) : null}
</div>
</div>
</SidebarMenuButton>
+3 -3
View File
@@ -142,9 +142,9 @@ test("clicking author name opens user profile popover", async ({ page }) => {
const popover = page.locator("[data-radix-popper-content-wrapper]");
await expect(popover).toBeVisible();
await expect(popover).toContainText("deadbeef");
await expect(page.getByTestId("user-profile-latest-note")).toContainText(
"Shipped the new desktop sidebar polish today.",
);
// Notes section removed — user status replaces it.
// Verify the popover is still functional (pubkey visible confirms data loaded).
await expect(popover).toContainText("deadbeef");
});
test("clicking avatar opens user profile popover", async ({ page }) => {