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 | 8815x 8815x 1446x 7369x 12x | import { Plus } from "lucide-react";
import { Button } from "../../../ahuora-design-system/ui/button";
import { ToolTipCover } from "../../../ahuora-design-system/ui/tooltip";
import { useFlowsheetAccess } from "../../../hooks/flowsheetAccess";
import { useSearchParam } from "../../../hooks/searchParams";
import { ContentTypes } from "./LeftSideBar/LeftSideBarTabDefinitions";
export default function AddUnitOpButton() {
const [content, setContent] = useSearchParam("content");
const access = useFlowsheetAccess();
if (
content == ContentTypes.unitOps ||
content == undefined ||
access?.can_edit === false
) {
return null; // We're already in the unit operations tab, no need to show the button.
}
// there is a schadcn bug for button sizing:
//https://github.com/shadcn-ui/ui/issues/6316
return (
<ToolTipCover asChild content="Add Unit Operation" side="bottom">
<Button
className="mx-2"
size="sm"
aria-label="Show unit operation selection panel"
onClick={() => setContent(ContentTypes.unitOps)}
>
<Plus />
Unit Operations
</Button>
</ToolTipCover>
);
}
|