@antv/dumi-theme-antv 0.7.5-beta.1 → 0.7.6
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/dist/slots/Header/index.js +26 -8
- package/package.json +2 -3
|
@@ -18,7 +18,7 @@ import { Alert, Button, Dropdown, Menu, Modal, Popover } from 'antd';
|
|
|
18
18
|
import cx from 'classnames';
|
|
19
19
|
import { FormattedMessage, Link, useLocale, useSiteData } from 'dumi';
|
|
20
20
|
import { get, map, size } from 'lodash-es';
|
|
21
|
-
import React, { useEffect, useState } from 'react';
|
|
21
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
22
22
|
import { useMedia } from 'react-use';
|
|
23
23
|
import { getPurePathname } from "../../utils/location";
|
|
24
24
|
import { ic, icWithLocale } from "../hooks";
|
|
@@ -53,6 +53,9 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
53
53
|
showAntVProductsCard = _ref$showAntVProducts === void 0 ? true : _ref$showAntVProducts,
|
|
54
54
|
_ref$showLanguageSwit = _ref.showLanguageSwitcher,
|
|
55
55
|
showLanguageSwitcher = _ref$showLanguageSwit === void 0 ? true : _ref$showLanguageSwit,
|
|
56
|
+
_ref$showWeavefox = _ref.showWeavefox,
|
|
57
|
+
showWeavefox = _ref$showWeavefox === void 0 ? {} : _ref$showWeavefox,
|
|
58
|
+
isInternalUser = _ref.isInternalUser,
|
|
56
59
|
logo = _ref.logo,
|
|
57
60
|
onLanguageChange = _ref.onLanguageChange,
|
|
58
61
|
_ref$showWxQrcode = _ref.showWxQrcode,
|
|
@@ -182,13 +185,25 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
182
185
|
var handleSwitchLanguage = function handleSwitchLanguage() {
|
|
183
186
|
onLanguageChange === null || onLanguageChange === void 0 || onLanguageChange(lang);
|
|
184
187
|
};
|
|
188
|
+
var weavefox = useMemo(function () {
|
|
189
|
+
var configKey = isInternalUser ? 'internal' : 'public';
|
|
190
|
+
var configValue = showWeavefox[configKey];
|
|
191
|
+
if (!configValue) return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
192
|
+
var defaultLink = isInternalUser ? 'https://weavefox.antgroup-inc.cn/agent/@huiyu.zjt/AntV' : 'https://weavefox.alipay.com/agent/@ufox-b8tydq-0758/202505AP7vfl00422922';
|
|
193
|
+
var href = typeof configValue === 'string' ? configValue : defaultLink;
|
|
194
|
+
return /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("a", {
|
|
195
|
+
href: href,
|
|
196
|
+
target: "_blank",
|
|
197
|
+
rel: "noreferrer"
|
|
198
|
+
}, "AI\u751F\u7801"));
|
|
199
|
+
}, [isInternalUser, showWeavefox]);
|
|
185
200
|
var menu = /*#__PURE__*/React.createElement("ul", {
|
|
186
201
|
className: cx(styles.menu, _defineProperty(_defineProperty({}, styles.popup, !isWide), styles.popupHidden, !popupMenuVisible))
|
|
187
202
|
}, /** 最左侧的菜单,一般是 教程、API、示例,或者其他自定义,有配置文件中的 `navs` 决定 */
|
|
188
203
|
size(navs) ? /*#__PURE__*/React.createElement(Navs, {
|
|
189
204
|
navs: navs,
|
|
190
205
|
path: pathname
|
|
191
|
-
}) : null, /** 生态产品 */
|
|
206
|
+
}) : null, weavefox, /** 生态产品 */
|
|
192
207
|
size(ecosystems) ? /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(Dropdown, {
|
|
193
208
|
className: styles.ecoSystems,
|
|
194
209
|
overlay: /*#__PURE__*/React.createElement(Menu, null, map(ecosystems, function (_ref2) {
|
|
@@ -428,7 +443,8 @@ var Header = function Header(props) {
|
|
|
428
443
|
docsearchOptions = themeConfig.docsearchOptions,
|
|
429
444
|
announcement = themeConfig.announcement,
|
|
430
445
|
petercat = themeConfig.petercat,
|
|
431
|
-
links = themeConfig.links
|
|
446
|
+
links = themeConfig.links,
|
|
447
|
+
showWeavefox = themeConfig.showWeavefox;
|
|
432
448
|
var searchOptions = {
|
|
433
449
|
docsearchOptions: docsearchOptions
|
|
434
450
|
};
|
|
@@ -436,6 +452,10 @@ var Header = function Header(props) {
|
|
|
436
452
|
pathname = _useLocation2.pathname;
|
|
437
453
|
var isHomePage = ['/', ''].includes(getPurePathname(pathname));
|
|
438
454
|
var lang = useLocale().id;
|
|
455
|
+
var _useState9 = useState(undefined),
|
|
456
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
457
|
+
isInternalUser = _useState10[0],
|
|
458
|
+
setIsInternalUser = _useState10[1];
|
|
439
459
|
var headerProps = {
|
|
440
460
|
subTitle: icWithLocale(title, lang),
|
|
441
461
|
subTitleHref: subTitleHref,
|
|
@@ -458,12 +478,10 @@ var Header = function Header(props) {
|
|
|
458
478
|
isHomePage: isHomePage,
|
|
459
479
|
transparent: isHomePage && isAntVSite,
|
|
460
480
|
announcement: announcement,
|
|
461
|
-
petercat: petercat
|
|
481
|
+
petercat: petercat,
|
|
482
|
+
showWeavefox: showWeavefox,
|
|
483
|
+
isInternalUser: isInternalUser
|
|
462
484
|
};
|
|
463
|
-
var _useState9 = useState(undefined),
|
|
464
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
465
|
-
isInternalUser = _useState10[0],
|
|
466
|
-
setIsInternalUser = _useState10[1];
|
|
467
485
|
var isPetercatShow = petercat === null || petercat === void 0 ? void 0 : petercat.show;
|
|
468
486
|
useEffect(function () {
|
|
469
487
|
var checkUserType = /*#__PURE__*/function () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/dumi-theme-antv",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.6",
|
|
4
4
|
"description": "AntV website theme based on dumi2.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dumi",
|
|
@@ -145,8 +145,7 @@
|
|
|
145
145
|
"react-dom": ">=16.9.0"
|
|
146
146
|
},
|
|
147
147
|
"publishConfig": {
|
|
148
|
-
"access": "public"
|
|
149
|
-
"tag": "beta"
|
|
148
|
+
"access": "public"
|
|
150
149
|
},
|
|
151
150
|
"authors": [
|
|
152
151
|
"dumi",
|