Skip to content

The Open Standard for Generative UI

docs: prompt visitors redirected from the C1 docs (#1108)

devin-ai-integration[bot]3679415f8727
diff --git a/docs/app/docs/layout.tsx b/docs/app/docs/layout.tsx
index b17771b80..64d4581d6 100644
--- a/docs/app/docs/layout.tsx
+++ b/docs/app/docs/layout.tsx
@@ -1,3 +1,4 @@
+import { C1DocsDialog } from "@/components/C1DocsDialog";
import { DocsRouteLayout } from "@/components/docs-route-layout";
import { WebsiteThemeProvider } from "@/components/website-theme-provider";
import { source } from "@/lib/source";
@@ -5,6 +6,7 @@ import { source } from "@/lib/source";
export default function Layout({ children }: LayoutProps<"/docs">) {
return (
<WebsiteThemeProvider>
+ <C1DocsDialog />
<DocsRouteLayout tree={source.getPageTree()}>{children}</DocsRouteLayout>
</WebsiteThemeProvider>
);
diff --git a/docs/components/C1DocsDialog.css b/docs/components/C1DocsDialog.css
new file mode 100644
index 000000000..7f9d63f47
--- /dev/null
+++ b/docs/components/C1DocsDialog.css
@@ -0,0 +1,126 @@
+.c1-docs-dialog-overlay {
+ position: fixed;
+ inset: 0;
+ z-index: 1000;
+ background: var(--openui-overlay, rgb(0 0 0 / 40%));
+ backdrop-filter: blur(4px);
+}
+
+.c1-docs-dialog {
+ position: fixed;
+ z-index: 1001;
+ top: 50%;
+ left: 50%;
+ width: min(480px, calc(100vw - 48px));
+ max-height: calc(100dvh - 48px);
+ overflow-y: auto;
+ transform: translate(-50%, -50%);
+ border: 1px solid var(--openui-border-default, rgb(0 0 0 / 12%));
+ border-radius: 8px;
+ background: var(--openui-foreground, #fff);
+ box-shadow: var(--openui-shadow-2xl, 0 24px 80px rgb(0 0 0 / 24%));
+ color: var(--openui-text-neutral-primary, #111);
+ padding: 24px;
+}
+
+.c1-docs-dialog-close {
+ position: absolute;
+ top: 12px;
+ right: 12px;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ width: 28px;
+ height: 28px;
+ border: 0;
+ border-radius: 6px;
+ background: transparent;
+ color: var(--openui-text-neutral-tertiary, #666);
+ cursor: pointer;
+}
+
+.c1-docs-dialog-close:hover {
+ background: var(--openui-highlight, rgb(0 0 0 / 6%));
+ color: var(--openui-text-neutral-primary, #111);
+}
+
+.c1-docs-dialog h2 {
+ margin: 0;
+ padding-right: 32px;
+ color: var(--openui-text-neutral-primary, #111);
+ font-size: 18px;
+ font-weight: 650;
+ line-height: 1.3;
+}
+
+.c1-docs-dialog p {
+ margin: 8px 0 0;
+ color: var(--openui-text-neutral-secondary, #555);
+ font-size: 14px;
+ line-height: 1.55;
+}
+
+.c1-docs-dialog p a {
+ color: var(--openui-text-neutral-primary, #111);
+ text-decoration: underline;
+ text-underline-offset: 2px;
+}
+
+.c1-docs-dialog-actions {
+ display: flex;
+ align-items: center;
+ justify-content: flex-end;
+ gap: 8px;
+ margin-top: 18px;
+}
+
+.c1-docs-dialog-primary,
+.c1-docs-dialog-secondary {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ gap: 6px;
+ min-height: 34px;
+ padding: 0 12px;
+ border-radius: 8px;
+ font-size: 13px;
+ font-weight: 550;
+ text-decoration: none;
+ cursor: pointer;
+}
+
+.c1-docs-dialog-primary {
+ border: 1px solid var(--openui-interactive-accent-default, #111);
+ background: var(--openui-interactive-accent-default, #111);
+ color: var(--openui-text-accent-primary, #fff);
+}
+
+.c1-docs-dialog-primary:hover {
+ background: var(--openui-interactive-accent-hover, #2a2a2a);
+}
+
+.c1-docs-dialog-secondary {
+ border: 1px solid var(--openui-border-interactive, rgb(0 0 0 / 16%));
+ background: transparent;
+ color: var(--openui-text-neutral-primary, #111);
+}
+
+.c1-docs-dialog-secondary:hover {
+ background: var(--openui-highlight, rgb(0 0 0 / 6%));
+}
+
+@media (max-width: 540px) {
+ .c1-docs-dialog {
+ top: auto;
+ bottom: 12px;
+ width: calc(100vw - 24px);
+ max-height: calc(100dvh - 24px);
+ padding: 20px;
+ transform: translateX(-50%);
+ }
+
+ .c1-docs-dialog-actions {
+ align-items: stretch;
+ flex-direction: column-reverse;
+ }
+}
diff --git a/docs/components/C1DocsDialog.tsx b/docs/components/C1DocsDialog.tsx
new file mode 100644
index 000000000..5c918cf21
--- /dev/null
+++ b/docs/components/C1DocsDialog.tsx
@@ -0,0 +1,89 @@
+"use client";
+
+import * as Dialog from "@radix-ui/react-dialog";
+import { X } from "lucide-react";
+import Link from "next/link";
+import { useEffect, useState, useSyncExternalStore } from "react";
+import "./C1DocsDialog.css";
+
+const SOURCE_PARAM = "from";
+const SOURCE_VALUE = "c1";
+const SEEN_KEY = "openui:c1-docs-dialog-seen";
+const LEGACY_DOCS_URL = "https://docs.thesys.dev/legacy";
+
+function subscribe() {
+ return () => {};
+}
+
+function shouldPrompt() {
+ if (new URLSearchParams(window.location.search).get(SOURCE_PARAM) !== SOURCE_VALUE) return false;
+
+ try {
+ return window.localStorage.getItem(SEEN_KEY) !== "true";
+ } catch {
+ // Storage can be unavailable in private or restricted browser contexts.
+ return true;
+ }
+}
+
+/**
+ * Shown once to visitors redirected here from docs.thesys.dev, which keeps the C1 docs
+ * at /legacy. The redirect tags those visits with `?from=c1`.
+ */
+export function C1DocsDialog() {
+ const prompt = useSyncExternalStore(subscribe, shouldPrompt, () => false);
+ const [dismissed, setDismissed] = useState(false);
+
+ useEffect(() => {
+ if (!prompt) return;
+
+ try {
+ window.localStorage.setItem(SEEN_KEY, "true");
+ } catch {
+ // Showing it this once is enough when persistence is unavailable.
+ }
+ }, [prompt]);
+
+ return (
+ <Dialog.Root
+ open={prompt && !dismissed}
+ onOpenChange={(open) => {
+ if (!open) setDismissed(true);
+ }}
+ >
+ <Dialog.Portal>
+ <Dialog.Overlay className="c1-docs-dialog-overlay" />
+ <Dialog.Content className="c1-docs-dialog">
+ <Dialog.Close asChild>
+ <button className="c1-docs-dialog-close" aria-label="Close dialog">
+ <X size={16} />
+ </button>
+ </Dialog.Close>
+
+ <Dialog.Title asChild>
+ <h2>Looking for the Thesys C1 docs?</h2>
+ </Dialog.Title>
+ <Dialog.Description asChild>
+ <p>
+ OpenUI is the successor to C1 and these are its docs. C1 is still supported, and its
+ documentation is archived at docs.thesys.dev/legacy — the{" "}
+ <Link href="/docs/agent/guides/migrating" onClick={() => setDismissed(true)}>
+ migration guide
+ </Link>{" "}
+ covers what changes when you move over.
+ </p>
+ </Dialog.Description>
+
+ <div className="c1-docs-dialog-actions">
+ <Dialog.Close asChild>
+ <button className="c1-docs-dialog-secondary">Stay on the OpenUI docs</button>
+ </Dialog.Close>
+ <a className="c1-docs-dialog-primary" href={LEGACY_DOCS_URL}>
+ Go to the C1 docs
+ </a>
+ </div>
+ </Dialog.Content>
+ </Dialog.Portal>
+ </Dialog.Root>
+ );
+}