Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions src/components/CopyPageButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import {
} from "@floating-ui/react";
import { useState } from "react";
import {
PiMarkdownLogo,
PiDotsThreeOutlineFill,
PiClipboardTextLight,
PiArrowSquareOutLight,
PiCheckCircleLight,
PiXCircleLight,
PiChatCircleLight,
} from "react-icons/pi";
import { track } from "~/util/zaraz";

Expand Down Expand Up @@ -47,6 +48,14 @@ export default function CopyPageButton() {
window.open(markdownUrl, "_blank");
};

const handleDocsAI = () => {
const docsAIUrl = "https://developers.cloudflare.com/support/ai/";
track("clicked copy page button", {
value: "docs ai",
});
window.open(docsAIUrl, "_blank");
};

const handleCopyMarkdown = async () => {
const markdownUrl = new URL("index.md", window.location.href).toString();
try {
Expand Down Expand Up @@ -91,6 +100,12 @@ export default function CopyPageButton() {
icon: PiArrowSquareOutLight,
onClick: handleViewMarkdown,
},
{
label: "Ask Docs AI",
description: "Open our Docs AI assistant in a new tab",
icon: PiChatCircleLight,
onClick: handleDocsAI,
},
];

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

return (
<>
<span>Copy Page</span>
<PiMarkdownLogo />
<span>Page options</span>
<PiDotsThreeOutlineFill />
</>
);
};
Expand Down
Loading