Skip to content

Commit a3fe7c8

Browse files
authored
feat: Add more ask links (#2929)
* feat: add more ask pages * i18n
1 parent d95c4cc commit a3fe7c8

File tree

6 files changed

+81
-34
lines changed

6 files changed

+81
-34
lines changed

i18n/en/code.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,5 +812,13 @@
812812
"Databend runs the same in Cloud, Docker, or `pip install`.": {
813813
"message": "Databend runs the same in Cloud, Docker, or `pip install`.",
814814
"description": "Description for unified deployment feature"
815+
},
816+
"Ask questions about this page": {
817+
"message": "Ask questions about this page",
818+
"description": "Ask questions about this page"
819+
},
820+
"Open in": {
821+
"message": "Open in",
822+
"description": "Open in"
815823
}
816824
}

i18n/zh/code.json

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"description": "The first paragraph of the 404 page"
2828
},
2929
"theme.NotFound.p2": {
30-
"message": "请联系原始链接来源网站的所有者,并告知他们链接已损坏。",
30+
"message": "请联系原始链接来源网站的所有者并告知他们链接已损坏。",
3131
"description": "The 2nd paragraph of the 404 page"
3232
},
3333
"theme.admonition.note": {
@@ -138,7 +138,7 @@
138138
"description": "The label used to tell the user that he's browsing an unreleased doc version"
139139
},
140140
"theme.docs.versions.unmaintainedVersionLabel": {
141-
"message": "此为 {siteTitle} {versionLabel} 版的文档,现已不再积极维护。",
141+
"message": "此为 {siteTitle} {versionLabel} 版的文档现已不再积极维护。",
142142
"description": "The label used to tell the user that he's browsing an unmaintained doc version"
143143
},
144144
"theme.docs.versions.latestVersionSuggestionLabel": {
@@ -414,7 +414,7 @@
414414
"description": "Thanks for voting!"
415415
},
416416
"Did this page help you?": {
417-
"message": "指出文档中的错误或问题,我们将会赠予您专属纪念 T 恤一件!",
417+
"message": "指出文档中的错误或问题我们将会赠予您专属纪念 T 恤一件!",
418418
"description": "Did this page help you?"
419419
},
420420
"Explore Databend Cloud for FREE": {
@@ -470,15 +470,15 @@
470470
"description": "Cloud Data Analytics"
471471
},
472472
"Databend - Your best alternative to Snowflake. Cost-effective and simple for massive-scale analytics.": {
473-
"message": "Databend - 替代 Snowflake 的最佳方案。高性价比且简单易用,适用于大规模数据分析。",
473+
"message": "Databend - 替代 Snowflake 的最佳方案。高性价比且简单易用适用于大规模数据分析。",
474474
"description": "Databend - Your best alternative to Snowflake. Cost-effective and simple for massive-scale analytics."
475475
},
476476
"PAGE NOT FOUND": {
477477
"message": "页面未找到",
478478
"description": "PAGE NOT FOUND"
479479
},
480480
"Please check your link or head Home to regroup.": {
481-
"message": "页面地址可能有所变更或者不存在,请检查您的链接或返回到操作指南。",
481+
"message": "页面地址可能有所变更或者不存在请检查您的链接或返回到操作指南。",
482482
"description": "Either you're out of bounds or that page doesn't exist. Please check your link or head Home to regroup."
483483
},
484484
"BACK TO HOME": {
@@ -554,7 +554,7 @@
554554
"description": "所有工具的链接文字"
555555
},
556556
"Databend offers connectors and plugins for integrating with major data import tools, ensuring efficient data synchronization.": {
557-
"message": "Databend 提供主流导入工具的连接器与插件,保障高效同步。",
557+
"message": "Databend 提供主流导入工具的连接器与插件保障高效同步。",
558558
"description": "AI & BI & 可视化 & 笔记本 部分的描述"
559559
},
560560
"Continuous Data Pipelines": {
@@ -614,15 +614,15 @@
614614
"description": "Databend Cloud 产品的标题"
615615
},
616616
"Fully-managed cloud service. No setup required.": {
617-
"message": "全托管云服务,开箱即可使用。",
617+
"message": "全托管云服务开箱即可使用。",
618618
"description": "Databend Cloud 产品的描述"
619619
},
620620
"Databend Enterprise": {
621621
"message": "Databend 企业版",
622622
"description": "Databend Enterprise 产品的标题"
623623
},
624624
"Self-hosted with enterprise features and support.": {
625-
"message": "自主部署,配备企业级功能与支持。",
625+
"message": "自主部署配备企业级功能与支持。",
626626
"description": "Databend Enterprise 产品的描述"
627627
},
628628
"Databend Community": {
@@ -766,7 +766,7 @@
766766
"description": "Start with Databend Cloud"
767767
},
768768
"Get started in minutes with our fully-managed cloud service. No setup required.": {
769-
"message": "几分钟即可启用全托管云服务,无需任何额外配置。",
769+
"message": "几分钟即可启用全托管云服务无需任何额外配置。",
770770
"description": "Get started in minutes with our fully-managed cloud service. No setup required."
771771
},
772772
"What you need to know:": {
@@ -790,7 +790,7 @@
790790
"description": "Deploy Your Own Instance"
791791
},
792792
"Install Databend on your infrastructure for complete control and customization.": {
793-
"message": "在自有基础设施上安装 Databend,配置完全可控。",
793+
"message": "在自有基础设施上安装 Databend配置完全可控。",
794794
"description": "Install Databend on your infrastructure for complete control and customization."
795795
},
796796
"5-Minute Quick Start": {
@@ -810,7 +810,7 @@
810810
"description": "Copy Page"
811811
},
812812
"Copy page as Markdown for LLMs": {
813-
"message": "复制为 Markdown 格式,供大语言模型使用",
813+
"message": "复制为 Markdown 格式供大语言模型使用",
814814
"description": "Copy page as Markdown for LLMs"
815815
},
816816
"View as Markdown": {
@@ -840,5 +840,13 @@
840840
"Search & Geo Native": {
841841
"message": "原生搜索与地理",
842842
"description": "Headline for search native feature"
843+
},
844+
"Ask questions about this page": {
845+
"message": "询问关于此页面的问题",
846+
"description": "Ask questions about this page"
847+
},
848+
"Open in": {
849+
"message": "打开",
850+
"description": "Open in"
843851
}
844852
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"prism-react-renderer": "^2.3.0",
5353
"react": "^19.1.0",
5454
"react-dom": "^19.1.0",
55+
"react-icons": "^5.5.0",
5556
"react-markdown": "^9.0.1",
5657
"react-scroll-progress-bar": "^2.0.3",
5758
"react-slick": "^0.31.0",

src/components/CopyPageButton/index.tsx

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ import React, { useState, useMemo, useCallback } from "react";
22
import { Button, Dropdown, Flex, Spin } from "antd";
33
import styles from "./styles.module.scss";
44
import DownArrow from "@site/static/icons/down.svg";
5-
import MarkdownSvg from "@site/static/icons/markdown.svg";
6-
import CopySvg from "@site/static/icons/copy.svg";
7-
import CopiedSvg from "@site/static/icons/copied.svg";
85
import { useDoc } from "@docusaurus/plugin-content-docs/client";
96
import axios from "axios";
107
import $t from "@site/src/utils/tools";
118
import TurndownService from "turndown";
9+
import { LiaMarkdown } from "react-icons/lia";
10+
import { RiOpenaiFill } from "react-icons/ri";
11+
import { RiClaudeFill } from "react-icons/ri";
12+
import { SiPerplexity } from "react-icons/si";
13+
import { LuCopy } from "react-icons/lu";
14+
import { LuCopyCheck } from "react-icons/lu";
15+
1216
const SPECIAL_LINKS = [
1317
"/guides/",
1418
"/guides/products/dc/platforms",
@@ -83,16 +87,34 @@ const CopyDropdownButton: React.FC = () => {
8387
const items = [
8488
{
8589
key: "copy",
86-
icon: <CopySvg width={16} height={16} />,
90+
icon: <LuCopy size={18} />,
8791
label: $t("Copy Page"),
8892
description: $t("Copy page as Markdown for LLMs"),
8993
},
9094
{
9195
key: "markdown",
92-
icon: <MarkdownSvg width={18} height={18} />,
96+
icon: <LiaMarkdown size={18} />,
9397
label: $t("View as Markdown"),
9498
description: $t("View this page as plain text"),
9599
},
100+
{
101+
key: "gpt",
102+
icon: <RiOpenaiFill size={18} />,
103+
label: `${$t("Open in")} ChatGPT`,
104+
description: $t("Ask questions about this page"),
105+
},
106+
{
107+
key: "claude",
108+
icon: <RiClaudeFill size={18} />,
109+
label: `${$t("Open in")} Claude`,
110+
description: $t("Ask questions about this page"),
111+
},
112+
{
113+
key: "perplexity",
114+
icon: <SiPerplexity size={18} />,
115+
label: `${$t("Open in")} Perplexity`,
116+
description: $t("Ask questions about this page"),
117+
},
96118
];
97119

98120
return {
@@ -109,6 +131,19 @@ const CopyDropdownButton: React.FC = () => {
109131
onClick: ({ key }: { key: string }) => {
110132
if (key === "copy") handleCopy(sourceUrl);
111133
if (key === "markdown") window.open(sourceUrl, "_blank");
134+
if (key === "gpt")
135+
window.open(
136+
`https://chat.openai.com/?hints=search&q=Read from ${window.location.href} so I can ask questions about it.`
137+
);
138+
if (key === "claude")
139+
window.open(
140+
`https://claude.ai/new?q=Read from ${window.location.href} so I can ask questions about it.`
141+
);
142+
if (key === "perplexity") {
143+
window.open(
144+
`https://www.perplexity.ai/search/new?q=Read from ${window.location.href} so I can ask questions about it`
145+
);
146+
}
112147
},
113148
};
114149
}, [sourceUrl, handleCopy]);
@@ -118,9 +153,9 @@ const CopyDropdownButton: React.FC = () => {
118153
{loading ? (
119154
<Spin size="small" />
120155
) : isCopied ? (
121-
<CopiedSvg width={16} height={16} />
156+
<LuCopyCheck size={18} />
122157
) : (
123-
<CopySvg width={16} height={16} />
158+
<LuCopy size={18} />
124159
)}
125160
<span className={styles.buttonText}>
126161
{loading ? $t("Copying...") : $t("Copy Page")}

src/components/CopyPageButton/styles.module.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
}
2020

2121
.buttonText {
22-
svg > path {
23-
fill: var(--color-text-0) !important;
22+
svg {
23+
color: var(--color-text-0) !important;
2424
}
2525
span {
2626
color: var(--color-text-1);

yarn.lock

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5271,20 +5271,10 @@ caniuse-api@^3.0.0:
52715271
lodash.memoize "^4.1.2"
52725272
lodash.uniq "^4.5.0"
52735273

5274-
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001599, caniuse-lite@^1.0.30001640, caniuse-lite@^1.0.30001688, caniuse-lite@^1.0.30001702:
5275-
version "1.0.30001715"
5276-
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001715.tgz"
5277-
integrity sha512-7ptkFGMm2OAOgvZpwgA4yjQ5SQbrNVGdRjzH0pBdy1Fasvcr+KAeECmbCAECzTuDuoX0FCY8KzUxjf9+9kfZEw==
5278-
5279-
caniuse-lite@^1.0.30001716:
5280-
version "1.0.30001718"
5281-
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001718.tgz#dae13a9c80d517c30c6197515a96131c194d8f82"
5282-
integrity sha512-AflseV1ahcSunK53NfEs9gFWgOEmzr0f+kaMFA4xiLZlr9Hzt7HxcSpIFcnNCUkz6R6dWKa54rUz3HUmI3nVcw==
5283-
5284-
caniuse-lite@^1.0.30001726:
5285-
version "1.0.30001727"
5286-
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001727.tgz#22e9706422ad37aa50556af8c10e40e2d93a8b85"
5287-
integrity sha512-pB68nIHmbN6L/4C6MH1DokyR3bYqFwjaSs/sWDHGj4CTcFtQUQMuJftVwWkXq7mNWOybD3KhUv3oWHoGxgP14Q==
5274+
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001599, caniuse-lite@^1.0.30001640, caniuse-lite@^1.0.30001688, caniuse-lite@^1.0.30001702, caniuse-lite@^1.0.30001716, caniuse-lite@^1.0.30001726:
5275+
version "1.0.30001753"
5276+
resolved "https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001753.tgz"
5277+
integrity sha512-Bj5H35MD/ebaOV4iDLqPEtiliTN29qkGtEHCwawWn4cYm+bPJM2NsaP30vtZcnERClMzp52J4+aw2UNbK4o+zw==
52885278

52895279
ccount@^2.0.0:
52905280
version "2.0.1"
@@ -10722,6 +10712,11 @@ react-fast-compare@^3.2.0, react-fast-compare@^3.2.2:
1072210712
react-fast-compare "^3.2.0"
1072310713
shallowequal "^1.1.0"
1072410714

10715+
react-icons@^5.5.0:
10716+
version "5.5.0"
10717+
resolved "https://registry.npmmirror.com/react-icons/-/react-icons-5.5.0.tgz#8aa25d3543ff84231685d3331164c00299cdfaf2"
10718+
integrity sha512-MEFcXdkP3dLo8uumGI5xN3lDFNsRtrjbOEKDLD7yv76v4wpnEq2Lt2qeHaQOr34I/wPN3s3+N08WkQ+CW37Xiw==
10719+
1072510720
react-is@^16.13.1, react-is@^16.6.0, react-is@^16.7.0:
1072610721
version "16.13.1"
1072710722
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"

0 commit comments

Comments
 (0)