Skip to content

Commit 5ef262a

Browse files
authored
fix: hook moved to parent component (#389)
1 parent 753ae8d commit 5ef262a

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/components/AddressDetailExplorer.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import hathorLib from '@hathor/wallet-lib';
1010
import ReactLoading from 'react-loading';
1111
import { find } from 'lodash';
1212
import { useNavigate, useParams } from 'react-router-dom';
13-
import { useNewUiEnabled } from '../hooks';
13+
import { useIsMobile, useNewUiEnabled } from '../hooks';
1414
import AddressSummary from './AddressSummary';
1515
import AddressHistory from './AddressHistory';
1616
import Loading from './Loading';
@@ -65,6 +65,7 @@ function AddressDetailExplorer() {
6565
const { address } = useParams();
6666
const navigate = useNavigate();
6767
const newUiEnabled = useNewUiEnabled();
68+
const isMobile = useIsMobile();
6869

6970
/*
7071
* selectedToken {String} UID of the selected token when address has many
@@ -596,6 +597,7 @@ function AddressDetailExplorer() {
596597
calculatingPage={loadingPagination}
597598
loading={loadingHistory}
598599
newUiEnabled={newUiEnabled}
600+
isMobile={isMobile}
599601
/>
600602
</div>
601603
);

src/components/AddressHistory.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import EllipsiCell from './EllipsiCell';
1616
import { ReactComponent as RowBottomIcon } from '../assets/images/leading-icon.svg';
1717
import { ReactComponent as RowTopIcon } from '../assets/images/leading-top-icon.svg';
1818
import { COLORS } from '../constants';
19-
import { useIsMobile } from '../hooks';
2019

2120
const mapStateToProps = state => ({
2221
decimalPlaces: state.serverInfo.decimal_places,
@@ -174,8 +173,7 @@ class AddressHistory extends SortableTable {
174173
});
175174
}
176175

177-
renderNewTableBodyUi() {
178-
const isMobile = useIsMobile();
176+
renderNewTableBodyUi(isMobile) {
179177
const ellipsisCount = isMobile ? 4 : 12;
180178
return this.props.data.map(tx => {
181179
let statusElement = '';
@@ -244,7 +242,9 @@ class AddressHistory extends SortableTable {
244242
}
245243

246244
renderTableBody() {
247-
return this.props.newUiEnabled ? this.renderNewTableBodyUi() : this.renderTableBodyUi();
245+
return this.props.newUiEnabled
246+
? this.renderNewTableBodyUi(this.props.isMobile)
247+
: this.renderTableBodyUi();
248248
}
249249
}
250250

@@ -265,6 +265,8 @@ AddressHistory.propTypes = {
265265
selectedToken: PropTypes.string.isRequired,
266266
numTransactions: PropTypes.number.isRequired,
267267
txCache: PropTypes.object.isRequired,
268+
newUiEnabled: PropTypes.bool.isRequired,
269+
isMobile: PropTypes.bool.isRequired,
268270
};
269271

270272
export default connect(mapStateToProps)(AddressHistory);

0 commit comments

Comments
 (0)