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

100% Statements 5/5
100% Branches 2/2
100% Functions 3/3
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          49x 23254x     6525x 6525x                
import { CircleCheck } from "lucide-react";
import { useSelector } from "react-redux";
import { RootState } from "@/store/store";
import { Spinner } from "../../../ahuora-design-system/ui/spinner";
 
const selectAnyMutationInProgress = (state: RootState) =>
  Object.values(state.api.mutations).some((m) => m.status === "pending");
 
export function SyncIndicator() {
  const anyPending = useSelector(selectAnyMutationInProgress);
  return anyPending ? (
    <div aria-label="Syncing Flowsheet">
      <Spinner></Spinner>
    </div>
  ) : (
    <div aria-label="Flowsheet Synced"></div>
  );
}