Skip to content

Commit d2f816b

Browse files
authored
fix: UI issues & add experience questionnaire entries (#56)
1 parent 7b8962b commit d2f816b

File tree

8 files changed

+181
-112
lines changed

8 files changed

+181
-112
lines changed

media/src/components/APIPage/API.tsx

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @description
44
*/
55
import { Tab, Tag } from "@alicloud/console-components";
6-
import { Segmented } from "antd";
6+
import { Segmented, notification } from "antd";
77
import _ from "lodash";
88
import * as PontSpec from "pontx-spec";
99
import * as React from "react";
@@ -19,6 +19,7 @@ import { ApiParamsDoc } from "./APIDocument/ApiParamsDoc";
1919
import { TryAPI } from "./TryAPI/TryAPI";
2020
import TrySDK from "./TrySDK/TrySDK";
2121
import { APIPageContext } from "./context";
22+
import { PontUIService } from "../../service/UIService";
2223

2324
export class APIProps {
2425
selectedApi?: PontSpec.PontAPI;
@@ -141,7 +142,7 @@ export const API: React.FC<APIProps> = (props) => {
141142
const renderContent = React.useMemo(() => {
142143
const documentComp = (
143144
<div>
144-
{selectedApi?.description ? (
145+
{selectedApi?.description && selectedApi?.description !== selectedApi?.summary ? (
145146
<div className="mb-4 bg-white p-4">
146147
<SemixMarkdown source={selectedApi?.description} />
147148
</div>
@@ -226,6 +227,31 @@ export const API: React.FC<APIProps> = (props) => {
226227
}
227228
}, [mode, boxWidth, isExpand]);
228229

230+
const openNotification = () => {
231+
notification.open({
232+
message: "体验调研",
233+
duration: null,
234+
description: (
235+
<span>
236+
您对插件的使用体验满意吗?点击
237+
<a href="https://g.alicdn.com/aes/tracker-survey-preview/0.0.13/survey.html?pid=fePxMy&id=3486">体验问卷</a>
238+
进行吐槽或夸赞,您的反馈对我们十分重要!
239+
</span>
240+
),
241+
onClose: () => {
242+
PontUIService.updateQuestionnaireExpiration(14);
243+
},
244+
});
245+
};
246+
247+
React.useEffect(() => {
248+
PontUIService.getNoticeFlag().then((res) => {
249+
if (res === true) {
250+
openNotification();
251+
}
252+
});
253+
}, []);
254+
229255
return (
230256
<div className="bg-gray-100 pb-4" ref={pageEl}>
231257
{/* */}
@@ -262,7 +288,7 @@ export const API: React.FC<APIProps> = (props) => {
262288
</div>
263289
</div>
264290
{selectedApi?.summary ? (
265-
<div className="py-2 text-sm font-normal text-gray-500" style={{ width: "100%" }}>
291+
<div className="ml-2 py-2 text-sm font-normal text-gray-500" style={{ width: "100%" }}>
266292
{selectedApi?.summary}
267293
</div>
268294
) : null}

media/src/components/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const App: React.FC<AppProps> = (props) => {
3737
const [appMeta, setAppMeta] = React.useState(props.routerMeta);
3838
const { pageType, schemaType, specName, modName, name, spec: metaSpec, remoteSpec } = appMeta || {};
3939

40-
const {product:popcode,version} = getSpecInfoFromName(specName || "");
40+
const { product: popcode, version } = getSpecInfoFromName(specName || "");
4141

4242
const [itemMeta, setItemMeta] = React.useState(metaSpec);
4343
const [defs, setDefs] = React.useState({});

media/src/pages/_app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { AppProps } from "next/app";
22
import "./document/index.module.scss";
33
import "./document/index.scss";
44
import "../styles/globals.css";
5-
import "../main.css"
5+
import "../main.css";
66
import "@alicloud/console-components/dist/wind.css";
77
import React from "react";
88

media/src/service/UIService.ts

Lines changed: 66 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -4,67 +4,71 @@ import { MakeCodeResponse, OpenAPIResponse } from "../types/openAPI";
44
/** 不同使用场景,各自注册服务来源 */
55
const defaultSpecs: any[] = [];
66
export const PontUIService = {
7-
/** 获取本地元数据列表 */
8-
requestPontSpecs: async () => {
9-
return {
10-
localSpecs: defaultSpecs as any[] as PontSpec[],
11-
remoteSpecs: defaultSpecs as any[] as PontSpec[],
12-
currentOriginName: "",
13-
};
14-
},
15-
16-
requestDefinitions: async (specName: string) => {
17-
return {} as any;
18-
},
19-
20-
/** 获取 本地/远程 的diff信息 */
21-
requestDiffs: async () => {
22-
return [] as any;
23-
},
24-
25-
/** 重新生成SDK */
26-
requestGenerateSdk: async (): Promise<void> => {},
27-
28-
/** 重新拉取远程数据源 */
29-
syncRemoteSpec: async (specNames = ""): Promise<void> => {},
30-
31-
updateLocalSpec: async (spec: PontSpec): Promise<void> => {},
32-
33-
/** 更新本地数据源 */
34-
updateSpecBySpecNames: async (specNames = ""): Promise<void> => {},
35-
36-
/** 更新本地模块 */
37-
updateMod: async (modName: string, specName = ""): Promise<void> => {},
38-
39-
/** 更新本地 API */
40-
updateAPI: async (modName: string, apiName: string, specName = ""): Promise<void> => {},
41-
42-
/** 更新类 */
43-
updateBaseClass: async (className: string, specName = ""): Promise<void> => {},
44-
45-
openMeta: async (meta: {
46-
name: string;
47-
specName: string;
48-
modName?: string;
49-
type: string;
50-
spec: any;
51-
}): Promise<void> => {},
7+
/** 获取本地元数据列表 */
8+
requestPontSpecs: async () => {
9+
return {
10+
localSpecs: defaultSpecs as any[] as PontSpec[],
11+
remoteSpecs: defaultSpecs as any[] as PontSpec[],
12+
currentOriginName: "",
13+
};
14+
},
5215

53-
/** request openapi */
54-
openAPIRequest: async (params = {}): Promise<OpenAPIResponse> => new OpenAPIResponse,
16+
requestDefinitions: async (specName: string) => {
17+
return {} as any;
18+
},
5519

56-
/** get endpoints list */
57-
requestEndpoints: async (product: string) => {
58-
return [] as any;
59-
},
60-
/** get sdk demo */
61-
makeCodeRequest: async (params = {}): Promise<MakeCodeResponse> => new MakeCodeResponse,
62-
/** get local language */
63-
getLocalLanguage : async () => "",
64-
/** update local language */
65-
updateLocalLanguage : async (language:string) => "",
66-
/** open in ide */
67-
openInCode: async (codeInfo:{code:string,language:string}): Promise<void> => {},
68-
/** save to file */
69-
saveToFile: async (code:string): Promise<void> => {},
70-
};
20+
/** 获取 本地/远程 的diff信息 */
21+
requestDiffs: async () => {
22+
return [] as any;
23+
},
24+
25+
/** 重新生成SDK */
26+
requestGenerateSdk: async (): Promise<void> => {},
27+
28+
/** 重新拉取远程数据源 */
29+
syncRemoteSpec: async (specNames = ""): Promise<void> => {},
30+
31+
updateLocalSpec: async (spec: PontSpec): Promise<void> => {},
32+
33+
/** 更新本地数据源 */
34+
updateSpecBySpecNames: async (specNames = ""): Promise<void> => {},
35+
36+
/** 更新本地模块 */
37+
updateMod: async (modName: string, specName = ""): Promise<void> => {},
38+
39+
/** 更新本地 API */
40+
updateAPI: async (modName: string, apiName: string, specName = ""): Promise<void> => {},
41+
42+
/** 更新类 */
43+
updateBaseClass: async (className: string, specName = ""): Promise<void> => {},
44+
45+
openMeta: async (meta: {
46+
name: string;
47+
specName: string;
48+
modName?: string;
49+
type: string;
50+
spec: any;
51+
}): Promise<void> => {},
52+
53+
/** request openapi */
54+
openAPIRequest: async (params = {}): Promise<OpenAPIResponse> => new OpenAPIResponse(),
55+
56+
/** get endpoints list */
57+
requestEndpoints: async (product: string) => {
58+
return [] as any;
59+
},
60+
/** get sdk demo */
61+
makeCodeRequest: async (params = {}): Promise<MakeCodeResponse> => new MakeCodeResponse(),
62+
/** get local language */
63+
getLocalLanguage: async () => "",
64+
/** update local language */
65+
updateLocalLanguage: async (language: string) => "",
66+
/** open in ide */
67+
openInCode: async (codeInfo: { code: string; language: string }): Promise<void> => {},
68+
/** save to file */
69+
saveToFile: async (code: string): Promise<void> => {},
70+
/** 是否弹出通知框 */
71+
getNoticeFlag: async (): Promise<boolean> => true,
72+
/** 更新体验弹窗弹出的时间 */
73+
updateQuestionnaireExpiration: async (days: number): Promise<void> => {},
74+
};

package.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,15 @@
2525
"title": "导入依赖"
2626
},
2727
{
28-
"command": "alicloud.api.githubIssue",
29-
"title": "feedback",
28+
"command": "alicloud.api.feedback",
29+
"title": "反馈",
3030
"icon": "$(feedback)"
3131
},
32+
{
33+
"command": "alicloud.api.githubIssue",
34+
"title": "Issues",
35+
"icon": "$(issues)"
36+
},
3237
{
3338
"command": "alicloud.api.findInterface",
3439
"title": "查找 API",
@@ -178,6 +183,11 @@
178183
"command": "alicloud.api.githubIssue",
179184
"when": "view == alicloudApiExplorer",
180185
"group": "navigation@4"
186+
},
187+
{
188+
"command": "alicloud.api.feedback",
189+
"when": "view == alicloudApiExplorer",
190+
"group": "navigation@5"
181191
}
182192
],
183193
"view/item/context": [

0 commit comments

Comments
 (0)