@blocklet/ui-react 2.11.42 → 2.11.44
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 +3 -1
- package/lib/Header/index.js +3 -1
- package/package.json +4 -4
- package/src/Dashboard/index.jsx +3 -1
- package/src/Header/index.tsx +3 -2
package/lib/Dashboard/index.js
CHANGED
|
@@ -11,12 +11,14 @@ import { mapRecursive, flatRecursive, matchPaths } from "../utils.js";
|
|
|
11
11
|
import { publicPath, formatBlockletInfo, getLocalizedNavigation, filterNavByRole } from "../blocklets.js";
|
|
12
12
|
import HeaderAddons from "../common/header-addons.js";
|
|
13
13
|
import { useWalletHiddenTopbar } from "../common/wallet-hidden-topbar.js";
|
|
14
|
+
import useMobile from "../hooks/use-mobile.js";
|
|
14
15
|
function Dashboard({ meta, fallbackUrl, invalidPathFallback, headerAddons, sessionManagerProps, links, ...rest }) {
|
|
15
16
|
useWalletHiddenTopbar();
|
|
16
17
|
const sessionCtx = useContext(SessionContext);
|
|
17
18
|
const user = sessionCtx?.session?.user;
|
|
18
19
|
const userRole = user?.role;
|
|
19
20
|
const { locale } = useLocaleContext() || {};
|
|
21
|
+
const isMobile = useMobile();
|
|
20
22
|
const formattedBlocklet = useMemo(() => {
|
|
21
23
|
const blocklet = Object.assign({}, window.blocklet, meta);
|
|
22
24
|
try {
|
|
@@ -95,7 +97,7 @@ function Dashboard({ meta, fallbackUrl, invalidPathFallback, headerAddons, sessi
|
|
|
95
97
|
...rest,
|
|
96
98
|
headerProps: {
|
|
97
99
|
homeLink: publicPath,
|
|
98
|
-
logo: /* @__PURE__ */ jsx("img", { src: appLogoRect || appLogo, alt: "logo" }),
|
|
100
|
+
logo: /* @__PURE__ */ jsx("img", { src: isMobile ? appLogo : appLogoRect || appLogo, alt: "logo" }),
|
|
99
101
|
addons: _headerAddons,
|
|
100
102
|
...rest.headerProps
|
|
101
103
|
}
|
package/lib/Header/index.js
CHANGED
|
@@ -16,6 +16,7 @@ import { publicPath, formatBlockletInfo, getLocalizedNavigation } from "../block
|
|
|
16
16
|
import HeaderAddons from "../common/header-addons.js";
|
|
17
17
|
import { useWalletHiddenTopbar } from "../common/wallet-hidden-topbar.js";
|
|
18
18
|
import withHideWhenEmbed from "../libs/with-hide-when-embed.js";
|
|
19
|
+
import useMobile from "../hooks/use-mobile.js";
|
|
19
20
|
const parseNavigation = (navigation) => {
|
|
20
21
|
if (!navigation?.length) {
|
|
21
22
|
return { navItems: [], activeId: null };
|
|
@@ -72,6 +73,7 @@ function Header({
|
|
|
72
73
|
return blocklet;
|
|
73
74
|
}
|
|
74
75
|
}, [meta]);
|
|
76
|
+
const isMobileDevice = useMobile();
|
|
75
77
|
if (!formattedBlocklet.appName) {
|
|
76
78
|
return null;
|
|
77
79
|
}
|
|
@@ -88,7 +90,7 @@ function Header({
|
|
|
88
90
|
StyledUxHeader,
|
|
89
91
|
{
|
|
90
92
|
homeLink,
|
|
91
|
-
logo: /* @__PURE__ */ jsx("img", { src: appLogoRect || appLogo, alt: "logo" }),
|
|
93
|
+
logo: /* @__PURE__ */ jsx("img", { src: isMobileDevice ? appLogo : appLogoRect || appLogo, alt: "logo" }),
|
|
92
94
|
addons: headerAddons,
|
|
93
95
|
...omit(rest, ["bordered"]),
|
|
94
96
|
$bordered: rest?.bordered,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/ui-react",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.44",
|
|
4
4
|
"description": "Some useful front-end web components that can be used in Blocklets.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@abtnode/constant": "^1.16.38",
|
|
36
|
-
"@arcblock/bridge": "^2.11.
|
|
37
|
-
"@arcblock/react-hooks": "^2.11.
|
|
36
|
+
"@arcblock/bridge": "^2.11.44",
|
|
37
|
+
"@arcblock/react-hooks": "^2.11.44",
|
|
38
38
|
"@arcblock/ws": "^1.19.9",
|
|
39
39
|
"@blocklet/did-space-react": "^1.0.16",
|
|
40
40
|
"@iconify-icons/logos": "^1.2.36",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"jest": "^29.7.0",
|
|
85
85
|
"unbuild": "^2.0.0"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "ac208031ad00b2175432f4af61978bfcf2b48d88"
|
|
88
88
|
}
|
package/src/Dashboard/index.jsx
CHANGED
|
@@ -12,6 +12,7 @@ import { mapRecursive, flatRecursive, matchPaths } from '../utils';
|
|
|
12
12
|
import { publicPath, formatBlockletInfo, getLocalizedNavigation, filterNavByRole } from '../blocklets';
|
|
13
13
|
import HeaderAddons from '../common/header-addons';
|
|
14
14
|
import { useWalletHiddenTopbar } from '../common/wallet-hidden-topbar';
|
|
15
|
+
import useMobile from '../hooks/use-mobile';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* 专门用于 (composable) blocklet 的 Dashboard 组件, 解析 blocklet meta 中 section 为 dashboard 的 navigation 数据, 渲染一个 UX Dashboard
|
|
@@ -23,6 +24,7 @@ function Dashboard({ meta, fallbackUrl, invalidPathFallback, headerAddons, sessi
|
|
|
23
24
|
const user = sessionCtx?.session?.user;
|
|
24
25
|
const userRole = user?.role;
|
|
25
26
|
const { locale } = useLocaleContext() || {};
|
|
27
|
+
const isMobile = useMobile();
|
|
26
28
|
const formattedBlocklet = useMemo(() => {
|
|
27
29
|
const blocklet = Object.assign({}, window.blocklet, meta);
|
|
28
30
|
try {
|
|
@@ -121,7 +123,7 @@ function Dashboard({ meta, fallbackUrl, invalidPathFallback, headerAddons, sessi
|
|
|
121
123
|
{...rest}
|
|
122
124
|
headerProps={{
|
|
123
125
|
homeLink: publicPath,
|
|
124
|
-
logo: <img src={appLogoRect || appLogo} alt="logo" />,
|
|
126
|
+
logo: <img src={isMobile ? appLogo : appLogoRect || appLogo} alt="logo" />,
|
|
125
127
|
addons: _headerAddons,
|
|
126
128
|
...rest.headerProps,
|
|
127
129
|
}}
|
package/src/Header/index.tsx
CHANGED
|
@@ -18,6 +18,7 @@ import HeaderAddons from '../common/header-addons';
|
|
|
18
18
|
import { useWalletHiddenTopbar } from '../common/wallet-hidden-topbar';
|
|
19
19
|
import { BlockletMetaProps, SessionManagerProps } from '../@types';
|
|
20
20
|
import withHideWhenEmbed from '../libs/with-hide-when-embed';
|
|
21
|
+
import useMobile from '../hooks/use-mobile';
|
|
21
22
|
|
|
22
23
|
// blocklet meta 中的 navigation 数据 => NavMenu 组件的 items
|
|
23
24
|
const parseNavigation = (navigation: any) => {
|
|
@@ -104,12 +105,12 @@ function Header({
|
|
|
104
105
|
return blocklet;
|
|
105
106
|
}
|
|
106
107
|
}, [meta]);
|
|
108
|
+
const isMobileDevice = useMobile();
|
|
107
109
|
|
|
108
110
|
if (!formattedBlocklet.appName) {
|
|
109
111
|
return null;
|
|
110
112
|
}
|
|
111
113
|
const { appLogo, appLogoRect, theme } = formattedBlocklet;
|
|
112
|
-
|
|
113
114
|
const navigation = getLocalizedNavigation(formattedBlocklet?.navigation?.header, locale);
|
|
114
115
|
const parsedNavigation = parseNavigation(navigation);
|
|
115
116
|
const { navItems, activeId } = parsedNavigation;
|
|
@@ -129,7 +130,7 @@ function Header({
|
|
|
129
130
|
<StyledUxHeader
|
|
130
131
|
// @ts-ignore
|
|
131
132
|
homeLink={homeLink}
|
|
132
|
-
logo={<img src={appLogoRect || appLogo} alt="logo" />}
|
|
133
|
+
logo={<img src={isMobileDevice ? appLogo : appLogoRect || appLogo} alt="logo" />}
|
|
133
134
|
addons={headerAddons}
|
|
134
135
|
{...omit(rest, ['bordered'])}
|
|
135
136
|
$bordered={rest?.bordered}
|