Skip to content

Commit dafe2d5

Browse files
replaced connect with useSelector hook
1 parent 9bc4286 commit dafe2d5

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

client/modules/IDE/components/AssetSize.jsx

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import PropTypes from 'prop-types';
22
import React from 'react';
3-
import { connect } from 'react-redux';
3+
import { useSelector } from 'react-redux';
44
import prettyBytes from 'pretty-bytes';
55

66
import getConfig from '../../../utils/getConfig';
@@ -18,7 +18,11 @@ const formatPercent = (percent) => {
1818
};
1919

2020
/* Eventually, this copy should be Total / 250 MB Used */
21-
const AssetSize = ({ totalSize }) => {
21+
const AssetSize = () => {
22+
const totalSize = useSelector(
23+
(state) => state.user.totalSize || state.assets.totalSize
24+
);
25+
2226
if (totalSize === undefined) {
2327
return null;
2428
}
@@ -40,15 +44,4 @@ const AssetSize = ({ totalSize }) => {
4044
);
4145
};
4246

43-
AssetSize.propTypes = {
44-
totalSize: PropTypes.number.isRequired
45-
};
46-
47-
function mapStateToProps(state) {
48-
return {
49-
user: state.user,
50-
totalSize: state.user.totalSize || state.assets.totalSize
51-
};
52-
}
53-
54-
export default connect(mapStateToProps)(AssetSize);
47+
export default AssetSize;

0 commit comments

Comments
 (0)