2020-05-07 14:22:55 +02:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React from 'react';
|
2021-10-17 10:36:14 +02:00
|
|
|
import Lbry from 'lbry';
|
2020-05-07 14:22:55 +02:00
|
|
|
import Button from 'component/button';
|
2020-09-16 22:12:47 +02:00
|
|
|
import Spinner from 'component/spinner';
|
2020-05-07 14:22:55 +02:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
reflectingInfo?: ReflectingUpdate,
|
|
|
|
checkReflecting: () => void,
|
|
|
|
};
|
|
|
|
|
|
|
|
const PublishPending = (props: Props) => {
|
|
|
|
const { reflectingInfo = {}, checkReflecting } = props;
|
|
|
|
const { fileListItem, progress, stalled } = reflectingInfo;
|
|
|
|
const sdHash = fileListItem && fileListItem.sd_hash;
|
|
|
|
const reflecting = Object.keys(reflectingInfo).length;
|
|
|
|
if (stalled) {
|
|
|
|
return (
|
|
|
|
<Button
|
|
|
|
button="link"
|
|
|
|
label={__('Upload stalled. Retry?')}
|
|
|
|
onClick={() => Lbry.file_reflect({ sd_hash: sdHash }).then(() => checkReflecting())}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
} else if (reflecting) {
|
|
|
|
return <span>{__('Uploading (%progress%%) ', { progress: progress })}</span>;
|
|
|
|
} else {
|
2020-09-16 22:12:47 +02:00
|
|
|
return (
|
2022-02-11 19:50:55 +01:00
|
|
|
<div className="confirming-change">
|
2020-09-16 22:12:47 +02:00
|
|
|
{__('Confirming...')} <Spinner type="small" />
|
2022-02-11 19:50:55 +01:00
|
|
|
</div>
|
2020-09-16 22:12:47 +02:00
|
|
|
);
|
2020-05-07 14:22:55 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export default PublishPending;
|