@blocklet/ui-react 2.4.68 → 2.4.70
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.
package/lib/Dashboard/index.js
CHANGED
|
@@ -23,6 +23,8 @@ var _blocklets = require("../blocklets");
|
|
|
23
23
|
|
|
24
24
|
var _headerAddons2 = _interopRequireDefault(require("../common/header-addons"));
|
|
25
25
|
|
|
26
|
+
var _walletHiddenTopbar = require("../common/wallet-hidden-topbar");
|
|
27
|
+
|
|
26
28
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
29
|
|
|
28
30
|
const _excluded = ["meta", "fallbackUrl", "invalidPathFallback", "headerAddons", "sessionManagerProps", "links"];
|
|
@@ -56,6 +58,7 @@ function Dashboard(_ref) {
|
|
|
56
58
|
} = _ref,
|
|
57
59
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
58
60
|
|
|
61
|
+
(0, _walletHiddenTopbar.useWalletHiddenTopbar)();
|
|
59
62
|
const sessionCtx = (0, _react.useContext)(_Session.SessionContext);
|
|
60
63
|
const user = sessionCtx === null || sessionCtx === void 0 ? void 0 : (_sessionCtx$session = sessionCtx.session) === null || _sessionCtx$session === void 0 ? void 0 : _sessionCtx$session.user;
|
|
61
64
|
const userRole = user === null || user === void 0 ? void 0 : user.role;
|
package/lib/Header/index.js
CHANGED
|
@@ -33,6 +33,8 @@ var _blocklets = require("../blocklets");
|
|
|
33
33
|
|
|
34
34
|
var _headerAddons = _interopRequireDefault(require("../common/header-addons"));
|
|
35
35
|
|
|
36
|
+
var _walletHiddenTopbar = require("../common/wallet-hidden-topbar");
|
|
37
|
+
|
|
36
38
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
37
39
|
|
|
38
40
|
var _templateObject;
|
|
@@ -127,6 +129,7 @@ function Header(_ref) {
|
|
|
127
129
|
} = _ref,
|
|
128
130
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
129
131
|
|
|
132
|
+
(0, _walletHiddenTopbar.useWalletHiddenTopbar)();
|
|
130
133
|
const {
|
|
131
134
|
locale
|
|
132
135
|
} = (0, _context.useLocaleContext)() || {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useWalletHiddenTopbar = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _useBrowser = _interopRequireDefault(require("@arcblock/react-hooks/lib/useBrowser"));
|
|
11
|
+
|
|
12
|
+
var _dsbridge = _interopRequireDefault(require("dsbridge"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
// 在 wallet webview 环境中, 隐藏 wallet topbar
|
|
17
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
18
|
+
const useWalletHiddenTopbar = () => {
|
|
19
|
+
const browser = (0, _useBrowser.default)();
|
|
20
|
+
(0, _react.useEffect)(() => {
|
|
21
|
+
if (browser.wallet) {
|
|
22
|
+
_dsbridge.default.call('arcHideTopBar', '{}');
|
|
23
|
+
}
|
|
24
|
+
}, [browser]);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
exports.useWalletHiddenTopbar = useWalletHiddenTopbar;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/ui-react",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.70",
|
|
4
4
|
"description": "Some useful front-end web components that can be used in Blocklets.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"url": "https://github.com/ArcBlock/ux/issues"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@arcblock/did-connect": "^2.4.
|
|
34
|
-
"@arcblock/ux": "^2.4.
|
|
33
|
+
"@arcblock/did-connect": "^2.4.70",
|
|
34
|
+
"@arcblock/ux": "^2.4.70",
|
|
35
35
|
"@emotion/react": "^11.10.4",
|
|
36
36
|
"@emotion/styled": "^11.10.4",
|
|
37
37
|
"@iconify/iconify": "^2.2.1",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
54
54
|
"jest": "^28.1.3"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "5fae675919bb8acf003f04fd34cb7b037b19c8a1"
|
|
57
57
|
}
|
package/src/Dashboard/index.js
CHANGED
|
@@ -8,12 +8,14 @@ import { blockletMetaProps, sessionManagerProps } from '../types';
|
|
|
8
8
|
import { mapRecursive, flatRecursive, matchPaths } from '../utils';
|
|
9
9
|
import { publicPath, formatBlockletInfo, getLocalizedNavigation, filterNavByRole } from '../blocklets';
|
|
10
10
|
import HeaderAddons from '../common/header-addons';
|
|
11
|
+
import { useWalletHiddenTopbar } from '../common/wallet-hidden-topbar';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* 专门用于 (composable) blocklet 的 Dashboard 组件, 解析 blocklet meta 中 section 为 dashboard 的 navigation 数据, 渲染一个 UX Dashboard
|
|
14
15
|
*/
|
|
15
16
|
// eslint-disable-next-line no-shadow
|
|
16
17
|
function Dashboard({ meta, fallbackUrl, invalidPathFallback, headerAddons, sessionManagerProps, links, ...rest }) {
|
|
18
|
+
useWalletHiddenTopbar();
|
|
17
19
|
const sessionCtx = useContext(SessionContext);
|
|
18
20
|
const user = sessionCtx?.session?.user;
|
|
19
21
|
const userRole = user?.role;
|
package/src/Header/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import { blockletMetaProps, sessionManagerProps } from '../types';
|
|
|
13
13
|
import { mapRecursive, flatRecursive, matchPaths } from '../utils';
|
|
14
14
|
import { publicPath, formatBlockletInfo, getLocalizedNavigation } from '../blocklets';
|
|
15
15
|
import HeaderAddons from '../common/header-addons';
|
|
16
|
+
import { useWalletHiddenTopbar } from '../common/wallet-hidden-topbar';
|
|
16
17
|
|
|
17
18
|
// blocklet meta 中的 navigation 数据 => NavMenu 组件的 items
|
|
18
19
|
const parseNavigation = (navigation) => {
|
|
@@ -59,6 +60,7 @@ const parseNavigation = (navigation) => {
|
|
|
59
60
|
*/
|
|
60
61
|
// eslint-disable-next-line no-shadow
|
|
61
62
|
function Header({ meta, addons, sessionManagerProps, homeLink, theme: themeOverrides, ...rest }) {
|
|
63
|
+
useWalletHiddenTopbar();
|
|
62
64
|
const { locale } = useLocaleContext() || {};
|
|
63
65
|
const formattedBlocklet = useMemo(() => {
|
|
64
66
|
const blocklet = Object.assign({}, window.blocklet, meta);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import useBrowser from '@arcblock/react-hooks/lib/useBrowser';
|
|
3
|
+
import dsbridge from 'dsbridge';
|
|
4
|
+
|
|
5
|
+
// 在 wallet webview 环境中, 隐藏 wallet topbar
|
|
6
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
7
|
+
export const useWalletHiddenTopbar = () => {
|
|
8
|
+
const browser = useBrowser();
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (browser.wallet) {
|
|
11
|
+
dsbridge.call('arcHideTopBar', '{}');
|
|
12
|
+
}
|
|
13
|
+
}, [browser]);
|
|
14
|
+
};
|