@antv/dumi-theme-antv 0.8.0-beta.1 → 0.8.0-beta.10
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/builtins/Playground/index.module.less +0 -1
- package/dist/components/AI/HomeDialog/AntVBanner/index.module.less +2 -2
- package/dist/components/AI/HomeDialog/ModeSelector/index.js +4 -1
- package/dist/components/AI/HomeDialog/ModeSelector/index.module.less +39 -22
- package/dist/components/AI/HomeDialog/PromptTextarea/ChooseLib/index.js +5 -2
- package/dist/components/AI/HomeDialog/PromptTextarea/ChooseLib/index.module.less +0 -1
- package/dist/components/AI/HomeDialog/PromptTextarea/DatasourceCard/index.module.less +3 -3
- package/dist/components/AI/HomeDialog/PromptTextarea/Uploader/DataUploader.js +225 -0
- package/dist/components/AI/HomeDialog/PromptTextarea/index.js +61 -36
- package/dist/components/AI/HomeDialog/PromptTextarea/index.module.less +9 -8
- package/dist/components/AI/HomeDialog/RecommendCase/Card.js +13 -8
- package/dist/components/AI/HomeDialog/RecommendCase/card.module.less +1 -1
- package/dist/components/AI/HomeDialog/RecommendCase/index.js +45 -13
- package/dist/components/AI/HomeDialog/RecommendCase/index.module.less +3 -2
- package/dist/components/AI/HomeDialog/index.js +17 -4
- package/dist/components/AI/constant.js +2 -2
- package/dist/components/Login/Captcha/index.js +185 -0
- package/dist/components/Login/Captcha/index.less +91 -0
- package/dist/components/Login/CheckCode/index.js +244 -0
- package/dist/components/Login/CheckCode/index.less +137 -0
- package/dist/components/Login/CountDownButton/index.js +109 -0
- package/dist/components/Login/CountDownButton/index.less +8 -0
- package/dist/components/Login/LoginForm.js +239 -0
- package/dist/components/Login/LoginForm.less +409 -0
- package/dist/components/Login/index.js +24 -0
- package/dist/components/Login/openAuthWindow.js +54 -0
- package/dist/components/Login/types.js +5 -0
- package/dist/components/Login/utils.js +47 -0
- package/dist/layouts/DocLayout.js +2 -1
- package/dist/layouts/GlobalLayout/index.js +10 -4
- package/dist/locales/en.json +121 -1
- package/dist/locales/zh.json +121 -1
- package/dist/model/AIChat.js +65 -7
- package/dist/model/auth.js +133 -0
- package/dist/pages/AIPlayground/components/ConversationsMenu/index.js +28 -10
- package/dist/pages/AIPlayground/components/ConversationsMenu/index.module.less +2 -0
- package/dist/pages/AIPlayground/components/MarkdownComponent/MarkdownCodeBlock.js +25 -11
- package/dist/pages/AIPlayground/components/MarkdownComponent/MarkdownCodeBlock.module.less +1 -2
- package/dist/pages/AIPlayground/components/MarkdownComponent/index.js +5 -2
- package/dist/pages/AIPlayground/components/MsgBox/index.js +198 -136
- package/dist/pages/AIPlayground/components/MsgBox/index.module.less +3 -2
- package/dist/pages/AIPlayground/components/MsgBox/useAutoScroll.js +46 -0
- package/dist/pages/AIPlayground/components/SessionLayout/index.js +18 -10
- package/dist/pages/AIPlayground/components/SessionLayout/index.module.less +3 -1
- package/dist/pages/AIPlayground/components/TaskBox/generateCode.js +7 -1
- package/dist/pages/AIPlayground/components/TaskBox/index.js +79 -55
- package/dist/pages/AIPlayground/components/TaskBox/index.module.less +1 -0
- package/dist/pages/Examples/components/Accouncement/index.module.less +1 -1
- package/dist/pages/Examples/index.module.less +11 -11
- package/dist/pages/Index/components/Cases/index.module.less +8 -8
- package/dist/pages/Index/components/Companies/index.module.less +4 -3
- package/dist/pages/Index/components/Features/FeatureCard.module.less +4 -5
- package/dist/pages/Index/components/Features/index.module.less +5 -5
- package/dist/pages/Index/components/_.less +9 -9
- package/dist/plugin/index.js +2 -2
- package/dist/slots/Banner/Notification.module.less +8 -8
- package/dist/slots/Banner/index.module.less +10 -9
- package/dist/slots/CodeEditor/Toolbar.js +15 -9
- package/dist/slots/CodeEditor/index.js +19 -10
- package/dist/slots/CodeEditor/index.module.less +3 -0
- package/dist/slots/CodePreview/index.module.less +0 -3
- package/dist/slots/CodeRunner/index.js +5 -2
- package/dist/slots/ContentTable/index.module.less +2 -1
- package/dist/slots/Detail/News.module.less +9 -9
- package/dist/slots/Detail/index.module.less +11 -14
- package/dist/slots/ExampleSider/index.module.less +3 -4
- package/dist/slots/Footer/index.module.less +2 -2
- package/dist/slots/Header/Products/Product.module.less +2 -2
- package/dist/slots/Header/Search/SearchResult.js +23 -8
- package/dist/slots/Header/Search/SearchResult.module.less +1 -0
- package/dist/slots/Header/index.js +56 -11
- package/dist/slots/Header/index.module.less +13 -5
- package/dist/slots/LiveExample/index.module.less +1 -1
- package/dist/slots/Loading/index.module.less +30 -28
- package/dist/slots/ManualContent/index.module.less +14 -17
- package/dist/slots/_.less +9 -9
- package/dist/static/user.svg +3 -0
- package/dist/utils/env.js +37 -0
- package/dist/utils/request.js +42 -0
- package/package.json +7 -2
|
@@ -15,7 +15,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
15
15
|
import MonacoEditor, { loader } from '@monaco-editor/react';
|
|
16
16
|
import { Drawer, Switch } from 'antd';
|
|
17
17
|
import { autoType as d3AutoType, dsvFormat } from 'd3-dsv';
|
|
18
|
-
import { useLocale, useSiteData } from 'dumi';
|
|
18
|
+
import { useLocale, useSiteData, useIntl, useLocation } from 'dumi';
|
|
19
19
|
import { debounce, noop } from 'lodash-es';
|
|
20
20
|
import { format } from 'prettier';
|
|
21
21
|
import parserBabel from 'prettier/parser-babel';
|
|
@@ -57,10 +57,14 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
57
57
|
_ref$onError = _ref.onError,
|
|
58
58
|
onError = _ref$onError === void 0 ? noop : _ref$onError,
|
|
59
59
|
_ref$onFullscreen = _ref.onFullscreen,
|
|
60
|
-
onFullscreen = _ref$onFullscreen === void 0 ? noop : _ref$onFullscreen
|
|
60
|
+
onFullscreen = _ref$onFullscreen === void 0 ? noop : _ref$onFullscreen,
|
|
61
|
+
_ref$showAI = _ref.showAI,
|
|
62
|
+
showAI = _ref$showAI === void 0 ? true : _ref$showAI;
|
|
63
|
+
var umiLocation = useLocation();
|
|
61
64
|
var locale = useLocale();
|
|
62
65
|
var _useSiteData = useSiteData(),
|
|
63
66
|
themeConfig = _useSiteData.themeConfig;
|
|
67
|
+
var intl = useIntl();
|
|
64
68
|
var _themeConfig$es = themeConfig.es5,
|
|
65
69
|
es5 = _themeConfig$es === void 0 ? true : _themeConfig$es,
|
|
66
70
|
_themeConfig$showSpec = themeConfig.showSpecTab,
|
|
@@ -103,8 +107,8 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
103
107
|
setCurrentEditorTab = _useState12[1];
|
|
104
108
|
var _useState13 = useState(false),
|
|
105
109
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
106
|
-
|
|
107
|
-
|
|
110
|
+
showAIDrawer = _useState14[0],
|
|
111
|
+
setShowAIDrawer = _useState14[1];
|
|
108
112
|
var containerId = "playgroundScriptContainer_".concat(exampleId);
|
|
109
113
|
|
|
110
114
|
// 出发 auto resize
|
|
@@ -280,7 +284,7 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
280
284
|
// 用于更新当前 example 的 spec 和 data
|
|
281
285
|
useEffect(function () {
|
|
282
286
|
setCurrentEditorTab(EDITOR_TABS.JAVASCRIPT);
|
|
283
|
-
|
|
287
|
+
setShowAIDrawer(false);
|
|
284
288
|
}, [exampleId]);
|
|
285
289
|
|
|
286
290
|
// hook 用户的数据
|
|
@@ -384,7 +388,7 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
384
388
|
}
|
|
385
389
|
};
|
|
386
390
|
var onClickAI = function onClickAI() {
|
|
387
|
-
|
|
391
|
+
setShowAIDrawer(true);
|
|
388
392
|
};
|
|
389
393
|
var onReload = function onReload() {
|
|
390
394
|
setCode(source);
|
|
@@ -406,6 +410,7 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
406
410
|
onEditorTabChange: onTabChange,
|
|
407
411
|
onToggleFullscreen: onFullscreen,
|
|
408
412
|
onClickAI: onClickAI,
|
|
413
|
+
showAI: showAI,
|
|
409
414
|
onReload: onReload,
|
|
410
415
|
slots: {
|
|
411
416
|
Spec: /*#__PURE__*/React.createElement("span", {
|
|
@@ -461,19 +466,23 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
461
466
|
}), /*#__PURE__*/React.createElement(Drawer, {
|
|
462
467
|
placement: "right",
|
|
463
468
|
closable: true,
|
|
464
|
-
open:
|
|
469
|
+
open: showAIDrawer,
|
|
465
470
|
getContainer: false,
|
|
466
471
|
onClose: function onClose() {
|
|
467
|
-
return
|
|
472
|
+
return setShowAIDrawer(false);
|
|
468
473
|
},
|
|
469
474
|
rootClassName: styles.drawer,
|
|
470
|
-
width: '
|
|
475
|
+
width: '80%',
|
|
476
|
+
key: "".concat(umiLocation.hash, "_").concat(umiLocation.key)
|
|
471
477
|
}, /*#__PURE__*/React.createElement(MsgBox, {
|
|
478
|
+
key: "".concat(umiLocation.hash, "_").concat(umiLocation.key),
|
|
472
479
|
simple: true,
|
|
473
480
|
messages: [{
|
|
474
481
|
id: crypto.randomUUID(),
|
|
475
482
|
role: 'assistant',
|
|
476
|
-
content:
|
|
483
|
+
content: intl.formatMessage({
|
|
484
|
+
id: 'ai.assistant.editor.intro'
|
|
485
|
+
}),
|
|
477
486
|
createdAt: Date.now()
|
|
478
487
|
}],
|
|
479
488
|
context: valueOf(tab),
|
|
@@ -12,9 +12,11 @@
|
|
|
12
12
|
|
|
13
13
|
.drawer{
|
|
14
14
|
margin-top: 36px;
|
|
15
|
+
|
|
15
16
|
:global {
|
|
16
17
|
.ant-drawer-content {
|
|
17
18
|
background: #f8f9fc;
|
|
19
|
+
|
|
18
20
|
div.ant-drawer-header {
|
|
19
21
|
padding-bottom: unset;
|
|
20
22
|
border-bottom: unset;
|
|
@@ -24,6 +26,7 @@
|
|
|
24
26
|
flex: unset;
|
|
25
27
|
}
|
|
26
28
|
}
|
|
29
|
+
|
|
27
30
|
.ant-drawer-body{
|
|
28
31
|
display: flex;
|
|
29
32
|
flex-direction: column;
|
|
@@ -32,7 +32,9 @@ var CodeRunner = function CodeRunner(_ref) {
|
|
|
32
32
|
replaceId = _ref.replaceId,
|
|
33
33
|
isPlayground = _ref.isPlayground,
|
|
34
34
|
_ref$notFound = _ref.notFound,
|
|
35
|
-
notFound = _ref$notFound === void 0 ? /*#__PURE__*/React.createElement(NotFound, null) : _ref$notFound
|
|
35
|
+
notFound = _ref$notFound === void 0 ? /*#__PURE__*/React.createElement(NotFound, null) : _ref$notFound,
|
|
36
|
+
_ref$showAI = _ref.showAI,
|
|
37
|
+
showAI = _ref$showAI === void 0 ? true : _ref$showAI;
|
|
36
38
|
var demoInfo = getDemoInfo(exampleTopics, topic, example, demo);
|
|
37
39
|
|
|
38
40
|
// 找不到,啥也别干了,404 页面
|
|
@@ -80,7 +82,8 @@ var CodeRunner = function CodeRunner(_ref) {
|
|
|
80
82
|
onDestroy: noop,
|
|
81
83
|
onReady: noop,
|
|
82
84
|
playground: playground,
|
|
83
|
-
title: ic(title)
|
|
85
|
+
title: ic(title),
|
|
86
|
+
showAI: showAI
|
|
84
87
|
}))));
|
|
85
88
|
};
|
|
86
89
|
export default CodeRunner;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
.news {
|
|
2
2
|
width: 50%;
|
|
3
3
|
margin-right: 2%;
|
|
4
|
-
background-color: #
|
|
4
|
+
background-color: #fff;
|
|
5
5
|
border: 1px solid #e5e8ef;
|
|
6
|
-
box-shadow: 0 8px 28px 0 rgba(0, 0, 0,
|
|
6
|
+
box-shadow: 0 8px 28px 0 rgba(0, 0, 0, 5%);
|
|
7
7
|
border-radius: 16px;
|
|
8
8
|
height: 100%;
|
|
9
9
|
font-size: 14px;
|
|
@@ -91,13 +91,13 @@
|
|
|
91
91
|
@keyframes showAndHide0 {
|
|
92
92
|
0% {
|
|
93
93
|
opacity: 1;
|
|
94
|
-
top:
|
|
94
|
+
top: 0;
|
|
95
95
|
z-index: 1;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
33.3% {
|
|
99
99
|
opacity: 0;
|
|
100
|
-
top:
|
|
100
|
+
top: 0;
|
|
101
101
|
z-index: 0;
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
|
|
110
110
|
100% {
|
|
111
111
|
opacity: 1;
|
|
112
|
-
top:
|
|
112
|
+
top: 0;
|
|
113
113
|
z-index: 1;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -123,13 +123,13 @@
|
|
|
123
123
|
|
|
124
124
|
33.3% {
|
|
125
125
|
opacity: 1;
|
|
126
|
-
top:
|
|
126
|
+
top: 0;
|
|
127
127
|
z-index: 1;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
66.6% {
|
|
131
131
|
opacity: 0;
|
|
132
|
-
top:
|
|
132
|
+
top: 0;
|
|
133
133
|
z-index: 0;
|
|
134
134
|
}
|
|
135
135
|
|
|
@@ -155,13 +155,13 @@
|
|
|
155
155
|
|
|
156
156
|
66.6% {
|
|
157
157
|
opacity: 1;
|
|
158
|
-
top:
|
|
158
|
+
top: 0;
|
|
159
159
|
z-index: 1;
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
100% {
|
|
163
163
|
opacity: 0;
|
|
164
|
-
top:
|
|
164
|
+
top: 0;
|
|
165
165
|
z-index: 0;
|
|
166
166
|
}
|
|
167
167
|
}
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
.wrapper {
|
|
4
4
|
min-height: 1000px;
|
|
5
5
|
max-height: 1150px;
|
|
6
|
-
background: linear-gradient(225deg, #
|
|
6
|
+
background: linear-gradient(225deg, #fff, #f0f5ff);
|
|
7
7
|
height: calc(94vh);
|
|
8
8
|
position: relative;
|
|
9
9
|
overflow: hidden;
|
|
10
10
|
|
|
11
11
|
.content {
|
|
12
12
|
.container1440();
|
|
13
|
+
|
|
13
14
|
height: 100%;
|
|
14
15
|
position: relative;
|
|
15
16
|
}
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
|
|
29
30
|
.title {
|
|
30
31
|
font-size: 3.4em; //2.875em;
|
|
31
|
-
color: rgba(0, 0, 0,
|
|
32
|
+
color: rgba(0, 0, 0, 100%);
|
|
32
33
|
position: relative;
|
|
33
34
|
font-family: AlibabaPuHuiTiRHeavy;
|
|
34
35
|
|
|
@@ -39,8 +40,7 @@
|
|
|
39
40
|
|
|
40
41
|
.description {
|
|
41
42
|
margin-top: 0.83%; //12px;
|
|
42
|
-
margin-bottom:
|
|
43
|
-
color: rgba(106, 123, 140, 1);
|
|
43
|
+
margin-bottom: 0;
|
|
44
44
|
font-weight: 200;
|
|
45
45
|
position: relative;
|
|
46
46
|
width: 40%;
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
overflow: hidden;
|
|
53
53
|
text-overflow: ellipsis;
|
|
54
54
|
-webkit-line-clamp: 4;
|
|
55
|
-
display:
|
|
55
|
+
display: box;
|
|
56
56
|
-webkit-box-orient: vertical;
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -64,7 +64,6 @@
|
|
|
64
64
|
display: flex;
|
|
65
65
|
align-items: center;
|
|
66
66
|
justify-content: center;
|
|
67
|
-
cursor: pointer;
|
|
68
67
|
border-radius: 12px;
|
|
69
68
|
z-index: 10;
|
|
70
69
|
position: relative;
|
|
@@ -73,13 +72,12 @@
|
|
|
73
72
|
height: 54px;
|
|
74
73
|
min-width: 166px;
|
|
75
74
|
padding: 0 10px;
|
|
76
|
-
box-shadow: 0 8px 28px 0 rgba(0, 0, 0, 0.1);
|
|
77
75
|
background-color: #691eff;
|
|
78
76
|
font-size: 18px;
|
|
79
77
|
cursor: pointer;
|
|
80
78
|
box-shadow: 0 8px 28px 0 #f2f2f2;
|
|
81
79
|
margin-right: 20px;
|
|
82
|
-
color: #
|
|
80
|
+
color: #fff;
|
|
83
81
|
overflow: hidden;
|
|
84
82
|
|
|
85
83
|
.icon {
|
|
@@ -94,8 +92,7 @@
|
|
|
94
92
|
}
|
|
95
93
|
|
|
96
94
|
&.primary {
|
|
97
|
-
color: #fff;
|
|
98
|
-
background-color: #ffffff;
|
|
95
|
+
background-color: #fff;
|
|
99
96
|
color: #000;
|
|
100
97
|
border: 1px solid #e8e8e8;
|
|
101
98
|
|
|
@@ -123,8 +120,8 @@
|
|
|
123
120
|
display: flex;
|
|
124
121
|
height: 54px;
|
|
125
122
|
cursor: pointer;
|
|
126
|
-
box-shadow: 0 8px 28px 0 rgba(0, 0, 0,
|
|
127
|
-
background-color: #
|
|
123
|
+
box-shadow: 0 8px 28px 0 rgba(0, 0, 0, 5%);
|
|
124
|
+
background-color: #fff;
|
|
128
125
|
border: 1px solid #e8e8e8;
|
|
129
126
|
justify-content: center;
|
|
130
127
|
align-items: center;
|
|
@@ -146,6 +143,7 @@
|
|
|
146
143
|
|
|
147
144
|
.gh-btn {
|
|
148
145
|
padding: 16px;
|
|
146
|
+
|
|
149
147
|
.gh-ico {
|
|
150
148
|
display: block;
|
|
151
149
|
width: 20px;
|
|
@@ -172,7 +170,7 @@
|
|
|
172
170
|
margin-left: -8px;
|
|
173
171
|
color: #1d2129;
|
|
174
172
|
letter-spacing: 0;
|
|
175
|
-
font-family: AlibabaSans102-Medium;
|
|
173
|
+
font-family: "AlibabaSans102-Medium";
|
|
176
174
|
}
|
|
177
175
|
}
|
|
178
176
|
}
|
|
@@ -195,7 +193,6 @@
|
|
|
195
193
|
display: flex;
|
|
196
194
|
position: absolute;
|
|
197
195
|
right: 0;
|
|
198
|
-
margin-top: -300px;
|
|
199
196
|
width: 32%;
|
|
200
197
|
max-width: 598px;
|
|
201
198
|
height: 324px;
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
z-index: 1;
|
|
12
12
|
top: 0;
|
|
13
13
|
height: 100%;
|
|
14
|
-
box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0);
|
|
14
|
+
box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0%);
|
|
15
15
|
width: 1px;
|
|
16
16
|
transition: all 0.3s;
|
|
17
17
|
}
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
user-select: none;
|
|
46
46
|
background-color: #fff;
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
&::after {
|
|
49
49
|
transition: all 0.3s;
|
|
50
50
|
background-color: transparent;
|
|
51
51
|
border: 1px solid transparent;
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
&:hover {
|
|
61
61
|
border-color: var(--primary-color);
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
&::before {
|
|
64
64
|
transition: all 0.3s;
|
|
65
65
|
content: '';
|
|
66
66
|
position: absolute;
|
|
@@ -127,7 +127,6 @@
|
|
|
127
127
|
display: inline-block;
|
|
128
128
|
width: 100%;
|
|
129
129
|
vertical-align: bottom;
|
|
130
|
-
|
|
131
130
|
overflow: hidden;
|
|
132
131
|
text-overflow: ellipsis;
|
|
133
132
|
white-space: nowrap;
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
display: flex;
|
|
37
37
|
justify-content: center;
|
|
38
38
|
font-size: 14px;
|
|
39
|
-
border-bottom: 1px solid rgba(255, 255, 255,
|
|
39
|
+
border-bottom: 1px solid rgba(255, 255, 255, 25%);
|
|
40
40
|
margin-bottom: 16px;
|
|
41
41
|
box-sizing: border-box;
|
|
42
42
|
padding-bottom: 16px;
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
:global(.anticon),
|
|
73
73
|
a {
|
|
74
74
|
margin-right: 8px;
|
|
75
|
-
color: rgba(255, 255, 255,
|
|
75
|
+
color: rgba(255, 255, 255, 60%);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
&.light {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
ul {
|
|
58
58
|
list-style: none;
|
|
59
59
|
padding: 0;
|
|
60
|
-
margin: 0 0 20px
|
|
60
|
+
margin: 0 0 20px;
|
|
61
61
|
|
|
62
62
|
&:last-child {
|
|
63
63
|
margin-bottom: 32px;
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
margin-bottom: 4px;
|
|
88
88
|
font-size: 14px;
|
|
89
89
|
line-height: 22px;
|
|
90
|
-
color: rgba(0, 0, 0,
|
|
90
|
+
color: rgba(0, 0, 0, 85%);
|
|
91
91
|
transition: all 0.3s;
|
|
92
92
|
|
|
93
93
|
&:hover {
|
|
@@ -3,6 +3,8 @@ import React from 'react';
|
|
|
3
3
|
import styles from "./SearchResult.module.less";
|
|
4
4
|
import classnames from "classnames";
|
|
5
5
|
import { createNewSession } from "../../../model/AIChat";
|
|
6
|
+
import { authStore, showLoginModal } from "../../../model/auth";
|
|
7
|
+
import { useSnapshot } from "valtio";
|
|
6
8
|
var getHighlightInfo = function getHighlightInfo(textSegments) {
|
|
7
9
|
return /*#__PURE__*/React.createElement(React.Fragment, null, textSegments.map(function (segment) {
|
|
8
10
|
return /*#__PURE__*/React.createElement("span", {
|
|
@@ -21,6 +23,16 @@ export var SearchResult = function SearchResult(_ref) {
|
|
|
21
23
|
var _useSiteData = useSiteData(),
|
|
22
24
|
themeConfig = _useSiteData.themeConfig;
|
|
23
25
|
var intl = useIntl();
|
|
26
|
+
var authSnap = useSnapshot(authStore);
|
|
27
|
+
function pureSearch() {
|
|
28
|
+
createNewSession({
|
|
29
|
+
promptText: keywords,
|
|
30
|
+
mode: 'solve',
|
|
31
|
+
lib: !themeConfig.isAntVSite ? themeConfig.title : undefined,
|
|
32
|
+
jump: true,
|
|
33
|
+
lang: intl.locale === 'zh' ? 'zh' : 'en'
|
|
34
|
+
});
|
|
35
|
+
}
|
|
24
36
|
return /*#__PURE__*/React.createElement("div", {
|
|
25
37
|
className: styles.searchResult
|
|
26
38
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -35,20 +47,23 @@ export var SearchResult = function SearchResult(_ref) {
|
|
|
35
47
|
}), /*#__PURE__*/React.createElement("a", {
|
|
36
48
|
className: styles.result,
|
|
37
49
|
onClick: function onClick() {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
});
|
|
50
|
+
if (!authSnap.isAuthenticated) {
|
|
51
|
+
showLoginModal(pureSearch);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
pureSearch();
|
|
44
55
|
}
|
|
45
56
|
}, /*#__PURE__*/React.createElement("div", {
|
|
46
57
|
className: classnames(styles.title, styles.highlighted)
|
|
47
58
|
}, keywords), /*#__PURE__*/React.createElement("div", {
|
|
48
59
|
className: styles.description
|
|
49
|
-
},
|
|
60
|
+
}, intl.formatMessage({
|
|
61
|
+
id: 'ai.search.try'
|
|
62
|
+
}), "\xA0", /*#__PURE__*/React.createElement("span", {
|
|
50
63
|
className: styles.highlighted
|
|
51
|
-
}, "AI"), "\xA0
|
|
64
|
+
}, "AI"), "\xA0", intl.formatMessage({
|
|
65
|
+
id: 'ai.search.visualization'
|
|
66
|
+
})))), results !== null && results !== void 0 && results.length ? results.map(function (r, index) {
|
|
52
67
|
return /*#__PURE__*/React.createElement("div", {
|
|
53
68
|
className: styles.item,
|
|
54
69
|
key: index
|
|
@@ -13,7 +13,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
13
13
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
14
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
15
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
-
import { CaretDownFilled, DownOutlined, GithubOutlined, LinkOutlined, MenuOutlined, WechatOutlined } from '@ant-design/icons';
|
|
16
|
+
import { CaretDownFilled, DownOutlined, GithubOutlined, LinkOutlined, LogoutOutlined, MenuOutlined, UserDeleteOutlined, WechatOutlined } from '@ant-design/icons';
|
|
17
17
|
import { Alert, Button, Dropdown, Menu, Modal, Popover } from 'antd';
|
|
18
18
|
import cx from 'classnames';
|
|
19
19
|
import { FormattedMessage, Link, useLocale, useSiteData } from 'dumi';
|
|
@@ -26,11 +26,15 @@ import { Navs } from "./Navs";
|
|
|
26
26
|
import { Products } from "./Products";
|
|
27
27
|
import { Search } from "./Search";
|
|
28
28
|
import { findVersion } from "./utils";
|
|
29
|
+
import { ReactComponent as UserIcon } from "../../static/user.svg";
|
|
29
30
|
import { Assistant } from '@petercatai/assistant';
|
|
30
31
|
import '@petercatai/assistant/style';
|
|
31
32
|
import { useLocation } from 'react-router-dom';
|
|
32
33
|
import { determineUserType } from "../../utils/user";
|
|
33
34
|
import styles from "./index.module.less";
|
|
35
|
+
import { useSnapshot } from "valtio";
|
|
36
|
+
import { authStore, logout } from "../../model/auth";
|
|
37
|
+
import { clearAllChatData } from "../../model/AIChat";
|
|
34
38
|
function redirectChinaMirror(chinaMirrorOrigin) {
|
|
35
39
|
window.location.href = window.location.href.replace(window.location.origin, chinaMirrorOrigin);
|
|
36
40
|
}
|
|
@@ -76,7 +80,7 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
76
80
|
ecosystems = _ref.ecosystems,
|
|
77
81
|
announcement = _ref.announcement;
|
|
78
82
|
var isAntVHome = isAntVSite && isHomePage; // 是否为AntV官网首页
|
|
79
|
-
|
|
83
|
+
var authSnap = useSnapshot(authStore);
|
|
80
84
|
var _useState = useState(false),
|
|
81
85
|
_useState2 = _slicedToArray(_useState, 2),
|
|
82
86
|
bannerVisible = _useState2[0],
|
|
@@ -195,7 +199,9 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
195
199
|
href: href,
|
|
196
200
|
target: "_blank",
|
|
197
201
|
rel: "noreferrer"
|
|
198
|
-
},
|
|
202
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
203
|
+
id: "header.ai.code"
|
|
204
|
+
})));
|
|
199
205
|
}, [isInternalUser, showWeavefox]);
|
|
200
206
|
var menu = /*#__PURE__*/React.createElement("ul", {
|
|
201
207
|
className: cx(styles.menu, _defineProperty(_defineProperty({}, styles.popup, !isWide), styles.popupHidden, !popupMenuVisible))
|
|
@@ -235,7 +241,9 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
235
241
|
style: {
|
|
236
242
|
marginRight: '8px'
|
|
237
243
|
}
|
|
238
|
-
}, "\uD83C\uDDE8\uD83C\uDDF3"),
|
|
244
|
+
}, "\uD83C\uDDE8\uD83C\uDDF3"), /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
245
|
+
id: "header.china.mirror.title"
|
|
246
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
239
247
|
style: {
|
|
240
248
|
marginTop: 16,
|
|
241
249
|
textAlign: 'right'
|
|
@@ -248,14 +256,18 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
248
256
|
style: {
|
|
249
257
|
marginRight: 8
|
|
250
258
|
}
|
|
251
|
-
},
|
|
259
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
260
|
+
id: "header.china.mirror.temp.close"
|
|
261
|
+
})), /*#__PURE__*/React.createElement(Button, {
|
|
252
262
|
type: "primary",
|
|
253
263
|
size: "small",
|
|
254
264
|
onClick: function onClick() {
|
|
255
265
|
localStorage.setItem('china-mirror-no-more-hint', Date.now().toString());
|
|
256
266
|
updateChinaMirrorHintVisible(false);
|
|
257
267
|
}
|
|
258
|
-
},
|
|
268
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
269
|
+
id: "header.china.mirror.no.more"
|
|
270
|
+
})))),
|
|
259
271
|
open: chinaMirrorHintVisible,
|
|
260
272
|
placement: "bottomRight",
|
|
261
273
|
align: {
|
|
@@ -273,8 +285,12 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
273
285
|
}
|
|
274
286
|
})))) : null, showChinaMirror && !isWide && /*#__PURE__*/React.createElement(Modal, {
|
|
275
287
|
open: chinaMirrorHintVisible,
|
|
276
|
-
cancelText:
|
|
277
|
-
|
|
288
|
+
cancelText: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
289
|
+
id: "header.china.mirror.no.more"
|
|
290
|
+
}),
|
|
291
|
+
okText: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
292
|
+
id: "header.china.mirror.temp.close"
|
|
293
|
+
}),
|
|
278
294
|
onCancel: function onCancel() {
|
|
279
295
|
updateChinaMirrorHintVisible(false);
|
|
280
296
|
},
|
|
@@ -292,7 +308,9 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
292
308
|
}, /*#__PURE__*/React.createElement("span", {
|
|
293
309
|
role: "img",
|
|
294
310
|
"aria-labelledby": "\u4E2D\u56FD"
|
|
295
|
-
}, "\uD83C\uDDE8\uD83C\uDDF3"),
|
|
311
|
+
}, "\uD83C\uDDE8\uD83C\uDDF3"), /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
312
|
+
id: "header.china.mirror.title"
|
|
313
|
+
}), /*#__PURE__*/React.createElement("a", {
|
|
296
314
|
href: chinaMirrorUrl,
|
|
297
315
|
onClick: function onClick(e) {
|
|
298
316
|
e.preventDefault();
|
|
@@ -370,7 +388,9 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
370
388
|
src: "https://gw.alipayobjects.com/zos/antfincdn/ZKlx96dsfs/qrcode_for_gh_f52d8b6aa591_258.jpg",
|
|
371
389
|
alt: "wx-qrcode"
|
|
372
390
|
}),
|
|
373
|
-
title:
|
|
391
|
+
title: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
392
|
+
id: "header.wx.qrcode.title"
|
|
393
|
+
}),
|
|
374
394
|
styles: {
|
|
375
395
|
body: {
|
|
376
396
|
padding: 2
|
|
@@ -387,7 +407,32 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
387
407
|
href: githubUrl,
|
|
388
408
|
target: "_blank",
|
|
389
409
|
rel: "noreferrer"
|
|
390
|
-
}, /*#__PURE__*/React.createElement(GithubOutlined, null)))
|
|
410
|
+
}, /*#__PURE__*/React.createElement(GithubOutlined, null))), authSnap.isAuthenticated && /*#__PURE__*/React.createElement("li", {
|
|
411
|
+
className: cx(styles.navIcon, styles.githubCorner)
|
|
412
|
+
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
413
|
+
menu: {
|
|
414
|
+
items: [{
|
|
415
|
+
key: 'logout',
|
|
416
|
+
label: /*#__PURE__*/React.createElement("a", {
|
|
417
|
+
onClick: function onClick() {
|
|
418
|
+
return logout();
|
|
419
|
+
}
|
|
420
|
+
}, "\u9000\u51FA\u767B\u5F55"),
|
|
421
|
+
icon: /*#__PURE__*/React.createElement(LogoutOutlined, null)
|
|
422
|
+
}, {
|
|
423
|
+
key: 'deleteAccount',
|
|
424
|
+
label: /*#__PURE__*/React.createElement("a", {
|
|
425
|
+
onClick: function onClick() {
|
|
426
|
+
logout();
|
|
427
|
+
clearAllChatData();
|
|
428
|
+
}
|
|
429
|
+
}, "\u6CE8\u9500\u8D26\u53F7"),
|
|
430
|
+
icon: /*#__PURE__*/React.createElement(UserDeleteOutlined, null)
|
|
431
|
+
}]
|
|
432
|
+
}
|
|
433
|
+
}, /*#__PURE__*/React.createElement("a", null, /*#__PURE__*/React.createElement(UserIcon, {
|
|
434
|
+
className: styles.userIcon
|
|
435
|
+
})))));
|
|
391
436
|
return /*#__PURE__*/React.createElement("header", {
|
|
392
437
|
className: cx(styles.header, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles.transparent, !!transparent && !productMenuVisible), styles.isHomePage, !!isHomePage && !isAntVHome), styles.lightTheme, !!isAntVHome && !productMenuVisible && isWide), styles.isAntVHome, !!isAntVHome), styles.fixed, popupMenuVisible))
|
|
393
438
|
}, bannerVisible && announcementTitle && /*#__PURE__*/React.createElement(Alert, {
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
.container {
|
|
66
66
|
max-width: 100%;
|
|
67
67
|
padding: 0 20px;
|
|
68
|
-
border-bottom: 1px solid rgba(0, 0, 0,
|
|
68
|
+
border-bottom: 1px solid rgba(0, 0, 0, 10%);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
.nav {
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
|
|
88
88
|
&:hover {
|
|
89
89
|
background: #fff;
|
|
90
|
-
box-shadow: 0 2px 5px 0 rgba(0, 0, 0,
|
|
90
|
+
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 10%);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
}
|
|
@@ -174,11 +174,11 @@
|
|
|
174
174
|
font-size: 18px;
|
|
175
175
|
|
|
176
176
|
a {
|
|
177
|
-
color: rgba(0, 0, 0,
|
|
177
|
+
color: rgba(0, 0, 0, 85%);
|
|
178
178
|
transition: all 0.3s;
|
|
179
179
|
|
|
180
180
|
&:hover {
|
|
181
|
-
color: rgba(0, 0, 0,
|
|
181
|
+
color: rgba(0, 0, 0, 100%);
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
}
|
|
@@ -400,7 +400,7 @@
|
|
|
400
400
|
}
|
|
401
401
|
|
|
402
402
|
.remindHref {
|
|
403
|
-
margin:
|
|
403
|
+
margin: 0 6px 0 5px;
|
|
404
404
|
}
|
|
405
405
|
|
|
406
406
|
.modalContent {
|
|
@@ -460,3 +460,11 @@
|
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
+
|
|
464
|
+
.userIcon {
|
|
465
|
+
font-size: 16px;
|
|
466
|
+
width: 1em;
|
|
467
|
+
height: 1em;
|
|
468
|
+
vertical-align: -0.2em;
|
|
469
|
+
fill: currentColor;
|
|
470
|
+
}
|