File tree Expand file tree Collapse file tree 3 files changed +31
-4
lines changed
Expand file tree Collapse file tree 3 files changed +31
-4
lines changed Original file line number Diff line number Diff line change 22
33import { useCallback , useMemo , useRef } from 'react'
44import clsx from 'clsx'
5+ import { ChevronDown } from 'lucide-react'
56import { getBlocksForSidebar } from '@/lib/workflows/trigger-utils'
67import { LoopTool } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/subflows/loop/loop-config'
78import { ParallelTool } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/subflows/parallel/parallel-config'
@@ -32,7 +33,7 @@ export function Blocks({ disabled = false }: BlocksProps) {
3233 const containerRef = useRef < HTMLDivElement > ( null )
3334
3435 // Panel resize hook
35- const { handleMouseDown, handleToggle } = usePanelResize ( {
36+ const { handleMouseDown, handleToggle, isCollapsed } = usePanelResize ( {
3637 panelType : 'blocks' ,
3738 containerRef,
3839 } )
@@ -152,10 +153,17 @@ export function Blocks({ disabled = false }: BlocksProps) {
152153 onMouseDown = { handleMouseDown }
153154 />
154155 < div
155- className = 'flex-shrink-0 cursor-pointer px-[10px] pt-[3px] pb-[5px]'
156+ className = 'flex flex -shrink-0 cursor-pointer items-center justify-between px-[10px] pt-[3px] pb-[5px]'
156157 onClick = { handleToggle }
157158 >
158159 < div className = 'font-medium text-[#AEAEAE] text-small dark:text-[#AEAEAE]' > Blocks</ div >
160+ < ChevronDown
161+ className = { clsx (
162+ 'h-[12px] w-[12px] text-[#787878] transition-all dark:text-[#787878]' ,
163+ ! isCollapsed && 'rotate-180'
164+ ) }
165+ aria-hidden = 'true'
166+ />
159167 </ div >
160168
161169 < div className = 'blocks-scrollable flex-1 overflow-y-auto overflow-x-hidden px-[8px]' >
Original file line number Diff line number Diff line change 22
33import { useCallback , useMemo , useRef } from 'react'
44import clsx from 'clsx'
5+ import { ChevronDown } from 'lucide-react'
56import { getTriggersForSidebar , hasTriggerCapability } from '@/lib/workflows/trigger-utils'
67import type { BlockConfig } from '@/blocks/types'
78import { usePanelResize } from '../../hooks/use-panel-resize'
@@ -21,7 +22,7 @@ export function Triggers({ disabled = false }: TriggersProps) {
2122 const containerRef = useRef < HTMLDivElement > ( null )
2223
2324 // Panel resize hook
24- const { handleMouseDown, handleToggle } = usePanelResize ( {
25+ const { handleMouseDown, handleToggle, isCollapsed } = usePanelResize ( {
2526 panelType : 'triggers' ,
2627 containerRef,
2728 } )
@@ -96,10 +97,17 @@ export function Triggers({ disabled = false }: TriggersProps) {
9697 onMouseDown = { handleMouseDown }
9798 />
9899 < div
99- className = 'flex-shrink-0 cursor-pointer px-[10px] pt-[3px] pb-[5px]'
100+ className = 'flex flex -shrink-0 cursor-pointer items-center justify-between px-[10px] pt-[3px] pb-[5px]'
100101 onClick = { handleToggle }
101102 >
102103 < div className = 'font-medium text-[#AEAEAE] text-small dark:text-[#AEAEAE]' > Triggers</ div >
104+ < ChevronDown
105+ className = { clsx (
106+ 'h-[12px] w-[12px] text-[#787878] dark:text-[#787878]' ,
107+ ! isCollapsed && 'rotate-180'
108+ ) }
109+ aria-hidden = 'true'
110+ />
103111 </ div >
104112
105113 < div className = 'triggers-scrollable flex-1 overflow-y-auto overflow-x-hidden px-[8px]' >
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ interface UsePanelResizeProps {
4141 * @returns Object containing panel state and handlers
4242 * @returns currentHeight - Current height of the panel in pixels
4343 * @returns isResizing - Boolean indicating if the panel is currently being resized
44+ * @returns isCollapsed - Boolean indicating if the panel is currently collapsed
4445 * @returns handleMouseDown - Handler for mouse down events on the resize handle
4546 * @returns handleToggle - Handler to toggle panel between collapsed and expanded states
4647 */
@@ -54,6 +55,15 @@ export function usePanelResize({ panelType, containerRef }: UsePanelResizeProps)
5455 // Get current panel's height and setter based on type
5556 const currentHeight = panelType === 'triggers' ? triggersHeight : blocksHeight
5657
58+ /**
59+ * Determine if the panel is currently collapsed
60+ */
61+ const isCollapsed =
62+ panelType === 'triggers'
63+ ? Math . abs ( triggersHeight - ( blocksHeight + HEADER_HEIGHT ) ) <= 2 ||
64+ triggersHeight <= MIN_HEIGHT
65+ : blocksHeight <= MIN_HEIGHT
66+
5767 /**
5868 * Handles mouse down event on the resize handle to initiate panel resizing
5969 *
@@ -244,6 +254,7 @@ export function usePanelResize({ panelType, containerRef }: UsePanelResizeProps)
244254 return {
245255 currentHeight,
246256 isResizing,
257+ isCollapsed,
247258 handleMouseDown,
248259 handleToggle,
249260 }
You can’t perform that action at this time.
0 commit comments