"use client";

import Loader from "@/components/ui/Loader";

/**
 * The translucent overlay shown while a form is saving.
 *
 * Suppressed while the *avatar* is uploading: that has its own spinner on the
 * image itself, and covering the whole form for a photo change reads as though
 * everything is being submitted.
 */
export default function FormSubmitOverlay({
  isSubmitting,
  isProfilePicUpdating,
}: {
  isSubmitting: boolean;
  isProfilePicUpdating: boolean;
}) {
  if (!isSubmitting || isProfilePicUpdating) return null;
  return (
    <div className="absolute inset-0 flex justify-center items-center bg-white bg-opacity-75 z-10">
      <Loader />
    </div>
  );
}
