Skip to content

Commit 54bff26

Browse files
committed
Update docs stories
1 parent b6b59f1 commit 54bff26

4 files changed

Lines changed: 558 additions & 108 deletions

File tree

docs/app/(home)/page.tsx

Lines changed: 64 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22

3-
import { useEffect, useRef } from "react";
3+
import { useState } from "react";
44
import Link from "next/link";
55
import { Server, Shield, Users, Zap, Eye, Code, Brain } from "lucide-react";
66
import { StoryEmbed } from "@/components/story-embed";
@@ -17,19 +17,19 @@ function GitHubIcon({ className }: { className?: string }) {
1717
// --- See it in Action (Gallery) ---
1818

1919
const demos = [
20-
{
21-
id: "knowledge-bases",
22-
title: "Knowledge Bases",
23-
description: "Search uploaded documents with vector search, citations, and inline references.",
24-
storyId: "chat-chatview--knowledge-bases",
25-
},
2620
{
2721
id: "chat",
2822
title: "Multi-Model Chat",
2923
description:
3024
"Compare responses from multiple models side-by-side with advanced multi-model modes.",
3125
storyId: "chat-chatview--multi-model-conversation",
3226
},
27+
{
28+
id: "knowledge-bases",
29+
title: "Knowledge Bases",
30+
description: "Search uploaded documents with vector search, citations, and inline references.",
31+
storyId: "chat-chatview--knowledge-bases",
32+
},
3333
{
3434
id: "execute-code",
3535
title: "Execute Code",
@@ -39,7 +39,7 @@ const demos = [
3939
{
4040
id: "studio",
4141
title: "Studio",
42-
description: "Generate images across providers simultaneously with cost tracking.",
42+
description: "Generate media across providers simultaneously with cost tracking.",
4343
storyId: "pages-studiopage--images",
4444
},
4545
{
@@ -48,38 +48,68 @@ const demos = [
4848
description: "Track costs per user, team, and project with microcent precision.",
4949
storyId: "components-usagedashboard--organization",
5050
},
51+
{
52+
id: "provider-health",
53+
title: "Provider Health",
54+
description: "Monitor provider status, latency, and circuit breakers in real time.",
55+
storyId: "admin-providerhealthpage--all-healthy",
56+
},
57+
{
58+
id: "rbac-policies",
59+
title: "RBAC Policies",
60+
description: "Define fine-grained access control with CEL-based policies per organization.",
61+
storyId: "admin-orgrbacpoliciespage--with-policies",
62+
},
63+
{
64+
id: "multi-tenancy",
65+
title: "Multi-Tenancy",
66+
description: "Manage organizations with teams, projects, members, and scoped resources.",
67+
storyId: "admin-organizationdetailpage--default",
68+
},
5169
];
5270

5371
function DemoGallery() {
54-
const chatRef = useRef<HTMLDivElement>(null);
55-
56-
useEffect(() => {
57-
const el = chatRef.current;
58-
const container = el?.parentElement;
59-
if (el && container) {
60-
const scrollLeft =
61-
el.offsetLeft - container.offsetLeft - (container.clientWidth - el.offsetWidth) / 2;
62-
container.scrollLeft = scrollLeft;
63-
}
64-
}, []);
72+
const [active, setActive] = useState("chat");
6573

6674
return (
67-
<div className="flex snap-x snap-mandatory gap-6 overflow-x-auto pb-4">
68-
<div className="w-[15%] shrink-0" aria-hidden="true" />
69-
{demos.map((demo) => (
70-
<div
71-
key={demo.id}
72-
ref={demo.id === "chat" ? chatRef : undefined}
73-
className="w-[70%] shrink-0 snap-center"
74-
>
75-
<h3 className="mb-1 text-lg font-semibold">{demo.title}</h3>
76-
<p className="mb-3 text-sm text-fd-muted-foreground">{demo.description}</p>
77-
<div className="overflow-hidden rounded-xl border border-fd-border shadow-lg">
78-
<StoryEmbed storyId={demo.storyId} height={850} />
75+
<div className="mx-auto max-w-screen-2xl px-4">
76+
<div
77+
className="mx-auto mb-6 flex max-w-6xl flex-wrap justify-center gap-2"
78+
role="tablist"
79+
aria-label="Demo gallery"
80+
>
81+
{demos.map((demo) => (
82+
<button
83+
key={demo.id}
84+
role="tab"
85+
aria-selected={active === demo.id}
86+
aria-controls={`demo-panel-${demo.id}`}
87+
onMouseEnter={() => setActive(demo.id)}
88+
onClick={() => setActive(demo.id)}
89+
className={`shrink-0 rounded-lg border px-4 py-3 text-left transition-colors ${
90+
active === demo.id
91+
? "border-fd-primary bg-fd-primary/10 text-fd-foreground"
92+
: "border-fd-border bg-fd-card text-fd-muted-foreground hover:border-fd-primary/50 hover:text-fd-foreground"
93+
}`}
94+
>
95+
<span className="block text-sm font-semibold">{demo.title}</span>
96+
<span className="mt-0.5 block max-w-48 text-xs">{demo.description}</span>
97+
</button>
98+
))}
99+
</div>
100+
<div className="relative overflow-hidden rounded-xl border border-fd-border shadow-lg">
101+
{demos.map((demo) => (
102+
<div
103+
key={demo.id}
104+
id={`demo-panel-${demo.id}`}
105+
role="tabpanel"
106+
aria-label={demo.title}
107+
className={active === demo.id ? "" : "invisible absolute inset-0"}
108+
>
109+
<StoryEmbed storyId={demo.storyId} height={950} />
79110
</div>
80-
</div>
81-
))}
82-
<div className="w-[15%] shrink-0" aria-hidden="true" />
111+
))}
112+
</div>
83113
</div>
84114
);
85115
}

ui/src/pages/admin/OrgRbacPoliciesPage.stories.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import type {
1111
import { ToastProvider } from "@/components/Toast/Toast";
1212
import { ConfirmDialogProvider } from "@/components/ConfirmDialog/ConfirmDialog";
1313

14+
const daysAgo = (d: number) => new Date(Date.now() - d * 86_400_000).toISOString();
15+
1416
const queryClient = new QueryClient({
1517
defaultOptions: {
1618
queries: {
@@ -24,7 +26,7 @@ const mockOrg: Organization = {
2426
id: "org-123",
2527
slug: "acme-corp",
2628
name: "Acme Corporation",
27-
created_at: "2024-01-01T00:00:00Z",
29+
created_at: daysAgo(180),
2830
};
2931

3032
const mockPolicies: OrgRbacPolicy[] = [
@@ -40,8 +42,8 @@ const mockPolicies: OrgRbacPolicy[] = [
4042
priority: 100,
4143
enabled: true,
4244
version: 3,
43-
created_at: "2024-01-01T00:00:00Z",
44-
updated_at: "2024-06-15T10:30:00Z",
45+
created_at: daysAgo(160),
46+
updated_at: daysAgo(5),
4547
},
4648
{
4749
id: "policy-2",
@@ -55,8 +57,8 @@ const mockPolicies: OrgRbacPolicy[] = [
5557
priority: 50,
5658
enabled: true,
5759
version: 1,
58-
created_at: "2024-03-01T00:00:00Z",
59-
updated_at: "2024-03-01T00:00:00Z",
60+
created_at: daysAgo(120),
61+
updated_at: daysAgo(120),
6062
},
6163
{
6264
id: "policy-3",
@@ -70,8 +72,8 @@ const mockPolicies: OrgRbacPolicy[] = [
7072
priority: 200,
7173
enabled: false,
7274
version: 2,
73-
created_at: "2024-04-15T00:00:00Z",
74-
updated_at: "2024-05-10T08:00:00Z",
75+
created_at: daysAgo(90),
76+
updated_at: daysAgo(45),
7577
},
7678
{
7779
id: "policy-4",
@@ -85,8 +87,8 @@ const mockPolicies: OrgRbacPolicy[] = [
8587
priority: 75,
8688
enabled: true,
8789
version: 1,
88-
created_at: "2024-06-01T00:00:00Z",
89-
updated_at: "2024-06-01T00:00:00Z",
90+
created_at: daysAgo(50),
91+
updated_at: daysAgo(50),
9092
},
9193
];
9294

@@ -268,8 +270,8 @@ export const ManyPolicies: Story = {
268270
priority: 100 - i,
269271
enabled: i % 4 !== 0,
270272
version: Math.floor(Math.random() * 5) + 1,
271-
created_at: "2024-01-01T00:00:00Z",
272-
updated_at: "2024-06-15T10:30:00Z",
273+
created_at: daysAgo(180 - i * 5),
274+
updated_at: daysAgo(i * 2),
273275
}));
274276
return HttpResponse.json({
275277
data: manyPolicies,

0 commit comments

Comments
 (0)