Open-source SEO, GEO, and marketing skills for AI agents.
feat(sidebar): refine goal row hierarchy
Yuting Zhong204dec356032
diff --git a/notfair/src/components/app-sidebar.tsx b/notfair/src/components/app-sidebar.tsxindex 81b6e850..7f832ad2 100644--- a/notfair/src/components/app-sidebar.tsx+++ b/notfair/src/components/app-sidebar.tsx@@ -23,7 +23,6 @@ import {getPinnedGoalIds,listGoals,listLiveGoals,- type GoalStatus,} from "@/server/db/goals";import { colorForAgentSlug } from "@/lib/agent-colors";import { SidebarGoalItem } from "@/components/sidebar-goal-item";@@ -50,15 +49,6 @@ const NAV: NavItem[] = [{ href: "/settings", label: "Settings", icon: Settings },];-/** Compact status dot per live goal state — the rail's only status signal.- * Closed goals never render here; their outcomes live on the board. */-const GOAL_DOT: Partial<Record<GoalStatus, string>> = {- intake: "ns-dot-warn",- proposed: "ns-dot-warn",- active: "ns-dot-live",- paused: "ns-dot-mute",-};-export async function AppSidebar() {const projects = listProjects();const active = await getActiveProject();@@ -163,7 +153,6 @@ export async function AppSidebar() {label={goalLabel(goal)}status={goal.status as "intake" | "proposed" | "active" | "paused"}pinned={pinnedIds.has(goal.id)}- dotClass={GOAL_DOT[goal.status] ?? "ns-dot-mute"}labelClass={color.label}projectSlug={active.slug}groups={groupTargets}@@ -180,7 +169,6 @@ export async function AppSidebar() {groupId={group.id}name={group.name}href={projectHref(active.slug, `/groups/${group.id}`)}- liveCount={groupGoals.length}>{groupGoals.map((goal) => {const agent = agentBySlug.get(goal.agent_id);@@ -195,7 +183,6 @@ export async function AppSidebar() {label={goalLabel(goal)}status={goal.status as "intake" | "proposed" | "active" | "paused"}pinned={pinnedIds.has(goal.id)}- dotClass={GOAL_DOT[goal.status] ?? "ns-dot-mute"}labelClass={color.label}projectSlug={active.slug}groups={groupTargets}diff --git a/notfair/src/components/sidebar-goal-group.test.tsx b/notfair/src/components/sidebar-goal-group.test.tsxindex a9b75759..2f7c025b 100644--- a/notfair/src/components/sidebar-goal-group.test.tsx+++ b/notfair/src/components/sidebar-goal-group.test.tsx@@ -44,7 +44,6 @@ function renderGroup() {groupId="g1"name="Ads MCP reliability"href="/p/groups/g1"- liveCount={2}><li>member goal row</li></SidebarGoalGroup>@@ -54,19 +53,32 @@ function renderGroup() {}describe("SidebarGoalGroup", () => {- it("shows the header with live count and its member goals expanded", () => {+ it("matches goal rows with a trailing disclosure instead of a dot or count", () => {renderGroup();const header = screen.getByRole("button", { name: /^ads mcp reliability/i });+ const label = screen.getByText("Ads MCP reliability");+ const chevron = header.querySelector("[data-group-chevron]");+expect(header).toHaveAttribute("aria-expanded", "true");- expect(screen.getByText("2")).toBeInTheDocument();+ expect(header.querySelector(".ns-dot")).toBeNull();+ expect(label.nextElementSibling).toBe(chevron);+ expect(chevron).toHaveClass("rotate-90");+ expect(screen.queryByText("2")).not.toBeInTheDocument();expect(screen.getByText("member goal row")).toBeVisible();});+ it("keeps nested goal actions on the parent row's right edge", () => {+ renderGroup();+ const sublist = screen.getByText("member goal row").closest("ul");+ expect(sublist).toHaveClass("mr-0", "pr-0");+ });+it("collapses on header click without unmounting members, and persists", () => {renderGroup();const header = screen.getByRole("button", { name: /^ads mcp reliability/i });fireEvent.click(header);expect(header).toHaveAttribute("aria-expanded", "false");+ expect(header.querySelector("[data-group-chevron]")).not.toHaveClass("rotate-90");// Hidden, not removed — member dialog state must survive collapse.expect(screen.getByText("member goal row")).not.toBeVisible();expect(window.localStorage.getItem("notfair.rail.group.g1.collapsed")).toBe("1");diff --git a/notfair/src/components/sidebar-goal-group.tsx b/notfair/src/components/sidebar-goal-group.tsxindex f841f6b9..3c28b6bc 100644--- a/notfair/src/components/sidebar-goal-group.tsx+++ b/notfair/src/components/sidebar-goal-group.tsx@@ -45,22 +45,20 @@ import { cn } from "@/lib/utils";export const GOAL_DRAG_TYPE = "application/x-notfair-goal";/**- * One goal group in the sidebar rail: a collapsible header (chevron + name +- * live-goal count) with its member goals nested beneath, a ⋮ menu (dashboard,- * rename, delete), and a drop target for goal rows dragged from the rail.+ * One goal group in the sidebar rail: a goal-style collapsible row with its+ * member goals nested beneath, a ⋮ menu (dashboard, rename, delete), and a+ * drop target for goal rows dragged from the rail.*/export function SidebarGoalGroup({groupId,name,href,- liveCount,children,}: {groupId: string;name: string;/** Group dashboard route. */href: string;- liveCount: number;children?: React.ReactNode;}) {const router = useRouter();@@ -134,17 +132,15 @@ export function SidebarGoalGroup({dragOver && "bg-sidebar-accent ring-2 ring-sidebar-ring",)}>+ <span className="truncate">{name}</span><ChevronRight+ data-group-chevronaria-hiddenclassName={cn("!size-3.5 shrink-0 text-[hsl(var(--notfair-ink-4))] transition-transform",!collapsed && "rotate-90",)}/>- <span className="truncate font-medium">{name}</span>- <span className="ml-auto text-[11px] tabular-nums text-[hsl(var(--notfair-ink-4))]">- {liveCount}- </span></SidebarMenuButton><DropdownMenu>@@ -183,7 +179,9 @@ export function SidebarGoalGroup({</DropdownMenu>{/* Members stay mounted while collapsed so their dialog state survives. */}- <SidebarMenuSub hidden={collapsed}>{children}</SidebarMenuSub>+ <SidebarMenuSub className="mr-0 pr-0" hidden={collapsed}>+ {children}+ </SidebarMenuSub><Dialog open={renameOpen} onOpenChange={setRenameOpen}><DialogContent className="max-w-sm">diff --git a/notfair/src/components/sidebar-goal-item.tsx b/notfair/src/components/sidebar-goal-item.tsxindex 230a6a3f..89e394a7 100644--- a/notfair/src/components/sidebar-goal-item.tsx+++ b/notfair/src/components/sidebar-goal-item.tsx@@ -63,8 +63,8 @@ type LiveStatus = "intake" | "proposed" | "active" | "paused";/*** One goal row in the sidebar rail: link to the goal screen plus a ⋮ menu* (pin, rename, move to group, pause/resume, delete). Rows are draggable onto- * group headers. Server sidebar computes the display bits (dot/label classes);- * this component owns the interactions.+ * group headers. Server sidebar computes the label color; this component owns+ * the interactions.*/export function SidebarGoalItem({href,@@ -73,7 +73,6 @@ export function SidebarGoalItem({label,status,pinned,- dotClass,labelClass,projectSlug,groups,@@ -87,7 +86,6 @@ export function SidebarGoalItem({label: string;status: LiveStatus;pinned: boolean;- dotClass: string;labelClass: string;projectSlug: string;/** Every group in the project — targets for "Move to group". */@@ -149,7 +147,6 @@ export function SidebarGoalItem({e.dataTransfer.effectAllowed = "move";}}>- <span className={cn("ns-dot", dotClass)} aria-hidden /><span className={cn("truncate", labelClass)}>{label}</span>{needsAttention && (<TriangleAlertdiff --git a/notfair/src/components/ui/sidebar.tsx b/notfair/src/components/ui/sidebar.tsxindex fa62a478..e37b47b7 100644--- a/notfair/src/components/ui/sidebar.tsx+++ b/notfair/src/components/ui/sidebar.tsx@@ -569,7 +569,7 @@ function SidebarMenuAction({"peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",showOnHover &&- "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground data-[state=open]:opacity-100 md:opacity-0",+ "peer-data-[active=true]/menu-button:text-sidebar-accent-foreground data-[state=open]:opacity-100 md:opacity-0 md:peer-hover/menu-button:opacity-100 md:peer-focus-visible/menu-button:opacity-100 md:hover:opacity-100 md:focus-visible:opacity-100",className)}{...props}