Skip to content

replaced connect with useSelector hook #3113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions client/modules/IDE/components/AssetSize.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import PropTypes from 'prop-types';
import React from 'react';
import { connect } from 'react-redux';
import { useSelector } from 'react-redux';
import prettyBytes from 'pretty-bytes';

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

/* Eventually, this copy should be Total / 250 MB Used */
const AssetSize = ({ totalSize }) => {
const AssetSize = () => {
const totalSize = useSelector(
(state) => state.user.totalSize || state.assets.totalSize
);

if (totalSize === undefined) {
return null;
}
Expand All @@ -40,15 +43,4 @@ const AssetSize = ({ totalSize }) => {
);
};

AssetSize.propTypes = {
totalSize: PropTypes.number.isRequired
};

function mapStateToProps(state) {
return {
user: state.user,
totalSize: state.user.totalSize || state.assets.totalSize
};
}

export default connect(mapStateToProps)(AssetSize);
export default AssetSize;
Loading