CurrentUploads.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright (C) 2015 - present Instructure, Inc.
  3. *
  4. * This file is part of Canvas.
  5. *
  6. * Canvas is free software: you can redistribute it and/or modify it under
  7. * the terms of the GNU Affero General Public License as published by the Free
  8. * Software Foundation, version 3 of the License.
  9. *
  10. * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
  11. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
  13. * details.
  14. *
  15. * You should have received a copy of the GNU Affero General Public License along
  16. * with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. import React from 'react'
  19. import classnames from 'classnames'
  20. import CurrentUploads from 'compiled/react_files/components/CurrentUploads'
  21. import UploadProgress from 'jsx/files/UploadProgress'
  22. CurrentUploads.renderUploadProgress = function () {
  23. if (this.state.currentUploads.length) {
  24. var progessComponents = this.state.currentUploads.map((uploader) => {
  25. return <UploadProgress uploader={uploader} key={uploader.getFileName()} />
  26. });
  27. return (
  28. <div className='current_uploads__uploaders'>
  29. {progessComponents}
  30. </div>
  31. );
  32. } else {
  33. return null;
  34. }
  35. };
  36. CurrentUploads.render = function () {
  37. var classes = classnames({
  38. 'current_uploads': this.state.currentUploads.length
  39. });
  40. return (
  41. <div className={classes}>
  42. {this.renderUploadProgress()}
  43. </div>
  44. );
  45. };
  46. export default React.createClass(CurrentUploads)