All files / src/pages/flowsheet-page/menuBar SaveRevisionToolbarButton.tsx

90% Statements 9/10
71.42% Branches 5/7
100% Functions 1/1
87.5% Lines 7/8

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              1031x 1031x 1031x     1023x           1031x     1031x   3077x      
import { Save } from "lucide-react";
import { Button } from "@/ahuora-design-system/ui/button";
import { ToolTipCover } from "@/ahuora-design-system/ui/tooltip";
import { useFlowsheetRevisionPreview } from "@/hooks/flowsheetRevisionPreview";
import { useFlowsheetRevisionSave } from "@/pages/flowsheet-page/flowsheet/revisions/FlowsheetRevisionSaveContext";
 
/** Right-side toolbar entry point for saving a default-named revision. */
export function SaveRevisionToolbarButton() {
  const { saveRevision, isSaving } = useFlowsheetRevisionSave();
  const { isPreview } = useFlowsheetRevisionPreview();
 
  return (
    <ToolTipCover asChild content="Save version">
      <Button
        size="icon"
        variant="ghost"
        className="w-fit"
        aria-label="Save version"
        disabled={isSaving || isPreview}
        onClick={saveRevision}
      >
        <Save size={18} />
      </Button>
    </ToolTipCover>
  );
}