mirror of
https://github.com/Qortal/qapp-core.git
synced 2025-06-22 20:21:22 +00:00
fix progress
This commit is contained in:
parent
a18f9de6d6
commit
aedd49a07d
@ -173,6 +173,9 @@ export const MultiPublishDialogComponent = () => {
|
||||
maxWidth="sm"
|
||||
sx={{ zIndex: 999990 }}
|
||||
slotProps={{ paper: { elevation: 0 } }}
|
||||
disableEnforceFocus
|
||||
disableAutoFocus
|
||||
disableRestoreFocus
|
||||
>
|
||||
<DialogTitle>Publishing Status</DialogTitle>
|
||||
<DialogContent>
|
||||
@ -277,10 +280,13 @@ const IndividualResourceComponent = ({ publish, publishKey, publishStatus }: Ind
|
||||
// Keep time ticking for progress simulation
|
||||
useEffect(() => {
|
||||
if (!chunkDone) return;
|
||||
const interval = setInterval(() => setNow(Date.now()), 1000);
|
||||
|
||||
const interval = setInterval(() => {
|
||||
setNow(Date.now());
|
||||
}, 1000);
|
||||
|
||||
return () => clearInterval(interval);
|
||||
}, [chunkDone]);
|
||||
|
||||
const processingPercent = useMemo(() => {
|
||||
if (publishStatus?.error || !chunkDone || !processingStart || !publishStatus?.totalChunks || !now) return 0;
|
||||
|
||||
@ -307,9 +313,9 @@ const IndividualResourceComponent = ({ publish, publishKey, publishStatus }: Ind
|
||||
|
||||
<Box mt={2}>
|
||||
<Typography variant="body2" gutterBottom>
|
||||
File Processing ({processingStart ? processingPercent.toFixed(0) : '0'}%)
|
||||
File Processing ({publishStatus?.processed ? 100 : processingStart ? processingPercent.toFixed(0) : '0'}%)
|
||||
</Typography>
|
||||
<LinearProgress variant="determinate" value={processingPercent} />
|
||||
<LinearProgress variant="determinate" value={publishStatus?.processed ? 100 : processingPercent} />
|
||||
</Box>
|
||||
|
||||
{publishStatus?.processed && (
|
||||
|
@ -17,6 +17,7 @@ import { useProgressStore } from "../state/video";
|
||||
import { GlobalPipPlayer } from "../hooks/useGlobalPipPlayer";
|
||||
import { Location, NavigateFunction } from "react-router-dom";
|
||||
import { MultiPublishDialog } from "../components/MultiPublish/MultiPublishDialog";
|
||||
import { useMultiplePublishStore } from "../state/multiplePublish";
|
||||
|
||||
// ✅ Define Global Context Type
|
||||
interface GlobalContextType {
|
||||
@ -60,6 +61,7 @@ export const GlobalProvider = ({
|
||||
}: GlobalProviderProps) => {
|
||||
// ✅ Call hooks and pass in options dynamically
|
||||
const auth = useAuth(config?.auth || {});
|
||||
const isPublishing = useMultiplePublishStore((s)=> s.isPublishing);
|
||||
|
||||
const appInfo = useAppInfo(config.appName, config?.publicSalt);
|
||||
const lists = useResources();
|
||||
@ -96,7 +98,9 @@ export const GlobalProvider = ({
|
||||
|
||||
<GlobalContext.Provider value={contextValue}>
|
||||
<GlobalPipPlayer />
|
||||
{isPublishing && (
|
||||
<MultiPublishDialog />
|
||||
)}
|
||||
<Toaster
|
||||
position="top-center"
|
||||
toastOptions={{
|
||||
|
@ -288,7 +288,7 @@ const publishMultipleResources = useCallback(async (resources: ResourceToPublish
|
||||
store.setFailedPublishResources([])
|
||||
const lengthOfResources = resources?.length;
|
||||
const lengthOfTimeout = lengthOfResources * 1200000; // 20 minutes per resource
|
||||
|
||||
console.log('lengthOfTimeout', lengthOfTimeout)
|
||||
const result = await qortalRequestWithTimeout({
|
||||
action: "PUBLISH_MULTIPLE_QDN_RESOURCES",
|
||||
resources
|
||||
@ -298,6 +298,7 @@ const publishMultipleResources = useCallback(async (resources: ResourceToPublish
|
||||
store.reset()
|
||||
storeStatus.reset()
|
||||
} catch (error: any) {
|
||||
console.log('timeout555')
|
||||
const unPublished = error?.error?.unsuccessfulPublishes;
|
||||
const failedPublishes: QortalGetMetadata[] = []
|
||||
if (unPublished && Array.isArray(unPublished)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user