Skip to content

Commit c8a0fbd

Browse files
Lei JiangCopilot
andcommitted
Merge remote agent-kit-insert branch
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5637943c-111b-4780-96f9-7ab62d71922c
2 parents f4d47be + 95d6769 commit c8a0fbd

31 files changed

Lines changed: 1937 additions & 954 deletions

‎app/ai/page.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ export default function AIPage() {
278278
</div>
279279

280280
<div className="min-w-0 rounded-3xl border border-white/10 bg-neutral-900/90 p-5 shadow-[0_24px_80px_-40px_rgba(139,92,246,0.45)] sm:p-6">
281-
<div className="mb-4 flex items-center justify-between gap-3">
281+
<div className="mb-4 flex flex-wrap items-center justify-between gap-x-3 gap-y-2">
282282
<span className="inline-flex rounded-full border border-violet-400/30 bg-violet-500/10 px-3 py-1 text-xs font-semibold uppercase tracking-[0.18em] text-violet-200">
283283
Quick start
284284
</span>
@@ -372,7 +372,7 @@ export default function AIPage() {
372372
{quickStartSteps.map((item) => (
373373
<article
374374
key={item.step}
375-
className="flex h-full flex-col rounded-3xl border border-neutral-800 bg-neutral-900/80 p-5 shadow-[0_24px_80px_-50px_rgba(139,92,246,0.45)] sm:p-6"
375+
className="flex h-full min-w-0 flex-col rounded-3xl border border-neutral-800 bg-neutral-900/80 p-5 shadow-[0_24px_80px_-50px_rgba(139,92,246,0.45)] sm:p-6"
376376
>
377377
<div className="mb-4 flex items-center gap-3">
378378
<span className="inline-flex h-9 w-9 items-center justify-center rounded-full border border-violet-400/30 bg-violet-500/10 text-xs font-semibold text-violet-200">

‎app/components/Breadcrumb.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ export default function Breadcrumb({ type, category, name }: {
77
category?: string;
88
name?: string;
99
}) {
10+
// The separator spans carry no spaces, so without flex-wrap a long trail never breaks
1011
return (
11-
<nav className="mb-6 text-sm text-gray-400">
12+
<nav className="mb-6 flex flex-wrap items-center gap-y-1 text-sm text-gray-400">
1213
<Link href="/docs/reference" className="hover:text-blue-400 transition-colors">
1314
Reference
1415
</Link>

‎app/components/ComingSoon.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export default function ComingSoon() {
22
return (
33
<div className="relative mb-8">
44
{/* Main container with glow effect */}
5-
<div className="relative w-80 h-80 mx-auto">
5+
<div className="relative w-full max-w-80 h-80 mx-auto">
66
{/* Background glow */}
77
<div className="absolute inset-0 bg-gradient-to-r from-blue-500/20 via-purple-500/20 to-cyan-500/20 rounded-2xl blur-xl"></div>
88

‎app/components/CommandSnippet.tsx‎

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
11
"use client";
22

3-
import { useState } from "react";
3+
import { useEffect, useRef, useState } from "react";
44

55
type CommandSnippetProps = {
66
command: string;
77
label?: string;
88
};
99

1010
export default function CommandSnippet({ command, label = "Command" }: CommandSnippetProps) {
11-
const [copied, setCopied] = useState(false);
11+
const [feedback, setFeedback] = useState<{ command: string; error: boolean } | null>(null);
12+
const timeout = useRef<ReturnType<typeof setTimeout> | null>(null);
13+
14+
useEffect(() => () => {
15+
if (timeout.current !== null) clearTimeout(timeout.current);
16+
}, []);
1217

1318
const copyCommand = async () => {
14-
await navigator.clipboard.writeText(command);
15-
setCopied(true);
16-
window.setTimeout(() => setCopied(false), 1500);
19+
if (timeout.current !== null) clearTimeout(timeout.current);
20+
try {
21+
await navigator.clipboard.writeText(command);
22+
setFeedback({ command, error: false });
23+
timeout.current = setTimeout(() => setFeedback(null), 2000);
24+
} catch {
25+
setFeedback({ command, error: true });
26+
}
1727
};
28+
const currentFeedback = feedback?.command === command ? feedback : null;
1829

1930
return (
2031
<div className="w-full max-w-full overflow-hidden rounded-lg border border-neutral-700 bg-black">
@@ -25,11 +36,17 @@ export default function CommandSnippet({ command, label = "Command" }: CommandSn
2536
<button
2637
type="button"
2738
onClick={copyCommand}
28-
className="rounded border border-neutral-600 px-2 py-1 text-xs font-medium text-gray-200 transition-colors hover:border-neutral-500 hover:bg-neutral-800"
39+
aria-label={`Copy ${label}`}
40+
className="rounded border border-neutral-600 px-2 py-1 text-xs font-medium text-gray-200 transition-colors hover:border-neutral-500 hover:bg-neutral-800 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-400"
2941
>
30-
{copied ? "Copied" : "Copy"}
42+
{currentFeedback && !currentFeedback.error ? "Copied" : "Copy"}
3143
</button>
3244
</div>
45+
<p role="status" className={currentFeedback?.error ? "px-3 pb-3 text-sm text-amber-200" : "sr-only"}>
46+
{currentFeedback?.error
47+
? "Could not copy. Select the command text and copy it manually."
48+
: currentFeedback ? `${label} copied. Run it in your terminal.` : ""}
49+
</p>
3350
<div className="w-full max-w-full overflow-x-auto overscroll-x-contain px-3 py-3 [scrollbar-gutter:stable]">
3451
<pre className="m-0 w-full whitespace-pre text-xs leading-relaxed text-green-400">
3552
<code>{command}</code>

‎app/components/Grid.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ export default function Grid({ items }: {
1212
key={page.reference}
1313
className="bg-neutral-900/30 rounded-lg p-4 border border-neutral-600/20 text-left hover:border-blue-500/40 hover:bg-neutral-700/30 transition-all duration-200 group"
1414
href={`/docs/reference/${page.reference}`}>
15-
<div className="grid md:grid-cols-[20%_80%] grid-cols-[10%_90%] mb-2">
16-
<h4 className="text-blue-300 font-mono font-medium group-hover:text-blue-200">
15+
{/* Stack until there is room for a fixed column wide enough for $setWindowFields */}
16+
<div className="grid gap-1 lg:grid-cols-[12rem_minmax(0,1fr)] lg:gap-0 mb-2">
17+
<h4 className="text-blue-300 font-mono font-medium group-hover:text-blue-200 break-words">
1718
{page.name}
1819
</h4>
1920
<p className="text-xs text-gray-400 italic">

‎app/components/Markdown.tsx‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Link from "next/link";
66
import { useMemo } from 'react';
77
import type { ReactElement } from 'react';
88
import Code from './Code';
9-
import { kebabCase } from 'change-case';
9+
import { headingAnchor } from '../lib/docsAnchors';
1010
import { resolveMarkdownLink } from '../lib/markdownLinks';
1111

1212
interface MarkdownProps {
@@ -43,8 +43,8 @@ export default function Markdown({ content, sourcePath }: MarkdownProps) {
4343

4444
elements.push(
4545
<div key={`section-${index}`} className="bg-neutral-800/50 backdrop-blur-sm rounded-lg border border-neutral-700/50 p-6">
46-
<a className="invisible scroll-mt-24" id={kebabCase(title)} />
47-
<h2 className="text-2xl font-semibold text-white mb-4">
46+
<a className="invisible scroll-mt-24" id={headingAnchor(title)} />
47+
<h2 className="text-xl sm:text-2xl font-semibold text-white mb-4">
4848
{title}
4949
</h2>
5050
<ReactMarkdown
@@ -61,15 +61,16 @@ export default function Markdown({ content, sourcePath }: MarkdownProps) {
6161
return elements;
6262
}, [content, sourcePath]);
6363

64-
return <div className="space-y-8">{processedContent}</div>;
64+
// Long inline code, URLs and identifiers would otherwise push the article wider than a phone
65+
return <div className="space-y-8 break-words">{processedContent}</div>;
6566
}
6667

6768
function getMarkdownComponents(sourcePath: string) {
6869
return {
6970
// H1 headings (main page title from Markdown content)
7071
h1: ({ children, ...props }: any) => (
7172
<>
72-
<h1 className="text-4xl font-bold text-white mb-4" {...props}>
73+
<h1 className="text-3xl sm:text-4xl font-bold text-white mb-4" {...props}>
7374
{children}
7475
</h1>
7576
<div className="w-24 h-1 bg-gradient-to-r from-blue-500 via-purple-500 to-green-500 rounded-full mb-6"></div>

‎app/components/Navbar.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const navItems: NavItem[] = [
3232
},
3333
{ label: "Docs", href: "/docs", kind: "link" },
3434
{ label: "AI", href: "/ai", kind: "link" },
35-
{ label: "Download", href: "/packages", kind: "link" },
35+
{ label: "Install & Download", href: "/packages", kind: "link" },
3636
{
3737
label: "Agent-Kit",
3838
href: "https://github.com/Azure/documentdb-agent-kit",
@@ -123,7 +123,7 @@ export default function Navbar() {
123123
{navItems.map((item) =>
124124
renderNavItem(
125125
item,
126-
"flex items-center gap-2 text-gray-300 transition-colors duration-200 font-medium hover:text-blue-400",
126+
"flex items-center gap-2 text-gray-300 transition-colors duration-200 font-medium hover:text-blue-400 focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-blue-400",
127127
),
128128
)}
129129
</div>
@@ -154,7 +154,7 @@ export default function Navbar() {
154154
{navItems.map((item) =>
155155
renderNavItem(
156156
item,
157-
"flex items-center gap-3 rounded-md px-3 py-2.5 text-sm font-medium text-gray-300 transition-colors duration-200 hover:bg-neutral-800 hover:text-white",
157+
"flex items-center gap-3 rounded-md px-3 py-2.5 text-sm font-medium text-gray-300 transition-colors duration-200 hover:bg-neutral-800 hover:text-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-400",
158158
closeMenu,
159159
),
160160
)}

‎app/components/QuickStartTabs.tsx‎

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
"use client";
2+
3+
import Link from "next/link";
4+
import { useRef, useState } from "react";
5+
import CommandSnippet from "./CommandSnippet";
6+
7+
type QuickStartTabsProps = {
8+
dockerCommand: string;
9+
vscodeDeepLinkUrl: string;
10+
dockerDocsUrl: string;
11+
vscodeDocsUrl: string;
12+
};
13+
14+
const TABS = [
15+
{ id: "command", label: "Docker command", description: "Run it yourself" },
16+
{ id: "guided", label: "Guided setup", description: "VS Code extension" },
17+
] as const;
18+
19+
type TabId = (typeof TABS)[number]["id"];
20+
21+
export default function QuickStartTabs({
22+
dockerCommand,
23+
vscodeDeepLinkUrl,
24+
dockerDocsUrl,
25+
vscodeDocsUrl,
26+
}: QuickStartTabsProps) {
27+
const [activeTab, setActiveTab] = useState<TabId>("command");
28+
const tabRefs = useRef<Partial<Record<TabId, HTMLButtonElement | null>>>({});
29+
30+
const selectTab = (id: TabId) => {
31+
setActiveTab(id);
32+
tabRefs.current[id]?.focus();
33+
};
34+
35+
const onTabKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>) => {
36+
const currentIndex = TABS.findIndex((tab) => tab.id === activeTab);
37+
38+
switch (event.key) {
39+
case "ArrowRight":
40+
case "ArrowLeft": {
41+
event.preventDefault();
42+
const delta = event.key === "ArrowRight" ? 1 : -1;
43+
selectTab(TABS[(currentIndex + delta + TABS.length) % TABS.length].id);
44+
break;
45+
}
46+
case "Home":
47+
event.preventDefault();
48+
selectTab(TABS[0].id);
49+
break;
50+
case "End":
51+
event.preventDefault();
52+
selectTab(TABS[TABS.length - 1].id);
53+
break;
54+
default:
55+
break;
56+
}
57+
};
58+
59+
return (
60+
<div>
61+
<div
62+
role="tablist"
63+
aria-label="Ways to set up DocumentDB locally"
64+
className="mb-4 grid grid-cols-2 gap-1 rounded-2xl border border-neutral-700 bg-neutral-900/80 p-1"
65+
>
66+
{TABS.map((tab) => {
67+
const isActive = tab.id === activeTab;
68+
69+
return (
70+
<button
71+
key={tab.id}
72+
ref={(element) => {
73+
tabRefs.current[tab.id] = element;
74+
}}
75+
type="button"
76+
role="tab"
77+
id={`quickstart-tab-${tab.id}`}
78+
aria-selected={isActive}
79+
aria-controls={`quickstart-panel-${tab.id}`}
80+
tabIndex={isActive ? 0 : -1}
81+
onClick={() => selectTab(tab.id)}
82+
onKeyDown={onTabKeyDown}
83+
className={`min-h-14 min-w-0 rounded-xl px-3 py-3 text-left text-sm font-semibold transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-300 ${
84+
isActive
85+
? "bg-neutral-700 text-white"
86+
: "text-gray-300 hover:text-white"
87+
}`}
88+
>
89+
{tab.label}
90+
<span
91+
className={`mt-1 block text-xs font-normal ${
92+
isActive ? "text-gray-300" : "text-gray-400"
93+
}`}
94+
>
95+
{tab.description}
96+
</span>
97+
</button>
98+
);
99+
})}
100+
</div>
101+
102+
<div
103+
role="tabpanel"
104+
id="quickstart-panel-command"
105+
aria-labelledby="quickstart-tab-command"
106+
hidden={activeTab !== "command"}
107+
>
108+
<p className="mb-4 text-sm leading-6 text-gray-300">
109+
Replace the username and password, then run the command.
110+
</p>
111+
<CommandSnippet command={dockerCommand} label="bash" />
112+
<p className="mt-4 text-sm leading-6 text-gray-300">
113+
Then connect with your preferred client.
114+
</p>
115+
<div className="mt-3 text-sm">
116+
<Link
117+
href={dockerDocsUrl}
118+
className="font-semibold text-blue-300 transition-colors hover:text-blue-200"
119+
>
120+
Docker setup guide
121+
</Link>
122+
</div>
123+
</div>
124+
125+
<div
126+
role="tabpanel"
127+
id="quickstart-panel-guided"
128+
aria-labelledby="quickstart-tab-guided"
129+
hidden={activeTab !== "guided"}
130+
>
131+
<p className="mb-4 text-sm leading-6 text-gray-300">
132+
The VS Code extension creates your local database, generates
133+
credentials, and saves a connection.
134+
</p>
135+
<a
136+
href={vscodeDeepLinkUrl}
137+
aria-describedby="quickstart-vscode-setup-caption"
138+
className="inline-flex w-full items-center justify-center rounded-md bg-blue-500 px-6 py-3 text-sm font-semibold text-white transition-colors hover:bg-blue-400 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-300 sm:w-auto"
139+
>
140+
Set up in VS Code
141+
</a>
142+
<p
143+
id="quickstart-vscode-setup-caption"
144+
className="mt-3 text-sm leading-6 text-gray-400"
145+
>
146+
Don&apos;t have VS Code?{" "}
147+
<Link
148+
href="https://code.visualstudio.com/"
149+
target="_blank"
150+
rel="noopener noreferrer"
151+
className="font-semibold text-blue-300 transition-colors hover:text-blue-200"
152+
>
153+
Download it
154+
</Link>{" "}
155+
first.
156+
</p>
157+
<p className="mt-4 text-sm leading-6 text-gray-300">
158+
When setup finishes, select Open Connection.
159+
</p>
160+
<div className="mt-4 text-sm">
161+
<Link
162+
href={vscodeDocsUrl}
163+
className="font-semibold text-blue-300 transition-colors hover:text-blue-200"
164+
>
165+
VS Code setup guide
166+
</Link>
167+
</div>
168+
</div>
169+
</div>
170+
);
171+
}

0 commit comments

Comments
 (0)