cozy-ui 68.3.1 → 68.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/package.json +3 -2
- package/react/UploadQueue/index.jsx +9 -20
- package/transpiled/react/UploadQueue/index.js +5 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# [68.4.0](https://github.com/cozy/cozy-ui/compare/v68.3.1...v68.4.0) (2022-06-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **UploadQueue:** The progress bar changes correctly every second ([e57a609](https://github.com/cozy/cozy-ui/commit/e57a609))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **Chore:** Add rooks lib to use useIntervalWhen hook ([256e86d](https://github.com/cozy/cozy-ui/commit/256e86d))
|
|
12
|
+
|
|
1
13
|
## [68.3.1](https://github.com/cozy/cozy-ui/compare/v68.3.0...v68.3.1) (2022-06-08)
|
|
2
14
|
|
|
3
15
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-ui",
|
|
3
|
-
"version": "68.
|
|
3
|
+
"version": "68.4.0",
|
|
4
4
|
"description": "Cozy apps UI SDK",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"bin": {
|
|
@@ -168,7 +168,8 @@
|
|
|
168
168
|
"react-popper": "^2.2.3",
|
|
169
169
|
"react-remove-scroll": "^2.4.0",
|
|
170
170
|
"react-select": "^4.3.0",
|
|
171
|
-
"react-swipeable-views": "^0.13.3"
|
|
171
|
+
"react-swipeable-views": "^0.13.3",
|
|
172
|
+
"rooks": "^5.11.2"
|
|
172
173
|
},
|
|
173
174
|
"peerDependencies": {
|
|
174
175
|
"@material-ui/core": ">=4.12",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React, { Component,
|
|
1
|
+
import React, { Component, useState } from 'react'
|
|
2
2
|
import cx from 'classnames'
|
|
3
3
|
import { withStyles } from '@material-ui/core/styles'
|
|
4
4
|
import LinearProgress from '@material-ui/core/LinearProgress'
|
|
5
|
+
import { useIntervalWhen } from 'rooks'
|
|
5
6
|
|
|
6
7
|
import { splitFilename } from 'cozy-client/dist/models/file'
|
|
7
8
|
|
|
@@ -109,26 +110,14 @@ const QueueLinearProgress = withStyles({
|
|
|
109
110
|
|
|
110
111
|
const FileUploadProgress = ({ progress: progressProps }) => {
|
|
111
112
|
const [progress, setProgress] = useState(progressProps)
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
useEffect(() => {
|
|
115
|
-
let interval
|
|
116
|
-
if (!isWaiting) {
|
|
113
|
+
useIntervalWhen(
|
|
114
|
+
() => {
|
|
117
115
|
setProgress(progressProps)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
return () => {
|
|
124
|
-
if (interval) {
|
|
125
|
-
clearInterval(interval)
|
|
126
|
-
}
|
|
127
|
-
setIsWaiting(false)
|
|
128
|
-
}
|
|
129
|
-
// TODO: validate the deps are correct
|
|
130
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
131
|
-
}, [])
|
|
116
|
+
},
|
|
117
|
+
1000,
|
|
118
|
+
true,
|
|
119
|
+
true
|
|
120
|
+
)
|
|
132
121
|
|
|
133
122
|
return (
|
|
134
123
|
<div className={styles['upload-queue__upload-progress']}>
|
|
@@ -12,10 +12,11 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
12
12
|
|
|
13
13
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
14
14
|
|
|
15
|
-
import React, { Component,
|
|
15
|
+
import React, { Component, useState } from 'react';
|
|
16
16
|
import cx from 'classnames';
|
|
17
17
|
import { withStyles } from '@material-ui/core/styles';
|
|
18
18
|
import LinearProgress from '@material-ui/core/LinearProgress';
|
|
19
|
+
import { useIntervalWhen } from 'rooks';
|
|
19
20
|
import { splitFilename } from 'cozy-client/dist/models/file';
|
|
20
21
|
import CrossIcon from "cozy-ui/transpiled/react/Icons/Cross";
|
|
21
22
|
import WarningIcon from "cozy-ui/transpiled/react/Icons/Warning";
|
|
@@ -170,31 +171,9 @@ var FileUploadProgress = function FileUploadProgress(_ref2) {
|
|
|
170
171
|
progress = _useState2[0],
|
|
171
172
|
setProgress = _useState2[1];
|
|
172
173
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
setIsWaiting = _useState4[1];
|
|
177
|
-
|
|
178
|
-
useEffect(function () {
|
|
179
|
-
var interval;
|
|
180
|
-
|
|
181
|
-
if (!isWaiting) {
|
|
182
|
-
setProgress(progressProps);
|
|
183
|
-
interval = setInterval(function () {
|
|
184
|
-
setIsWaiting(false);
|
|
185
|
-
}, 1000);
|
|
186
|
-
setIsWaiting(true);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
return function () {
|
|
190
|
-
if (interval) {
|
|
191
|
-
clearInterval(interval);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
setIsWaiting(false);
|
|
195
|
-
}; // TODO: validate the deps are correct
|
|
196
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
197
|
-
}, []);
|
|
174
|
+
useIntervalWhen(function () {
|
|
175
|
+
setProgress(progressProps);
|
|
176
|
+
}, 1000, true, true);
|
|
198
177
|
return /*#__PURE__*/React.createElement("div", {
|
|
199
178
|
className: styles['upload-queue__upload-progress']
|
|
200
179
|
}, /*#__PURE__*/React.createElement("div", {
|