Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 16d0eb9

Browse files
authored
[Docs AI] Add per-page option (#23080)
* [Docs AI] Add per-page option * Update title + icon
1 parent 8759297 commit 16d0eb9

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/components/CopyPageButton.tsx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ import {
1010
} from "@floating-ui/react";
1111
import { useState } from "react";
1212
import {
13-
PiMarkdownLogo,
13+
PiDotsThreeOutlineFill,
1414
PiClipboardTextLight,
1515
PiArrowSquareOutLight,
1616
PiCheckCircleLight,
1717
PiXCircleLight,
18+
PiChatCircleLight,
1819
} from "react-icons/pi";
1920
import { track } from "~/util/zaraz";
2021

@@ -47,6 +48,14 @@ export default function CopyPageButton() {
4748
window.open(markdownUrl, "_blank");
4849
};
4950

51+
const handleDocsAI = () => {
52+
const docsAIUrl = "https://developers.cloudflare.com/support/ai/";
53+
track("clicked copy page button", {
54+
value: "docs ai",
55+
});
56+
window.open(docsAIUrl, "_blank");
57+
};
58+
5059
const handleCopyMarkdown = async () => {
5160
const markdownUrl = new URL("index.md", window.location.href).toString();
5261
try {
@@ -91,6 +100,12 @@ export default function CopyPageButton() {
91100
icon: PiArrowSquareOutLight,
92101
onClick: handleViewMarkdown,
93102
},
103+
{
104+
label: "Ask Docs AI",
105+
description: "Open our Docs AI assistant in a new tab",
106+
icon: PiChatCircleLight,
107+
onClick: handleDocsAI,
108+
},
94109
];
95110

96111
const getButtonContent = () => {
@@ -114,8 +129,8 @@ export default function CopyPageButton() {
114129

115130
return (
116131
<>
117-
<span>Copy Page</span>
118-
<PiMarkdownLogo />
132+
<span>Page options</span>
133+
<PiDotsThreeOutlineFill />
119134
</>
120135
);
121136
};

0 commit comments

Comments
 (0)