瀏覽代碼

statusbar: Use strings for upload states

Renée Kooi 7 年之前
父節點
當前提交
95b1e47ce0
共有 1 個文件被更改,包括 6 次插入16 次删除
  1. 6 16
      src/plugins/Dashboard/StatusBar.js

+ 6 - 16
src/plugins/Dashboard/StatusBar.js

@@ -7,11 +7,11 @@ function progressDetails (props) {
 
 
 const throttledProgressDetails = throttle(progressDetails, 1000, {leading: true, trailing: true})
 const throttledProgressDetails = throttle(progressDetails, 1000, {leading: true, trailing: true})
 
 
-const STATE_WAITING = 0
-const STATE_PREPROCESSING = 1
-const STATE_UPLOADING = 2
-const STATE_POSTPROCESSING = 3
-const STATE_COMPLETE = 4
+const STATE_WAITING = 'waiting'
+const STATE_PREPROCESSING = 'preprocessing'
+const STATE_UPLOADING = 'uploading'
+const STATE_POSTPROCESSING = 'postprocessing'
+const STATE_COMPLETE = 'complete'
 
 
 function getUploadingState (props, files) {
 function getUploadingState (props, files) {
   // If ALL files have been completed, show the completed state.
   // If ALL files have been completed, show the completed state.
@@ -41,16 +41,6 @@ function getUploadingState (props, files) {
   return state
   return state
 }
 }
 
 
-function getUploadStateName (state) {
-  return [
-    'waiting',
-    'preprocessing',
-    'uploading',
-    'postprocessing',
-    'complete'
-  ][state]
-}
-
 module.exports = (props) => {
 module.exports = (props) => {
   props = props || {}
   props = props || {}
 
 
@@ -75,7 +65,7 @@ module.exports = (props) => {
   const width = typeof progressValue === 'number' ? progressValue : 100
   const width = typeof progressValue === 'number' ? progressValue : 100
 
 
   return html`
   return html`
-    <div class="UppyDashboard-statusBar is-${getUploadStateName(uploadState)}"
+    <div class="UppyDashboard-statusBar is-${uploadState}"
                 aria-hidden="${uploadState === STATE_WAITING}"
                 aria-hidden="${uploadState === STATE_WAITING}"
                 title="">
                 title="">
       <progress style="display: none;" min="0" max="100" value=${progressValue}></progress>
       <progress style="display: none;" min="0" max="100" value=${progressValue}></progress>