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 && (
+
+ )}
+ >
)}
- )}
+
)
}