import { useGetOverviewSnapshot } from "../../hooks/useGetOverviewSnapshot";
import NavigationArrow from "../UI/NavigationArrow";

type SnapshotContainerProps = {
  side: string;
  settingsPage?: boolean;
};

export const SnapshotContainer = ({
  side,
  settingsPage,
}: SnapshotContainerProps) => {
  const { canvasRef, isError, isPending } = useGetOverviewSnapshot(side);

  if (isError) return <>An error occurred</>;
  if (isPending) return <>Loading...</>;

  return (
    <div className="relative w-full aspect-video">
      <NavigationArrow side={side} settingsPage={settingsPage} />
      <canvas ref={canvasRef} className="w-full h-full object-contain block" />
    </div>
  );
};
