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

43 lines
1.1 KiB
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 },
uploadCount: ?number,
};
export default function WebUploadList(props: Props) {
const { currentUploads, uploadCount } = props;
return (
!!uploadCount && (
<div>
<Card
title={__('Currently Uploading')}
2019-10-22 22:42:13 +02:00
subtitle={
uploadCount > 1
? __('You files are currently uploading. This will update automatically.')
: __('Your file is currently uploading. This will update automatically.')
}
body={
<section>
2019-10-22 22:42:13 +02:00
{/* $FlowFixMe */}
{Object.values(currentUploads).map(({ progress, params, xhr }) => (
<WebUploadItem key={`upload${params.name}`} progress={progress} params={params} xhr={xhr} />
))}
</section>
}
/>
</div>
)
);
}