Skip to content

Instantly share code, notes, and snippets.

@majames
Created May 23, 2019 03:19
Show Gist options
  • Save majames/696b494d3475a2d7b96a485f0bd10d77 to your computer and use it in GitHub Desktop.
Save majames/696b494d3475a2d7b96a485f0bd10d77 to your computer and use it in GitHub Desktop.
PR-5434
private containerLoadingMessage = (): InflightUploadMessage | undefined => {
const { container } = this.state;
if (isUploadContainer(container)) {
const inflightUploadCount = this.getInflightLocalUploadsCount(container);
if (inflightUploadCount > 0) {
const { children } = container;
const completeUploadCount = children.length - inflightUploadCount;
return {
type: "loading",
str: `Uploaded ${completeUploadCount} of ${children.length} ${pluralize("files", children.length)}...`,
};
}
}
return;
};
const getInflightLocalUploadsCount = (container: UploadContainer): boolean => {
return container.children.filter(file => file.type === 'upload' && file.state.type === 'uploading').length;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment