forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintegration-grid.tsx
More file actions
50 lines (45 loc) · 1.63 KB
/
Copy pathintegration-grid.tsx
File metadata and controls
50 lines (45 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"use client";
import React from "react";
import { useFramework } from "./framework-provider";
import { getRuntimeConfig } from "@/lib/runtime-config.client";
export function IntegrationGrid({
path,
description,
}: {
path?: string;
exclude?: string[];
description?: string;
}) {
const { framework } = useFramework();
// On a framework-scoped route the user already chose a backend — hide.
if (framework) return null;
// Shell host is now read at runtime from window.__SHOWCASE_CONFIG__
// (set by the root layout) so the rendered <a href> reflects the
// current deploy's NEXT_PUBLIC_SHELL_URL without a rebuild. Pulled
// after the early-return so we never call into the client reader on
// renders that produce no DOM.
const shellHost = getRuntimeConfig().shellUrl;
return (
<>
<h2>Choose your AI backend</h2>
{description && (
<p className="mb-4 text-[var(--text-secondary)]">{description}</p>
)}
<div className="shell-docs-radius-surface mb-4 bg-[var(--bg-elevated)] p-4 text-sm text-[var(--text-muted)]">
See{" "}
<a
href={`${shellHost}/integrations`}
className="text-[var(--accent)]"
// shellHost is the SSR placeholder during server-render and the
// real value post-hydration (runtime-config.client.ts). React
// would otherwise log a hydration mismatch on this href every
// pageload; suppression scopes to THIS attribute mismatch only.
suppressHydrationWarning
>
Integrations
</a>{" "}
for all available frameworks{path ? ` (${path})` : ""}.
</div>
</>
);
}