import React, { useEffect, useRef, useState } from 'react' import styles from './_report-loader.module.scss' import { c } from '../../translations/LibraryTranslationService' type ReportLoaderProps = { noDelay?: boolean noText?: boolean customClass?: string loadingMessage?: string } /** * @deprecated Please do not continue to use this loader. UX does not want this used anymore. **/ const ReportLoader = ({ noDelay, noText, customClass, loadingMessage, }: ReportLoaderProps) => { const [loading, setLoading] = useState(true) const timeoutRef = useRef>(undefined) useEffect(() => { if (noDelay) { setLoading(false) } else { timeoutRef.current = setTimeout(() => { setLoading(false) }, 500) } return () => { timeoutRef.current && clearTimeout(timeoutRef.current) } }, [noDelay]) return (
{!loading && (
{!noText && (
{`${loadingMessage ? loadingMessage : c('generatingReport')}`}    {c('thisMayTakeAFewMoments')}
)}
)}
) } export default ReportLoader