All files / src/pages/flowsheet-page/flowsheet/Canvas FlowsheetControls.tsx

100% Statements 9/9
75% Branches 6/8
100% Functions 1/1
100% Lines 5/5

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                    7930x       7930x                                       8092x 15535x 23140x          
import { X } from "lucide-react";
import { Button } from "@/ahuora-design-system/ui/button";
import { useSearchParam } from "@/hooks/searchParams";
import SolveButton from "../SolveButton";
 
type FlowsheetControlsProps = {
  trackedStreamName?: string;
  onClearTrackedStream?: () => void;
};
 
const FlowsheetControls = ({
  trackedStreamName,
  onClearTrackedStream,
}: FlowsheetControlsProps) => {
  const [scenario] = useSearchParam("scenario");
 
  return (
    <div className="flex flex-row justify-between items-center h-10 shadow gap-1">
      {trackedStreamName && (
        <div className="h-full bg-card border-border border-2 rounded-md flex items-center gap-2 px-3 text-sm text-card-foreground shadow">
          <span className="max-w-40 truncate" title={trackedStreamName}>
            Tracking {trackedStreamName}
          </span>
          <Button
            type="button"
            variant="ghost"
            size="xs"
            aria-label="Stop tracking stream"
            onClick={onClearTrackedStream}
            className="h-5 w-5 p-0"
          >
            <X className="h-3.5 w-3.5" />
          </Button>
        </div>
      )}
      <SolveButton scenarioNumber={+scenario} className="h-full" />
    </div>
  );
};
 
export default FlowsheetControls;