From 4d4ba7acac78e528a88f2d3228d3ae456febc44e Mon Sep 17 00:00:00 2001 From: Michael Chihlas Date: Fri, 20 Feb 2026 21:25:10 -0500 Subject: [PATCH] =?UTF-8?q?feat:=20Phase=205=20=E2=80=94=20Sidebar=20pinne?= =?UTF-8?q?d=20section=20dual=20collapse=20+=20show=20more/less?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Header collapse hides entire section, resets to 5 items on re-expand - List truncation: show first 5, "Show more (N)" expands to all - Clicking a flow auto-collapses back to 5 - Smooth max-height CSS transition (250ms ease-out) Co-Authored-By: Claude Opus 4.6 --- .../components/sidebar/PinnedFlowsSection.tsx | 88 +++++++++++++------ 1 file changed, 63 insertions(+), 25 deletions(-) diff --git a/frontend/src/components/sidebar/PinnedFlowsSection.tsx b/frontend/src/components/sidebar/PinnedFlowsSection.tsx index 0e1ae165..79c8968f 100644 --- a/frontend/src/components/sidebar/PinnedFlowsSection.tsx +++ b/frontend/src/components/sidebar/PinnedFlowsSection.tsx @@ -10,51 +10,89 @@ interface PinnedFlowsSectionProps { onUnpin: (treeId: string) => void } +const TRUNCATE_COUNT = 5 + export function PinnedFlowsSection({ flows, onUnpin }: PinnedFlowsSectionProps) { const navigate = useNavigate() const [collapsed, setCollapsed] = useState(false) + const [showAll, setShowAll] = useState(false) + + const handleToggleCollapse = () => { + if (collapsed) { + setShowAll(false) // Reset to truncated on re-expand + } + setCollapsed(!collapsed) + } + + const visibleFlows = showAll ? flows : flows.slice(0, TRUNCATE_COUNT) + const hasMore = flows.length > TRUNCATE_COUNT + + const handleFlowClick = (flow: PinnedFlow) => { + setShowAll(false) // Collapse back to 5 on navigation + navigate(getTreeNavigatePath(flow.tree_id, flow.tree_type)) + } return (
- {!collapsed && ( -
+
+
{flows.length === 0 ? (

Pin your most-used flows here

) : ( - flows.map(flow => ( - - )) + <> + {visibleFlows.map(flow => ( + + ))} + {hasMore && ( + + )} + )}
- )} +
) }