Skip to content

Commit 51b0cbc

Browse files
authored
feat: adjust feedback (#1977)
1 parent 7face1d commit 51b0cbc

File tree

5 files changed

+142
-34
lines changed

5 files changed

+142
-34
lines changed

i18n/en/code.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,5 +728,13 @@
728728
"Reads data from Iceberg, Hive, and Delta Lake seamlessly.": {
729729
"message": "Reads data from Iceberg, Hive, and Delta Lake seamlessly.",
730730
"description": "Description for data lake support card"
731+
},
732+
"NoDesc": {
733+
"message": "No",
734+
"description": "NoDesc"
735+
},
736+
"Please describe the specific errors or issues that": {
737+
"message": "Please describe the specific errors or issues that you have identified in the document (such as: content mistakes, process getting stuck and unable to proceed, layout problems, broken links, etc.)",
738+
"description": "Please describe the specific errors or issues that you have identified in the document (such as: content mistakes, process getting stuck and unable to proceed, layout problems, broken links, etc.)"
731739
}
732740
}

i18n/zh/code.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,19 +402,19 @@
402402
"description": "The title of the tag list page"
403403
},
404404
"Leave an optional comment…": {
405-
"message": "留下您宝贵的意见…",
405+
"message": "意见/建议/文档错误",
406406
"description": "Leave an optional comment…"
407407
},
408408
"Vote": {
409-
"message": "确认",
409+
"message": "提交反馈",
410410
"description": "Vote"
411411
},
412412
"Thanks for voting!": {
413413
"message": "感谢您的反馈!",
414414
"description": "Thanks for voting!"
415415
},
416416
"Did this page help you?": {
417-
"message": "这篇文章对您有帮助吗?",
417+
"message": "指出文档中的错误或问题,我们将会赠予您专属纪念 T 恤一件!",
418418
"description": "Did this page help you?"
419419
},
420420
"Explore Databend Cloud for FREE": {
@@ -744,5 +744,13 @@
744744
"Reads data from Iceberg, Hive, and Delta Lake seamlessly.": {
745745
"message": "支持读取 Iceberg、Hive、Delta Lake 中数据。",
746746
"description": "Description for data lake support card"
747+
},
748+
"NoDesc": {
749+
"message": "问题反馈",
750+
"description": "NoDesc"
751+
},
752+
"Please describe the specific errors or issues that": {
753+
"message": "请描述您在文档中发现的具体错误或问题(例如:内容错误、流程卡住走不通、排版问题、链接失效等)",
754+
"description": "Please describe the specific errors or issues that you have identified in the document (such as: content mistakes, process getting stuck and unable to proceed, layout problems, broken links, etc.)"
747755
}
748756
}

src/css/custom.scss

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,3 +325,31 @@ div[class*="searchQueryColumn"] {
325325
flex: 1;
326326
}
327327
}
328+
329+
.ant-input-outlined {
330+
border-color: transparent !important;
331+
background: var(--color-bg-0) !important;
332+
&:focus {
333+
border-color: var(--color-primary) !important;
334+
}
335+
}
336+
.ant-input-lg,
337+
.ant-input {
338+
font-size: 12px;
339+
&::placeholder {
340+
color: var(--color-text-2);
341+
}
342+
}
343+
.ant-alert {
344+
color: var(--color-text-1) !important;
345+
}
346+
.ant-btn-lg {
347+
font-size: 14px;
348+
}
349+
.ant-alert {
350+
border: unset;
351+
font-size: 12px;
352+
}
353+
textarea {
354+
padding-top: 12px !important;
355+
}

src/theme/DocPaginator/index.tsx

Lines changed: 80 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,82 @@
11
import React, { useState } from "react";
22
import { translate } from "@docusaurus/Translate";
3-
// import PaginatorNavLink from '@theme/PaginatorNavLink';
43
import $t from "@site/src/utils/tools";
54
import ExecutionEnvironment from "@docusaurus/ExecutionEnvironment";
65
import JoinCommunity from "@site/src/components/JoinCommunity";
76
import styles from "./styles.module.scss";
87
import Link from "@docusaurus/Link";
98
import { LoadingOutlined } from "@ant-design/icons";
10-
import { Popover, Button, Spin, Input } from "antd";
9+
import { Popover, Button, Spin, Input, Form, Alert } from "antd";
1110
import ArrowLeft from "@site/static/icons/arrowleft.svg";
1211
import ArrowRight from "@site/static/icons/arrowright.svg";
1312
import { evaluateDocs } from "@site/src/api";
1413
import ThumbsUp from "./ThumbsUp.svg";
1514
import ThumbsDown from "./ThumbsDown.svg";
1615
import clsx from "clsx";
16+
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
1717
const { TextArea } = Input;
1818
export default function DocPaginator(props) {
1919
const { previous, next } = props;
20-
const [commentValue, setCommentValue] = useState("");
2120
const [loading, setLoading] = useState(false);
2221
const [isVoted, setIsVoted] = useState(false);
22+
const [form] = Form.useForm();
23+
const {
24+
siteConfig: {
25+
customFields: { isChina },
26+
},
27+
} = useDocusaurusContext() as any;
2328
function popover() {
2429
return (
2530
<div style={{ width: "390px", textAlign: "center" }}>
26-
<div style={{ marginBottom: "8px", textAlign: "left" }}>
27-
{$t("Leave an optional comment…")}
28-
</div>
29-
<TextArea
30-
value={commentValue}
31-
onChange={(e) => setCommentValue(e?.target?.value)}
32-
rows={5}
33-
></TextArea>
31+
<Form form={form} layout="vertical">
32+
<Form.Item
33+
style={{ marginBottom: "20px" }}
34+
name="commentValue"
35+
label={$t("Leave an optional comment…")}
36+
>
37+
<TextArea
38+
placeholder={$t(
39+
"Please describe the specific errors or issues that"
40+
)}
41+
rows={5}
42+
/>
43+
</Form.Item>
44+
{isChina && (
45+
<>
46+
<Form.Item
47+
name={"name"}
48+
style={{ marginBottom: "16px", marginTop: "12px" }}
49+
label={$t("领取人信息")}
50+
>
51+
<Input size="large" placeholder="您的姓名" />
52+
</Form.Item>
53+
<Form.Item
54+
name={"contact"}
55+
style={{ marginBottom: "20px" }}
56+
label=""
57+
>
58+
<Input
59+
size="large"
60+
placeholder="您的联系方式:邮箱或电话号码"
61+
/>
62+
</Form.Item>
63+
</>
64+
)}
65+
</Form>
66+
{isChina && (
67+
<Alert
68+
message={
69+
"帮助我们改进文档!如果您在阅读过程中发现任何错误,请在此处告知我们。留下您的联系方式,我们将与您确认问题并及时修复,感谢您的支持!"
70+
}
71+
style={{ textAlign: "left", marginBottom: "20px" }}
72+
type="info"
73+
></Alert>
74+
)}
3475
<Button
3576
loading={loading}
77+
size="large"
3678
onClick={() => submitInfo("No")}
37-
style={{ marginTop: "16px", fontWeight: 700 }}
79+
style={{ fontWeight: 700, width: "100%" }}
3880
type="primary"
3981
>
4082
{$t("Vote")}
@@ -46,15 +88,18 @@ export default function DocPaginator(props) {
4688
if (ExecutionEnvironment.canUseDOM) {
4789
try {
4890
setLoading(true);
91+
const values = await form.validateFields();
4992
const res = await evaluateDocs({
5093
domain: window?.location?.origin,
5194
path: window?.location?.pathname,
5295
action: type,
53-
comment: commentValue,
96+
comment: isChina
97+
? `我的建议是:${values?.commentValue}。领取人信息:${
98+
values?.name || "未设置"
99+
}, ${values?.contact || "未设置"}`
100+
: values?.commentValue,
54101
});
55-
console.log(res, "res");
56102
setIsVoted(true);
57-
setCommentValue("");
58103
} finally {
59104
setLoading(false);
60105
}
@@ -70,21 +115,28 @@ export default function DocPaginator(props) {
70115
{isVoted ? (
71116
<span>{$t("Thanks for voting!")}</span>
72117
) : (
73-
<>
118+
<div className={styles.vote}>
74119
<span>{$t("Did this page help you?")}</span>
75-
<div onClick={() => submitInfo("Yes")} className={styles.button}>
76-
<ThumbsUp></ThumbsUp> Yes
120+
<div style={{ display: "flex", justifyContent: "space-between" }}>
121+
{!isChina && (
122+
<div
123+
onClick={() => submitInfo("Yes")}
124+
className={styles.button}
125+
>
126+
<ThumbsUp></ThumbsUp> Yes
127+
</div>
128+
)}
129+
<Popover
130+
showArrow={false}
131+
trigger={["click"]}
132+
content={popover()}
133+
>
134+
<div className={styles.button}>
135+
{!isChina && <ThumbsDown></ThumbsDown>} {$t("NoDesc")}
136+
</div>
137+
</Popover>
77138
</div>
78-
<Popover
79-
showArrow={false}
80-
trigger={["click"]}
81-
content={popover()}
82-
>
83-
<div className={styles.button}>
84-
<ThumbsDown></ThumbsDown> No
85-
</div>
86-
</Popover>
87-
</>
139+
</div>
88140
)}
89141
</div>
90142
</Spin>

src/theme/DocPaginator/styles.module.scss

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
background-color: var(--color-fill-0);
33
text-align: center;
44
border-radius: 6px;
5-
padding: 12px 6px;
5+
padding: 12px 16px;
66
margin-top: 40px;
77
font-size: 14px;
88
color: var(--color-text-2);
@@ -11,7 +11,6 @@
1111
justify-content: center;
1212
span {
1313
text-align: left;
14-
white-space: nowrap;
1514
}
1615
div.button {
1716
cursor: pointer;
@@ -23,9 +22,10 @@
2322
align-items: center;
2423
justify-content: center;
2524
border-radius: 6px;
26-
font-size: 16px;
25+
font-size: 14px;
2726
font-weight: 700;
2827
line-height: 24px;
28+
color: var(--color-primary);
2929
svg {
3030
margin-right: 12px;
3131
stroke: var(--color-text-1) !important;
@@ -34,6 +34,9 @@
3434
background-color: var(--color-fill-0);
3535
border: 1px solid hsl(var(--border));
3636
}
37+
@media screen and (max-width: 768px) {
38+
margin-top: 12px;
39+
}
3740
}
3841
.title {
3942
color: var(--color-text-1);
@@ -79,3 +82,12 @@
7982
text-decoration: none;
8083
}
8184
}
85+
86+
.vote {
87+
display: flex;
88+
align-items: center;
89+
flex-wrap: wrap;
90+
@media screen and (max-width: 768px) {
91+
flex-direction: column;
92+
}
93+
}

0 commit comments

Comments
 (0)