@arcblock/ux 2.2.3 → 2.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.
Files changed (119) hide show
  1. package/lib/ActivityIndicator/index.js +7 -9
  2. package/lib/Alert/index.js +6 -5
  3. package/lib/AnimationWaiter/index.js +6 -5
  4. package/lib/Badge/index.js +6 -5
  5. package/lib/Blocklet/blocklet.js +6 -5
  6. package/lib/Blocklet/utils.js +6 -5
  7. package/lib/BlockletNFT/index.js +6 -5
  8. package/lib/Center/index.js +6 -5
  9. package/lib/ClickToCopy/index.js +6 -5
  10. package/lib/CodeBlock/index.js +6 -5
  11. package/lib/ContactForm/index.js +6 -5
  12. package/lib/CookieConsent/index.js +6 -5
  13. package/lib/CountDown/index.js +6 -5
  14. package/lib/Datatable/CustomToolbar.js +7 -9
  15. package/lib/Datatable/DatatableContext.js +2 -2
  16. package/lib/Datatable/TableSearch.js +6 -5
  17. package/lib/Datatable/index.js +12 -15
  18. package/lib/Dialog/dialog.js +8 -10
  19. package/lib/Earth/index.js +7 -9
  20. package/lib/Empty/index.js +6 -5
  21. package/lib/ErrorBoundary/fallback.js +6 -5
  22. package/lib/Footer/index.js +6 -6
  23. package/lib/Header/auto-hidden.js +6 -5
  24. package/lib/Header/header.js +6 -5
  25. package/lib/Header/responsive-header.js +7 -9
  26. package/lib/Icon/image.js +6 -5
  27. package/lib/Icon/index.js +6 -5
  28. package/lib/InfoRow/index.js +6 -5
  29. package/lib/Layout/dashboard/index.js +56 -32
  30. package/lib/Layout/dashboard/sidebar.js +75 -37
  31. package/lib/Layout/dashboard/with-external-link.js +56 -0
  32. package/lib/Layout/dashboard-legacy/header.js +6 -5
  33. package/lib/Layout/dashboard-legacy/index.js +6 -5
  34. package/lib/Layout/dashboard-legacy/sidebar.js +10 -17
  35. package/lib/Layout/index.js +7 -9
  36. package/lib/Locale/selector.js +6 -5
  37. package/lib/Logo/index.js +6 -5
  38. package/lib/Metric/index.js +6 -6
  39. package/lib/NFTDisplay/aspect-ratio-container.js +6 -5
  40. package/lib/NFTDisplay/broken.js +6 -5
  41. package/lib/NFTDisplay/index.js +6 -5
  42. package/lib/NFTDisplay/loading.js +6 -5
  43. package/lib/NFTDisplay/svg-embedder/inline-svg.js +9 -11
  44. package/lib/NavMenu/style.js +8 -13
  45. package/lib/PricingTable/PricingPlan.js +6 -5
  46. package/lib/PricingTable/index.js +6 -5
  47. package/lib/Result/result.js +6 -5
  48. package/lib/Screenshot/index.js +6 -5
  49. package/lib/SplitButton/index.js +7 -9
  50. package/lib/Tag/index.js +6 -5
  51. package/lib/TextCollapse/index.js +6 -5
  52. package/lib/Theme/theme-provider.js +2 -3
  53. package/lib/Video/index.js +6 -5
  54. package/lib/Wallet/Action.js +6 -5
  55. package/lib/Wallet/Download.js +6 -5
  56. package/lib/Wallet/Open.js +6 -5
  57. package/lib/WechatPrompt/index.js +6 -5
  58. package/lib/withTheme/index.js +9 -5
  59. package/lib/withTracker/index.js +19 -34
  60. package/package.json +6 -8
  61. package/src/ActivityIndicator/index.js +1 -1
  62. package/src/Alert/index.js +1 -1
  63. package/src/AnimationWaiter/index.js +1 -1
  64. package/src/Badge/index.js +1 -1
  65. package/src/Blocklet/blocklet.js +1 -1
  66. package/src/Blocklet/utils.js +1 -1
  67. package/src/BlockletNFT/index.js +1 -1
  68. package/src/Center/index.js +1 -1
  69. package/src/ClickToCopy/index.js +1 -1
  70. package/src/CodeBlock/index.js +1 -1
  71. package/src/ContactForm/index.js +1 -1
  72. package/src/CookieConsent/index.js +1 -1
  73. package/src/CountDown/index.js +1 -1
  74. package/src/Datatable/CustomToolbar.js +1 -1
  75. package/src/Datatable/DatatableContext.js +2 -2
  76. package/src/Datatable/TableSearch.js +1 -1
  77. package/src/Datatable/index.js +5 -4
  78. package/src/Dialog/dialog.js +1 -1
  79. package/src/Earth/index.js +1 -1
  80. package/src/Empty/index.js +1 -1
  81. package/src/ErrorBoundary/fallback.js +1 -1
  82. package/src/Footer/index.js +1 -1
  83. package/src/Header/auto-hidden.js +1 -1
  84. package/src/Header/header.js +1 -1
  85. package/src/Header/responsive-header.js +1 -1
  86. package/src/Icon/image.js +1 -1
  87. package/src/Icon/index.js +1 -1
  88. package/src/InfoRow/index.js +1 -1
  89. package/src/Layout/dashboard/index.js +56 -27
  90. package/src/Layout/dashboard/sidebar.js +100 -18
  91. package/src/Layout/dashboard/with-external-link.js +20 -0
  92. package/src/Layout/dashboard-legacy/header.js +1 -1
  93. package/src/Layout/dashboard-legacy/index.js +1 -1
  94. package/src/Layout/dashboard-legacy/sidebar.js +4 -6
  95. package/src/Layout/index.js +1 -1
  96. package/src/Locale/selector.js +1 -1
  97. package/src/Logo/index.js +1 -1
  98. package/src/Metric/index.js +1 -1
  99. package/src/NFTDisplay/aspect-ratio-container.js +1 -1
  100. package/src/NFTDisplay/broken.js +1 -1
  101. package/src/NFTDisplay/index.js +1 -1
  102. package/src/NFTDisplay/loading.js +1 -1
  103. package/src/NFTDisplay/svg-embedder/inline-svg.js +2 -2
  104. package/src/NavMenu/style.js +1 -1
  105. package/src/PricingTable/PricingPlan.js +1 -1
  106. package/src/PricingTable/index.js +1 -1
  107. package/src/Result/result.js +1 -1
  108. package/src/Screenshot/index.js +1 -1
  109. package/src/SplitButton/index.js +1 -1
  110. package/src/Tag/index.js +1 -1
  111. package/src/TextCollapse/index.js +1 -1
  112. package/src/Theme/theme-provider.js +3 -4
  113. package/src/Video/index.js +1 -1
  114. package/src/Wallet/Action.js +1 -1
  115. package/src/Wallet/Download.js +1 -1
  116. package/src/Wallet/Open.js +1 -1
  117. package/src/WechatPrompt/index.js +1 -1
  118. package/src/withTheme/index.js +6 -4
  119. package/src/withTracker/index.js +20 -33
@@ -1,11 +1,10 @@
1
- /* eslint-disable react/no-deprecated */
2
- /* eslint-disable react/static-property-placement */
3
1
  /* eslint-disable import/no-unresolved */
4
- import { Component } from 'react';
5
- import PropTypes from 'prop-types';
6
2
  import ReactGA from 'react-ga';
7
3
  import * as Sentry from '@sentry/browser';
8
- import { withRouter } from 'react-router-dom';
4
+
5
+ import useDeepCompareEffect from 'react-use/lib/useDeepCompareEffect';
6
+ import useMount from 'react-use/lib/useMount';
7
+ import { useLocation } from 'react-router-dom';
9
8
 
10
9
  import ErrorBoundary from './error_boundary';
11
10
 
@@ -34,37 +33,25 @@ export default (WrappedComponent, options = {}) => {
34
33
  }
35
34
  };
36
35
 
37
- class TrackedComponent extends Component {
38
- static propTypes = {
39
- location: PropTypes.object.isRequired,
40
- };
41
-
42
- componentDidMount() {
43
- const page = this.props.location.pathname;
44
- trackPage(page);
45
- }
46
-
47
- componentWillReceiveProps(nextProps) {
48
- const currentPage = this.props.location.pathname;
49
- const nextPage = nextProps.location.pathname;
36
+ return function TrackedComponent(props) {
37
+ const location = useLocation();
50
38
 
51
- if (currentPage !== nextPage) {
52
- trackPage(nextPage);
53
- }
54
- }
39
+ useMount(() => {
40
+ trackPage(location.pathname);
41
+ });
55
42
 
56
- render() {
57
- if (process.env.NODE_ENV === 'production') {
58
- return (
59
- <ErrorBoundary>
60
- <WrappedComponent {...this.props} />
61
- </ErrorBoundary>
62
- );
63
- }
43
+ useDeepCompareEffect(() => {
44
+ trackPage(location.pathname);
45
+ }, [location.pathname]);
64
46
 
65
- return <WrappedComponent {...this.props} />;
47
+ if (process.env.NODE_ENV === 'production') {
48
+ return (
49
+ <ErrorBoundary>
50
+ <WrappedComponent {...props} />
51
+ </ErrorBoundary>
52
+ );
66
53
  }
67
- }
68
54
 
69
- return withRouter(TrackedComponent);
55
+ return <WrappedComponent {...props} />;
56
+ };
70
57
  };