import { BackwardCompatibleLoadingState } from '@interval/sdk/dist/internalRpcSchema' import { getPercentComplete } from './Progress' import { useRef } from 'react' import useTransactionAutoScroll from '~/utils/useTransactionAutoScroll' import DotsSpinner from '~/components/DotsSpinner' export default function InlineLoading(props: BackwardCompatibleLoadingState) { const percentComplete = getPercentComplete(props) const ref = useRef(null) useTransactionAutoScroll({ // always enabled; element is only shown for the current call in the append UI enabled: true, ref, }) return (
{(props.label ?? props.title) && (

{props.label ?? props.title}

)} {props.description && (

{props.description}

)} {percentComplete !== null && ( <>

Completed {props.itemsCompleted} of {props.itemsInQueue}

)}
) }