2022-03-30 07:51:07 -07:00
|
|
|
import React from 'react';
|
|
|
|
|
2022-06-17 11:42:21 -07:00
|
|
|
import UploadProgress from 'soapbox/components/upload-progress';
|
2022-09-14 11:01:00 -07:00
|
|
|
import { useCompose } from 'soapbox/hooks';
|
2022-03-30 07:51:07 -07:00
|
|
|
|
2022-09-10 14:52:06 -07:00
|
|
|
interface IComposeUploadProgress {
|
|
|
|
composeId: string,
|
|
|
|
}
|
|
|
|
|
2022-06-17 11:42:21 -07:00
|
|
|
/** File upload progress bar for post composer. */
|
2022-09-10 14:52:06 -07:00
|
|
|
const ComposeUploadProgress: React.FC<IComposeUploadProgress> = ({ composeId }) => {
|
2022-09-14 11:01:00 -07:00
|
|
|
const compose = useCompose(composeId);
|
|
|
|
|
|
|
|
const active = compose.is_uploading;
|
|
|
|
const progress = compose.progress;
|
2022-03-30 07:51:07 -07:00
|
|
|
|
|
|
|
if (!active) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2022-06-17 11:42:21 -07:00
|
|
|
<UploadProgress progress={progress} />
|
2022-03-30 07:51:07 -07:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2022-06-17 11:42:21 -07:00
|
|
|
export default ComposeUploadProgress;
|