import { forwardRef, ForwardedRef, useEffect, useState } from 'react' import { PktButton, PktIcon, PktProgressbar } from '..' import { PktModal } from '../modal/Modal' import { Truncate } from './Truncate' import { TFileAndTransfer, TItemRenderer, TQueueItemOperation, TTransferItemInProgress } from './types' import { formatFileSize } from './utils' const CancelTransferButton = (props: { onClick: () => void; label?: string; ariaLabel?: string }) => ( ) const LoadingText = () => { const [dotCount, setDotCount] = useState(1) useEffect(() => { const interval = setInterval(() => { setDotCount((prev) => (prev >= 3 ? 1 : prev + 1)) }, 400) return () => clearInterval(interval) }, []) return ( Laster opp{'.'.repeat(dotCount)} ) } export const TransferInProgress = ({ cancelTransfer, transferItem, }: { transferItem: TTransferItemInProgress cancelTransfer: () => void }) => { const showProgressBar = transferItem.showProgress ?? transferItem.progress !== 0 return ( <>