lbry-desktop/ui/component/webUploadList/view.jsx

37 lines
979 B
React
Raw Normal View History

// @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,
};
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')}
2020-07-23 19:11:53 +02:00
subtitle={uploadCount > 1 ? __('You files are currently uploading.') : __('Your file 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>
}
/>
)
);
}