forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsidebar-icon.tsx
More file actions
145 lines (142 loc) · 4.15 KB
/
Copy pathsidebar-icon.tsx
File metadata and controls
145 lines (142 loc) · 4.15 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
// Sidebar icon registry. NavNode carries the raw spec string
// (e.g. `"lucide/Paintbrush"`) read from MDX/meta.json frontmatter;
// `resolveSidebarIcon` turns it into a React element that the
// PageTree → Fumadocs sidebar can render directly.
//
// We import only the lucide icons we actually reference so the
// client bundle doesn't pick up the entire lucide library. When a
// new icon name appears in content frontmatter, add it to the map
// below (and to the lucide imports above).
import React from "react";
import { LanggraphIcon } from "@/components/icons/framework-icons";
import { CopilotKitMark } from "@/components/copilotkit-mark";
import {
// Pages / sections
Bolt,
BookA,
BookOpen,
Bot,
Boxes,
Brain,
BrainCircuit,
Brush,
Bug,
CirclePause,
Cloud,
Code,
Cog,
Component,
Cpu,
Database,
Eye,
FileJson,
Gauge,
Globe,
LayoutDashboard,
LifeBuoy,
ListChecks,
MessageSquare,
MessageSquareMore,
Mic,
Monitor,
MoreHorizontal,
MousePointer,
Network,
Paintbrush,
Paperclip,
Play,
Plug,
Repeat,
Rocket,
SearchCheck,
Server,
Settings,
Shield,
SlidersHorizontal,
Sparkles,
TextSelect,
Terminal,
RefreshCw,
TriangleAlert,
User,
Users,
Wand2,
WandSparkles,
Workflow,
Wrench,
Zap,
} from "lucide-react";
// Lookup table keyed by the exact `"lucide/<Name>"` spec strings used
// in MDX frontmatter and meta.json `icon` fields. Add to this map (and
// to the import block above) when content references a new lucide icon.
const ICONS: Record<string, React.ReactNode> = {
"lucide/Bolt": <Bolt />,
"lucide/BookA": <BookA />,
"lucide/BookOpen": <BookOpen />,
"lucide/Bot": <Bot />,
"lucide/Boxes": <Boxes />,
"lucide/Brain": <Brain />,
"lucide/BrainCircuit": <BrainCircuit />,
"lucide/Brush": <Brush />,
"lucide/Bug": <Bug />,
"lucide/CirclePause": <CirclePause />,
"lucide/Cloud": <Cloud />,
"lucide/Code": <Code />,
"lucide/Cog": <Cog />,
"lucide/Component": <Component />,
"lucide/Cpu": <Cpu />,
"lucide/Database": <Database />,
"lucide/Eye": <Eye />,
"lucide/FileJson": <FileJson />,
"lucide/Gauge": <Gauge />,
"lucide/Globe": <Globe />,
"lucide/LayoutDashboard": <LayoutDashboard />,
"lucide/LifeBuoy": <LifeBuoy />,
"lucide/ListChecks": <ListChecks />,
"lucide/MessageSquare": <MessageSquare />,
"lucide/MessageSquareMore": <MessageSquareMore />,
"lucide/Mic": <Mic />,
"lucide/Monitor": <Monitor />,
"lucide/MoreHorizontal": <MoreHorizontal />,
"lucide/MousePointer": <MousePointer />,
"lucide/Network": <Network />,
"lucide/Paintbrush": <Paintbrush />,
"lucide/Paperclip": <Paperclip />,
"lucide/Play": <Play />,
"lucide/Plug": <Plug />,
"lucide/RefreshCw": <RefreshCw />,
"lucide/Repeat": <Repeat />,
"lucide/Rocket": <Rocket />,
"lucide/SearchCheck": <SearchCheck />,
"lucide/Server": <Server />,
"lucide/Settings": <Settings />,
"lucide/Shield": <Shield />,
"lucide/SlidersHorizontal": <SlidersHorizontal />,
"lucide/Sparkles": <Sparkles />,
"lucide/Terminal": <Terminal />,
"lucide/TextSelect": <TextSelect />,
"lucide/TriangleAlert": <TriangleAlert />,
"lucide/User": <User />,
"lucide/Users": <Users />,
"lucide/Wand2": <Wand2 />,
"lucide/WandSparkles": <WandSparkles />,
"lucide/Workflow": <Workflow />,
"lucide/Wrench": <Wrench />,
"lucide/Zap": <Zap />,
// Custom marks — used by section headers for framework / enterprise
// scaffolding. The CopilotKit kite is the inline gradient mark from
// BrandNav; the LangGraph mark comes from the framework-icons set so
// its visual treatment matches the framework picker.
"custom/langgraph": <LanggraphIcon />,
"custom/copilotkit-kite": <CopilotKitMark />,
};
export function resolveSidebarIcon(spec: string | undefined): React.ReactNode {
if (!spec) return undefined;
const icon = ICONS[spec];
if (!icon || !React.isValidElement(icon)) return icon;
// Fumadocs's `SidebarSeparator` renders `[item.icon, item.name]` as a
// child array, so React warns about missing keys. Clone with a
// stable key here so each separator gets clean child reconciliation
// without us editing fumadocs internals.
return React.cloneElement(icon, { key: "icon" });
}