All files / src/commands CommandBrowser.tsx

100% Statements 4/4
75% Branches 6/8
100% Functions 1/1
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72                84x 84x 84x   84x                                                                                                                      
import { groupCommands, useCommands } from "just-search-it";
import { GroupAccordion } from "./CommandAccordion";
import { GroupTabs } from "./CommandTabs";
import { CommandFeature } from "./CommandFeature";
import { OpenPanel } from "../pages/flowsheet-page/flowsheet/LeftSideBar/SwitchViewCommands";
import { ContentTypes } from "../pages/flowsheet-page/flowsheet/LeftSideBar/LeftSideBarTabDefinitions";
 
export function CommandBrowser() {
  const commands = useCommands();
  const commandList = Object.values(commands);
  const commandGroups = groupCommands(commandList) || {};
 
  return (
    <div className="px-4">
      <div className="py-4">
        <h1>Analyse your flowsheet</h1>
        <div className="grid grid-cols-3 gap-4 py-2">
          <CommandFeature
            commandBinding={commands[OpenPanel.key + "." + ContentTypes.pinch]}
          />
          <CommandFeature
            commandBinding={commands[OpenPanel.key + "." + ContentTypes.pGraph]}
          />
          <CommandFeature
            commandBinding={commands[OpenPanel.key + "." + ContentTypes.summary]}
          />
          <CommandFeature
            commandBinding={
              commands[OpenPanel.key + "." + ContentTypes.solverLogs]
            }
          />
          <CommandFeature
            commandBinding={
              commands[OpenPanel.key + "." + ContentTypes.scenarios]
            }
          />
          <CommandFeature
            commandBinding={commands[OpenPanel.key + "." + ContentTypes.streams]}
          />
          <CommandFeature
            commandBinding={
              commands[OpenPanel.key + "." + ContentTypes.composition]
            }
          />
          <CommandFeature
            commandBinding={
              commands[OpenPanel.key + "." + ContentTypes.objectList]
            }
          />
        </div>
      </div>
      <div className="py-4">
        <h1>Frequently used actions</h1>
        <div className="grid grid-cols-2 gap-4 py-2">
          <CommandFeature commandBinding={commands["solve."]} />
          <CommandFeature commandBinding={commands["addUnitOp.heater"]} />
          <CommandFeature commandBinding={commands["shareFlowsheet."]} />
          <CommandFeature commandBinding={commands["addUnitOp.pump"]} />
        </div>
      </div>
      <GroupTabs
        commands={{
          "Flowsheet Controls":
            commandGroups["Display & flowsheet controls"] || [],
          Tabs: commandGroups["Flowsheet"] || [],
          "Go to Object": commandGroups["Go to object"] || [],
        }}
      />
    </div>
  );
}