import { ArrowDownTrayIcon, ArrowLeftCircleIcon, InformationCircleIcon, } from '@heroicons/react/24/outline'; import classNames from 'classnames'; // nx-ignore-next-line import DebuggerPanel from './ui-components/debugger-panel'; import { useEnvironmentConfig } from './hooks/use-environment-config'; import { getGraphService } from './machines/graph.service'; import { selectValueByThemeStatic } from './theme-resolver'; import { Outlet, useNavigate, useParams } from 'react-router-dom'; import ThemePanel from './feature-projects/panels/theme-panel'; import Dropdown from './ui-components/dropdown'; import { useCurrentPath } from './hooks/use-current-path'; import ExperimentalFeature from './ui-components/experimental-feature'; import RankdirPanel from './feature-projects/panels/rankdir-panel'; import { getProjectGraphService } from './machines/get-services'; import TooltipDisplay from './ui-tooltips/graph-tooltip-display'; import { useSyncExternalStore } from 'use-sync-external-store/shim'; import { Tooltip } from './ui-tooltips/tooltip'; export function Shell(): JSX.Element { const projectGraphService = getProjectGraphService(); const graphService = getGraphService(); const lastPerfReport = useSyncExternalStore( (callback) => graphService.listen(callback), () => graphService.lastPerformanceReport ); const nodesVisible = lastPerfReport.numNodes !== 0; const environment = useEnvironmentConfig(); const environmentConfig = useEnvironmentConfig(); const navigate = useNavigate(); const currentPath = useCurrentPath(); const { selectedWorkspaceId, selectedTaskId } = useParams(); const currentRoute = currentPath.currentPath; const topLevelRoute = currentRoute.startsWith('/tasks') ? '/tasks' : '/projects'; const routes = [ { route: '/projects', label: 'Projects' }, { route: '/tasks', label: 'Tasks', }, ]; function projectChange(projectGraphId: string) { navigate(`/${projectGraphId}${topLevelRoute}`); } function downloadImage() { const graph = getGraphService(); const data = graph.getImage(); let downloadLink = document.createElement('a'); downloadLink.href = data; downloadLink.download = 'graph.png'; // this is necessary as link.click() does not work on the latest firefox downloadLink.dispatchEvent( new MouseEvent('click', { bubbles: true, cancelable: true, view: window, }) ); } return ( <>