- refactor(documents): implement stable SHA256-based document IDs - feat(library): add support for external document libraries - refactor(audiobook): consolidate server logic and migrate to V1 storage layout - feat(audiobook): add reset functionality and improve chapter management - fix(ui): enhance audiobook export modal with download/regenerate controls - test: add coverage for upload hashing and export reset flow
68 lines
1.9 KiB
TypeScript
68 lines
1.9 KiB
TypeScript
import { Fragment } from 'react';
|
|
import { Transition } from '@headlessui/react';
|
|
import { ProgressCard } from './ProgressCard';
|
|
|
|
interface ProgressPopupProps {
|
|
isOpen: boolean;
|
|
progress: number;
|
|
estimatedTimeRemaining?: string;
|
|
onCancel: () => void;
|
|
statusMessage?: string;
|
|
operationType?: 'sync' | 'load' | 'library' | 'audiobook';
|
|
cancelText?: string;
|
|
onClick?: () => void;
|
|
currentChapter?: string;
|
|
totalChapters?: number;
|
|
completedChapters?: number;
|
|
}
|
|
|
|
export function ProgressPopup({
|
|
isOpen,
|
|
progress,
|
|
estimatedTimeRemaining,
|
|
onCancel,
|
|
statusMessage,
|
|
operationType,
|
|
cancelText = 'Cancel',
|
|
onClick,
|
|
currentChapter,
|
|
completedChapters
|
|
}: ProgressPopupProps) {
|
|
return (
|
|
<Transition
|
|
show={isOpen}
|
|
as={Fragment}
|
|
enter="transform transition ease-out duration-300"
|
|
enterFrom="opacity-0 -translate-y-4"
|
|
enterTo="opacity-100 translate-y-0"
|
|
leave="transform transition ease-in duration-200"
|
|
leaveFrom="opacity-100 translate-y-0"
|
|
leaveTo="opacity-0 -translate-y-4"
|
|
>
|
|
<div className="fixed inset-x-0 top-2 z-[60] pointer-events-none px-4">
|
|
<div className="w-full max-w-md mx-auto">
|
|
<div
|
|
className={`pointer-events-auto shadow-xl ${
|
|
onClick ? 'cursor-pointer' : ''
|
|
}`}
|
|
onClick={onClick}
|
|
>
|
|
<ProgressCard
|
|
progress={progress}
|
|
estimatedTimeRemaining={estimatedTimeRemaining}
|
|
onCancel={(e) => {
|
|
e?.stopPropagation();
|
|
onCancel();
|
|
}}
|
|
operationType={operationType}
|
|
cancelText={cancelText}
|
|
currentChapter={currentChapter}
|
|
completedChapters={completedChapters}
|
|
statusMessage={statusMessage}
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</Transition>
|
|
);
|
|
}
|