import { useEffect, useState } from "react";

export function useUADevice(): { isMobileDevice: boolean } {
  const [isMobileDevice, setIsMobileDevice] = useState<boolean>(false);

  useEffect(() => {
    const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);

    setIsMobileDevice(isMobile);
  }, [navigator.userAgent]);

  return { isMobileDevice };
}
