@blocklet/launcher-workflow 2.0.21 → 2.0.23

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 (2) hide show
  1. package/lib/purchase.js +9 -21
  2. package/package.json +7 -7
package/lib/purchase.js CHANGED
@@ -18,7 +18,6 @@ var _reactRouterDom = require("react-router-dom");
18
18
  var _useAsync = _interopRequireDefault(require("react-use/lib/useAsync"));
19
19
  var _useMeasure = _interopRequireDefault(require("react-use/lib/useMeasure"));
20
20
  var _useSetState = _interopRequireDefault(require("react-use/lib/useSetState"));
21
- var _useWindowSize = _interopRequireDefault(require("react-use/lib/useWindowSize"));
22
21
  var _urlJoin = _interopRequireDefault(require("url-join"));
23
22
  require("@splidejs/splide/dist/css/splide.min.css");
24
23
  var _layout = _interopRequireDefault(require("./components/layout"));
@@ -64,6 +63,7 @@ PrevIcon.defaultProps = {
64
63
  width: "40",
65
64
  height: "40"
66
65
  };
66
+ const SLIDE_WIDTH = 300;
67
67
  function PurchasePage(_ref) {
68
68
  var _planState$value4, _planState$value5;
69
69
  let {
@@ -84,7 +84,7 @@ function PurchasePage(_ref) {
84
84
  const [splideConfig, setSplideConfig] = (0, _useSetState.default)({
85
85
  arrows: false,
86
86
  perPage: 100,
87
- width: '300px',
87
+ width: "".concat(SLIDE_WIDTH, "px"),
88
88
  gap: '16px'
89
89
  });
90
90
  const {
@@ -95,9 +95,6 @@ function PurchasePage(_ref) {
95
95
  const [planListRef, {
96
96
  width: planListWidth
97
97
  }] = (0, _useMeasure.default)();
98
- const {
99
- width: windowSize
100
- } = (0, _useWindowSize.default)();
101
98
  const api = create({
102
99
  baseURL: didPayPrefix
103
100
  });
@@ -116,8 +113,8 @@ function PurchasePage(_ref) {
116
113
  const factor = Math.min(maxLength, tmpPlanLength);
117
114
  return {
118
115
  perPage: factor,
119
- width: "".concat(factor * 300, "px"),
120
- gap: '28px'
116
+ width: "".concat(factor * SLIDE_WIDTH, "px"),
117
+ gap: '24px'
121
118
  };
122
119
  };
123
120
  const selectCurrent = (perPage, curIndex) => {
@@ -162,21 +159,12 @@ function PurchasePage(_ref) {
162
159
  return;
163
160
  }
164
161
  const planLength = planState.value.length;
165
- const planListWidthRatio = planListWidth / windowSize;
166
- if (planListWidthRatio > 0.75 || planListWidth < 960) {
167
- setSplideConfig({
168
- perPage: 1,
169
- width: '280px'
170
- });
171
- return;
172
- }
173
- if (planListWidthRatio > 0.55 && planListWidthRatio <= 0.75) {
174
- setSplideConfig(calculateConfig(2, planLength));
175
- return;
176
- }
177
- setSplideConfig(calculateConfig(3, planLength));
162
+
163
+ // 最小得有1个
164
+ const temp = Math.max(Math.floor(planListWidth / SLIDE_WIDTH) - 1, 1);
165
+ setSplideConfig(calculateConfig(temp, planLength));
178
166
  // eslint-disable-next-line react-hooks/exhaustive-deps
179
- }, [windowSize, planListWidth, planState, setSplideConfig, isMobile]);
167
+ }, [planListWidth, planState, setSplideConfig, isMobile]);
180
168
  const handleSelect = planId => {
181
169
  setSelectedPlanId(planId);
182
170
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/launcher-workflow",
3
- "version": "2.0.21",
3
+ "version": "2.0.23",
4
4
  "description": "Purchase components for Launcher UI",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -36,13 +36,13 @@
36
36
  "react": ">=18.1.0"
37
37
  },
38
38
  "dependencies": {
39
- "@arcblock/did-connect": "^2.5.19",
39
+ "@arcblock/did-connect": "2.5.18",
40
40
  "@arcblock/icons": "^2.5.19",
41
41
  "@arcblock/license": "^2.5.19",
42
- "@arcblock/ux": "^2.5.19",
43
- "@blocklet/launcher-layout": "2.0.21",
44
- "@blocklet/launcher-util": "2.0.21",
45
- "@blocklet/launcher-ux": "2.0.21",
42
+ "@arcblock/ux": "2.5.18",
43
+ "@blocklet/launcher-layout": "2.0.23",
44
+ "@blocklet/launcher-util": "2.0.23",
45
+ "@blocklet/launcher-ux": "2.0.23",
46
46
  "@did-pay/react": "^1.9.49",
47
47
  "@emotion/react": "^11.10.6",
48
48
  "@emotion/styled": "^11.10.6",
@@ -72,5 +72,5 @@
72
72
  "@babel/preset-react": "^7.18.6",
73
73
  "babel-plugin-inline-react-svg": "^2.0.2"
74
74
  },
75
- "gitHead": "e427ccad66f6dc0b349d8ddff92f0f19e6d1753b"
75
+ "gitHead": "b279acae792d80c496430bafe6a13c34358e7385"
76
76
  }