2019-10-11 02:37:18 +02:00
|
|
|
// @flow
|
|
|
|
import * as React from 'react';
|
|
|
|
import Card from 'component/common/card';
|
|
|
|
import WebUploadItem from './internal/web-upload-item';
|
|
|
|
|
|
|
|
export type UploadItem = {
|
|
|
|
progess: string,
|
|
|
|
params: UpdatePublishFormData,
|
|
|
|
xhr?: { abort: () => void },
|
|
|
|
};
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
currentUploads: { [key: string]: UploadItem },
|
2019-11-25 18:42:49 +01:00
|
|
|
uploadCount: number,
|
2019-10-11 02:37:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
export default function WebUploadList(props: Props) {
|
|
|
|
const { currentUploads, uploadCount } = props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
!!uploadCount && (
|
2020-05-28 16:47:27 +02:00
|
|
|
<Card
|
2020-08-26 22:28:33 +02:00
|
|
|
title={__('Currently uploading')}
|
2021-03-03 20:23:42 +01:00
|
|
|
subtitle={
|
|
|
|
uploadCount > 1 ? __('You videos are currently uploading.') : __('Your video is currently uploading.')
|
|
|
|
}
|
2020-05-28 16:47:27 +02:00
|
|
|
body={
|
|
|
|
<section>
|
|
|
|
{/* $FlowFixMe */}
|
|
|
|
{Object.values(currentUploads).map(({ progress, params, xhr }) => (
|
|
|
|
<WebUploadItem key={`upload${params.name}`} progress={progress} params={params} xhr={xhr} />
|
|
|
|
))}
|
|
|
|
</section>
|
|
|
|
}
|
|
|
|
/>
|
2019-10-11 02:37:18 +02:00
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|