import { InformationCircleIcon } from '@heroicons/react/24/solid'; import { useCallback } from 'react'; import ExperimentalFeature from '../experimental-feature'; import { useDepGraphService } from '../hooks/use-dep-graph'; import { useDepGraphSelector } from '../hooks/use-dep-graph-selector'; import { collapseEdgesSelector, focusedProjectNameSelector, getTracingInfo, groupByFolderSelector, hasAffectedProjectsSelector, includePathSelector, searchDepthSelector, textFilterSelector, } from '../machines/selectors'; import CollapseEdgesPanel from './collapse-edges-panel'; import FocusedProjectPanel from './focused-project-panel'; import GroupByFolderPanel from './group-by-folder-panel'; import ProjectList from './project-list'; import SearchDepth from './search-depth'; import ShowHideProjects from './show-hide-projects'; import TextFilterPanel from './text-filter-panel'; import ThemePanel from './theme-panel'; import TracingPanel from './tracing-panel'; import { TracingAlgorithmType } from '../machines/interfaces'; import { useEnvironmentConfig } from '../hooks/use-environment-config'; export function Sidebar() { const environmentConfig = useEnvironmentConfig(); const depGraphService = useDepGraphService(); const focusedProject = useDepGraphSelector(focusedProjectNameSelector); const searchDepthInfo = useDepGraphSelector(searchDepthSelector); const includePath = useDepGraphSelector(includePathSelector); const textFilter = useDepGraphSelector(textFilterSelector); const hasAffectedProjects = useDepGraphSelector(hasAffectedProjectsSelector); const groupByFolder = useDepGraphSelector(groupByFolderSelector); const collapseEdges = useDepGraphSelector(collapseEdgesSelector); const isTracing = depGraphService.state.matches('tracing'); // const isTracing = depGraphService.state.matches('tracing'); const tracingInfo = useDepGraphSelector(getTracingInfo); function resetFocus() { depGraphService.send({ type: 'unfocusProject' }); } function showAllProjects() { depGraphService.send({ type: 'selectAll' }); } function hideAllProjects() { depGraphService.send({ type: 'deselectAll' }); } function showAffectedProjects() { depGraphService.send({ type: 'selectAffected' }); } function searchDepthFilterEnabledChange(checked: boolean) { depGraphService.send({ type: 'setSearchDepthEnabled', searchDepthEnabled: checked, }); } function groupByFolderChanged(checked: boolean) { depGraphService.send({ type: 'setGroupByFolder', groupByFolder: checked }); } function collapseEdgesChanged(checked: boolean) { depGraphService.send({ type: 'setCollapseEdges', collapseEdges: checked }); } function incrementDepthFilter() { depGraphService.send({ type: 'incrementSearchDepth' }); } function decrementDepthFilter() { depGraphService.send({ type: 'decrementSearchDepth' }); } function resetTextFilter() { depGraphService.send({ type: 'clearTextFilter' }); } function includeLibsInPathChange() { depGraphService.send({ type: 'setIncludeProjectsByPath', includeProjectsByPath: !includePath, }); } function resetTraceStart() { depGraphService.send({ type: 'clearTraceStart' }); } function resetTraceEnd() { depGraphService.send({ type: 'clearTraceEnd' }); } function setAlgorithm(algorithm: TracingAlgorithmType) { depGraphService.send({ type: 'setTracingAlgorithm', algorithm: algorithm }); } const updateTextFilter = useCallback( (textFilter: string) => { depGraphService.send({ type: 'filterByText', search: textFilter }); }, [depGraphService] ); return (
); } export default Sidebar;