github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/ui/dashboard/src/hooks/useSelectPanel.ts (about)

     1  import { DashboardActions, PanelDefinition } from "../types";
     2  import { useCallback } from "react";
     3  import { useDashboard } from "./useDashboard";
     4  
     5  const useSelectPanel = (definition: PanelDefinition) => {
     6    const { dispatch } = useDashboard();
     7    const openPanelDetail = useCallback(
     8      async (e) => {
     9        e.stopPropagation();
    10        dispatch({
    11          type: DashboardActions.SELECT_PANEL,
    12          panel: definition,
    13        });
    14      },
    15      [dispatch, definition]
    16    );
    17  
    18    return { select: openPanelDetail };
    19  };
    20  
    21  export default useSelectPanel;