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

37 lines
931 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
2021-07-20 14:51:08 +02:00
title={__('Currently Uploading')}
subtitle={__('Leave the app running until upload is complete')}
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} />
2020-05-28 16:47:27 +02:00
))}
</section>
}
/>
)
);
}