2023-12-15 04:19:42 -05:00
|
|
|
import { useOutlineContext } from '@/features/ide-react/context/outline-context'
|
2023-12-20 06:48:24 -05:00
|
|
|
import useCollapsiblePanel from '@/features/ide-react/hooks/use-collapsible-panel'
|
|
|
|
import { useRef } from 'react'
|
2023-12-15 04:19:42 -05:00
|
|
|
import { ImperativePanelHandle } from 'react-resizable-panels'
|
|
|
|
|
|
|
|
export const useOutlinePane = () => {
|
|
|
|
const { canShowOutline, outlineExpanded } = useOutlineContext()
|
2023-12-20 06:48:24 -05:00
|
|
|
const outlinePanelRef = useRef<ImperativePanelHandle>(null)
|
|
|
|
const outlineEnabled = canShowOutline && outlineExpanded
|
2023-12-15 04:19:42 -05:00
|
|
|
|
2023-12-20 06:48:24 -05:00
|
|
|
useCollapsiblePanel(outlineEnabled, outlinePanelRef)
|
2023-12-15 04:19:42 -05:00
|
|
|
|
2023-12-20 06:48:24 -05:00
|
|
|
return { outlineEnabled, outlinePanelRef }
|
2023-12-15 04:19:42 -05:00
|
|
|
}
|