@kb-labs/studio-app 0.6.0 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/dist/index.html +1 -0
  2. package/dist/main.1d68e922.js +522 -0
  3. package/dist/main.1d68e922.js.map +1 -0
  4. package/dist/main.80b70197.css +2 -0
  5. package/dist/main.80b70197.css.map +1 -0
  6. package/dist/mf-manifest.json +241 -0
  7. package/dist/mf-stats.json +271 -0
  8. package/package.json +56 -39
  9. package/server.js +68 -0
  10. package/.env.example +0 -10
  11. package/UI-KIT-COMPONENTS.md +0 -783
  12. package/UI-KIT-PLAN.md +0 -326
  13. package/eslint-rules/no-direct-antd-import.js +0 -151
  14. package/eslint.config.ts +0 -27
  15. package/index.html +0 -17
  16. package/postcss.config.js +0 -7
  17. package/public/favicon.ico +0 -0
  18. package/rspack.config.mjs +0 -118
  19. package/src/App.tsx +0 -46
  20. package/src/components/devtools/devtools-log-feed.module.css +0 -165
  21. package/src/components/devtools/devtools-log-feed.tsx +0 -300
  22. package/src/components/devtools/devtools-panel.module.css +0 -121
  23. package/src/components/devtools/devtools-panel.tsx +0 -115
  24. package/src/components/empty-state.tsx +0 -28
  25. package/src/components/error-boundary.tsx +0 -210
  26. package/src/components/health-banner.module.css +0 -103
  27. package/src/components/health-banner.tsx +0 -134
  28. package/src/components/health-indicator.tsx +0 -12
  29. package/src/components/page-header.tsx +0 -49
  30. package/src/components/page-transition.tsx +0 -24
  31. package/src/components/role-switcher.tsx +0 -148
  32. package/src/components/run-badge.tsx +0 -13
  33. package/src/components/ui/icons.tsx +0 -509
  34. package/src/components/ui/index.ts +0 -25
  35. package/src/components/ui/kb-config-provider.tsx +0 -130
  36. package/src/components/ui/kb-header.module.css +0 -51
  37. package/src/components/ui/kb-header.tsx +0 -112
  38. package/src/components/ui/kb-notification-bell.module.css +0 -103
  39. package/src/components/ui/kb-notification-bell.tsx +0 -199
  40. package/src/components/ui/kb-page-layout.tsx +0 -66
  41. package/src/components/ui/kb-quick-search.module.css +0 -86
  42. package/src/components/ui/kb-quick-search.tsx +0 -196
  43. package/src/components/ui/kb-sidebar.module.css +0 -47
  44. package/src/components/ui/kb-sidebar.tsx +0 -196
  45. package/src/components/ui/kb-stat-card.module.css +0 -21
  46. package/src/components/ui/kb-stat-card.tsx +0 -22
  47. package/src/components/ui/kb-stat-grid.tsx +0 -22
  48. package/src/components/ui/kb-status-bar.module.css +0 -49
  49. package/src/components/ui/kb-status-bar.tsx +0 -145
  50. package/src/components/ui/kb-system-health-indicator.tsx +0 -229
  51. package/src/components/ui/kb-theme-toggle.tsx +0 -42
  52. package/src/components/ui/theme-adapter.ts +0 -812
  53. package/src/components/ui/theme-transition-overlay.tsx +0 -70
  54. package/src/components/ui/utils.ts +0 -6
  55. package/src/components/widget-error-boundary.tsx +0 -172
  56. package/src/config/env.ts +0 -5
  57. package/src/config/feature-flags.ts +0 -482
  58. package/src/config/studio.config.schema.ts +0 -88
  59. package/src/config/studio.config.ts +0 -84
  60. package/src/env.d.ts +0 -23
  61. package/src/hooks/use-command-palette.ts +0 -6
  62. package/src/hooks/use-devtools-store.ts +0 -25
  63. package/src/hooks/use-feature-flags.ts +0 -101
  64. package/src/index.css +0 -10
  65. package/src/layouts/dashboard-grid.tsx +0 -122
  66. package/src/layouts/index.ts +0 -12
  67. package/src/layouts/two-pane.tsx +0 -134
  68. package/src/main.tsx +0 -15
  69. package/src/modules/analytics/components/analytics-daily-stats-chart.tsx +0 -257
  70. package/src/modules/analytics/components/analytics-date-range-picker.tsx +0 -121
  71. package/src/modules/analytics/pages/analytics-cache-page.tsx +0 -285
  72. package/src/modules/analytics/pages/analytics-embeddings-page.tsx +0 -274
  73. package/src/modules/analytics/pages/analytics-events-page.tsx +0 -425
  74. package/src/modules/analytics/pages/analytics-llm-page.tsx +0 -434
  75. package/src/modules/analytics/pages/analytics-overview-page.tsx +0 -336
  76. package/src/modules/analytics/pages/analytics-page.tsx +0 -20
  77. package/src/modules/analytics/pages/analytics-storage-page.tsx +0 -344
  78. package/src/modules/analytics/pages/analytics-vectorstore-page.tsx +0 -279
  79. package/src/modules/analytics/routes/index.tsx +0 -133
  80. package/src/modules/analytics/utils/formatters.test.ts +0 -148
  81. package/src/modules/analytics/utils/formatters.ts +0 -100
  82. package/src/modules/auth/pages/login-page.module.css +0 -113
  83. package/src/modules/auth/pages/login-page.tsx +0 -80
  84. package/src/modules/auth/routes/index.tsx +0 -24
  85. package/src/modules/dashboard/components/ActivityTimelineWidget.tsx +0 -199
  86. package/src/modules/dashboard/components/AiInsightsWidget.tsx +0 -358
  87. package/src/modules/dashboard/components/AnimatedMetricCard.css +0 -88
  88. package/src/modules/dashboard/components/AnimatedMetricCard.tsx +0 -125
  89. package/src/modules/dashboard/components/HeroMetricCard.css +0 -114
  90. package/src/modules/dashboard/components/HeroMetricCard.tsx +0 -152
  91. package/src/modules/dashboard/components/HeroMetricsWidget.tsx +0 -146
  92. package/src/modules/dashboard/components/SystemResourcesWidget.tsx +0 -197
  93. package/src/modules/dashboard/components/dashboard-empty.tsx +0 -22
  94. package/src/modules/dashboard/components/dashboard-kpis-widget.tsx +0 -59
  95. package/src/modules/dashboard/components/dashboard-kpis.tsx +0 -13
  96. package/src/modules/dashboard/components/dashboard-latency-percentiles-widget.tsx +0 -85
  97. package/src/modules/dashboard/components/dashboard-metrics-widget.tsx +0 -78
  98. package/src/modules/dashboard/components/dashboard-plugins-widget.tsx +0 -67
  99. package/src/modules/dashboard/components/dashboard-requests-widget.tsx +0 -62
  100. package/src/modules/dashboard/layouts/dashboard-layout.tsx +0 -16
  101. package/src/modules/dashboard/pages/ai-insights-page.tsx +0 -563
  102. package/src/modules/dashboard/pages/dashboard-animations.css +0 -317
  103. package/src/modules/dashboard/pages/dashboard-page.tsx +0 -13
  104. package/src/modules/dashboard/routes/index.tsx +0 -70
  105. package/src/modules/observability/pages/devkit-page.tsx +0 -263
  106. package/src/modules/observability/pages/incident-detail-page.tsx +0 -571
  107. package/src/modules/observability/pages/incidents-page.tsx +0 -370
  108. package/src/modules/observability/pages/log-detail-page.tsx +0 -508
  109. package/src/modules/observability/pages/logs-page.tsx +0 -1129
  110. package/src/modules/observability/pages/prometheus-metrics-page.tsx +0 -486
  111. package/src/modules/observability/pages/state-broker-page.tsx +0 -229
  112. package/src/modules/observability/pages/system-events-page.tsx +0 -255
  113. package/src/modules/observability/routes/index.tsx +0 -133
  114. package/src/modules/plugins/components/marketplace-card.tsx +0 -153
  115. package/src/modules/plugins/components/plugin-ai-assistant-modal.tsx +0 -374
  116. package/src/modules/plugins/components/plugin-card.tsx +0 -136
  117. package/src/modules/plugins/components/plugin-detail/capabilities-summary.tsx +0 -101
  118. package/src/modules/plugins/components/plugin-detail/cli-commands-table.tsx +0 -101
  119. package/src/modules/plugins/components/plugin-detail/index.ts +0 -7
  120. package/src/modules/plugins/components/plugin-detail/jobs-table.tsx +0 -64
  121. package/src/modules/plugins/components/plugin-detail/permissions/env-permissions.tsx +0 -30
  122. package/src/modules/plugins/components/plugin-detail/permissions/filesystem-permissions.tsx +0 -68
  123. package/src/modules/plugins/components/plugin-detail/permissions/index.ts +0 -6
  124. package/src/modules/plugins/components/plugin-detail/permissions/network-permissions.tsx +0 -43
  125. package/src/modules/plugins/components/plugin-detail/permissions/platform-services.tsx +0 -242
  126. package/src/modules/plugins/components/plugin-detail/permissions/resource-quotas.tsx +0 -96
  127. package/src/modules/plugins/components/plugin-detail/permissions/shell-permissions.tsx +0 -55
  128. package/src/modules/plugins/components/plugin-detail/permissions-view.tsx +0 -47
  129. package/src/modules/plugins/components/plugin-detail/plugin-header.tsx +0 -169
  130. package/src/modules/plugins/components/plugin-detail/rest-routes-table.tsx +0 -159
  131. package/src/modules/plugins/components/plugin-detail/workflows-table.tsx +0 -40
  132. package/src/modules/plugins/components/plugin-grid.tsx +0 -20
  133. package/src/modules/plugins/components/plugin-table.tsx +0 -178
  134. package/src/modules/plugins/pages/marketplace-page.tsx +0 -200
  135. package/src/modules/plugins/pages/plugin-detail-page.tsx +0 -1145
  136. package/src/modules/plugins/routes/index.tsx +0 -48
  137. package/src/modules/plugins/utils/index.ts +0 -1
  138. package/src/modules/plugins/utils/schema-helpers.ts +0 -21
  139. package/src/modules/settings/components/api-routes-viewer.tsx +0 -415
  140. package/src/modules/settings/components/appearance-settings.tsx +0 -200
  141. package/src/modules/settings/components/configuration-settings.tsx +0 -321
  142. package/src/modules/settings/components/data-privacy-settings.tsx +0 -111
  143. package/src/modules/settings/components/experimental-settings.tsx +0 -243
  144. package/src/modules/settings/components/navigation-settings.tsx +0 -198
  145. package/src/modules/settings/components/notifications-settings.tsx +0 -40
  146. package/src/modules/settings/pages/settings-page.tsx +0 -298
  147. package/src/modules/settings/routes/index.tsx +0 -47
  148. package/src/pages/README-assistant.md +0 -91
  149. package/src/pages/login-page.tsx +0 -177
  150. package/src/pages/not-found-page.tsx +0 -85
  151. package/src/providers/auth-provider.tsx +0 -40
  152. package/src/providers/command-palette-provider.tsx +0 -193
  153. package/src/providers/data-sources-provider.tsx +0 -27
  154. package/src/providers/devtools-provider.tsx +0 -72
  155. package/src/providers/navigation-items-provider.tsx +0 -38
  156. package/src/providers/registry-v2-provider.tsx +0 -93
  157. package/src/providers/settings-provider.tsx +0 -158
  158. package/src/router.tsx +0 -302
  159. package/src/routes/helpers.tsx +0 -25
  160. package/src/routes/plugin-page-v2.tsx +0 -52
  161. package/src/routes/types.ts +0 -18
  162. package/src/styles/antd-overrides.css +0 -211
  163. package/src/styles/base.css +0 -190
  164. package/src/styles/settings.css +0 -75
  165. package/src/styles/variables.css +0 -94
  166. package/src/utils/analytics.ts +0 -183
  167. package/src/utils/apply-navigation-categories.ts +0 -83
  168. package/src/utils/commands.ts +0 -252
  169. package/src/utils/export.ts +0 -174
  170. package/src/utils/format-date.ts +0 -166
  171. package/src/utils/logger.ts +0 -110
  172. package/tailwind.config.ts +0 -13
  173. package/tsconfig.json +0 -13
  174. package/vitest-setup.ts +0 -1
  175. /package/{public → dist}/favicon.svg +0 -0
@@ -1,86 +0,0 @@
1
- .searchWrap {
2
- padding: 16px 16px 0;
3
- }
4
-
5
- .searchInput {
6
- margin-bottom: 12px;
7
- }
8
-
9
- .list {
10
- max-height: 400px;
11
- overflow-y: auto;
12
- }
13
-
14
- .emptyState {
15
- padding: 40px 16px;
16
- }
17
-
18
- .resultItem {
19
- padding: 12px 16px;
20
- cursor: pointer;
21
- border-left: 3px solid transparent;
22
- transition: background-color 0.15s, border-color 0.15s;
23
- }
24
-
25
- .resultItem.selected {
26
- background-color: var(--bg-tertiary);
27
- border-left-color: var(--primary-color, #1890ff);
28
- }
29
-
30
- .categoryIcon {
31
- width: 32px;
32
- height: 32px;
33
- border-radius: 6px;
34
- display: flex;
35
- align-items: center;
36
- justify-content: center;
37
- }
38
-
39
- .itemTitle {
40
- display: flex;
41
- align-items: center;
42
- gap: 8px;
43
- }
44
-
45
- .itemDesc {
46
- display: flex;
47
- align-items: center;
48
- gap: 8px;
49
- }
50
-
51
- .enterHint {
52
- font-size: 11px;
53
- color: var(--text-tertiary);
54
- display: flex;
55
- align-items: center;
56
- gap: 4px;
57
- }
58
-
59
- .footer {
60
- padding: 12px 16px;
61
- border-top: 1px solid var(--border-primary);
62
- display: flex;
63
- justify-content: space-between;
64
- align-items: center;
65
- font-size: 12px;
66
- color: var(--text-tertiary);
67
- }
68
-
69
- .footerLeft {
70
- display: flex;
71
- gap: 12px;
72
- }
73
-
74
- .footerHint {
75
- display: flex;
76
- align-items: center;
77
- gap: 4px;
78
- }
79
-
80
- kbd {
81
- padding: 2px 4px;
82
- background: var(--bg-tertiary);
83
- border: 1px solid var(--border-primary);
84
- border-radius: 2px;
85
- font-size: 11px;
86
- }
@@ -1,196 +0,0 @@
1
- import * as React from 'react';
2
- import { Modal, Input, List, Empty, Badge } from 'antd';
3
- import { Search, FileText, Box, Settings, BarChart, Activity, Navigation, Zap } from 'lucide-react';
4
- import styles from './kb-quick-search.module.css';
5
-
6
- export interface SearchableItem {
7
- id: string;
8
- title: string;
9
- description?: string;
10
- category: 'page' | 'plugin' | 'widget' | 'workflow' | 'setting' | 'navigation' | 'action';
11
- path: string;
12
- icon?: React.ReactNode;
13
- badge?: string;
14
- }
15
-
16
- export interface KBQuickSearchProps {
17
- open: boolean;
18
- onClose: () => void;
19
- items: SearchableItem[];
20
- onNavigate: (path: string) => void;
21
- placeholder?: string;
22
- }
23
-
24
- const CATEGORY_CONFIG = {
25
- page: { icon: FileText, color: '#1890ff', label: 'Page' },
26
- navigation: { icon: Navigation, color: '#13c2c2', label: 'Navigation' },
27
- action: { icon: Zap, color: '#fa8c16', label: 'Action' },
28
- plugin: { icon: Box, color: '#52c41a', label: 'Plugin' },
29
- widget: { icon: Activity, color: '#722ed1', label: 'Widget' },
30
- workflow: { icon: BarChart, color: '#faad14', label: 'Workflow' },
31
- setting: { icon: Settings, color: '#8c8c8c', label: 'Setting' },
32
- } as const;
33
-
34
- export function KBQuickSearch({
35
- open,
36
- onClose,
37
- items,
38
- onNavigate,
39
- placeholder = 'Search pages, plugins, widgets...',
40
- }: KBQuickSearchProps) {
41
- const [searchQuery, setSearchQuery] = React.useState('');
42
- const [selectedIndex, setSelectedIndex] = React.useState(0);
43
- const inputRef = React.useRef<any>(null);
44
-
45
- const filteredItems = React.useMemo(() => {
46
- if (!searchQuery.trim()) { return items.slice(0, 10); }
47
- const query = searchQuery.toLowerCase();
48
- return items
49
- .filter((item) => {
50
- return (item.title?.toLowerCase().includes(query) ?? false)
51
- || (item.description?.toLowerCase().includes(query) ?? false)
52
- || (item.path?.toLowerCase().includes(query) ?? false);
53
- })
54
- .slice(0, 10);
55
- }, [items, searchQuery]);
56
-
57
- React.useEffect(() => { setSelectedIndex(0); }, [filteredItems]);
58
-
59
- React.useEffect(() => {
60
- if (open) {
61
- setTimeout(() => { inputRef.current?.focus(); }, 100);
62
- } else {
63
- setSearchQuery('');
64
- setSelectedIndex(0);
65
- }
66
- }, [open]);
67
-
68
- const handleKeyDown = React.useCallback(
69
- (e: React.KeyboardEvent) => {
70
- if (e.key === 'ArrowDown') {
71
- e.preventDefault();
72
- setSelectedIndex((prev) => Math.min(prev + 1, filteredItems.length - 1));
73
- } else if (e.key === 'ArrowUp') {
74
- e.preventDefault();
75
- setSelectedIndex((prev) => Math.max(prev - 1, 0));
76
- } else if (e.key === 'Enter') {
77
- e.preventDefault();
78
- const item = filteredItems[selectedIndex];
79
- if (item) { onNavigate(item.path); onClose(); }
80
- } else if (e.key === 'Escape') {
81
- e.preventDefault();
82
- onClose();
83
- }
84
- },
85
- [filteredItems, selectedIndex, onNavigate, onClose]
86
- );
87
-
88
- const handleItemClick = (item: SearchableItem) => {
89
- onNavigate(item.path);
90
- onClose();
91
- };
92
-
93
- return (
94
- <Modal
95
- open={open}
96
- onCancel={onClose}
97
- footer={null}
98
- width={600}
99
- centered
100
- closable={false}
101
- styles={{ body: { padding: 0 } }}
102
- >
103
- <div className={styles.searchWrap}>
104
- <Input
105
- ref={inputRef}
106
- size="large"
107
- placeholder={placeholder}
108
- prefix={<Search size={18} style={{ color: '#8c8c8c' }} />}
109
- suffix={
110
- <div style={{ display: 'flex', alignItems: 'center', gap: 4 }}>
111
- <kbd>ESC</kbd>
112
- </div>
113
- }
114
- value={searchQuery}
115
- onChange={(e) => setSearchQuery(e.target.value)}
116
- onKeyDown={handleKeyDown}
117
- className={styles.searchInput}
118
- />
119
- </div>
120
-
121
- <div className={styles.list}>
122
- {filteredItems.length === 0 ? (
123
- <Empty
124
- image={Empty.PRESENTED_IMAGE_SIMPLE}
125
- description="No results found"
126
- className={styles.emptyState}
127
- />
128
- ) : (
129
- <List
130
- dataSource={filteredItems}
131
- renderItem={(item, index) => {
132
- const config = CATEGORY_CONFIG[item.category];
133
- const Icon = config.icon;
134
- const isSelected = index === selectedIndex;
135
-
136
- return (
137
- <List.Item
138
- key={item.id}
139
- onClick={() => handleItemClick(item)}
140
- className={`${styles.resultItem} ${isSelected ? styles.selected : ''}`}
141
- onMouseEnter={() => setSelectedIndex(index)}
142
- >
143
- <List.Item.Meta
144
- avatar={
145
- <div
146
- className={styles.categoryIcon}
147
- style={{ backgroundColor: `${config.color}15` }}
148
- >
149
- {item.icon || <Icon size={16} color={config.color} />}
150
- </div>
151
- }
152
- title={
153
- <div className={styles.itemTitle}>
154
- <span>{item.title}</span>
155
- {item.badge && (
156
- <Badge
157
- count={item.badge}
158
- style={{ backgroundColor: config.color, fontSize: 11, height: 18, lineHeight: '18px' }}
159
- />
160
- )}
161
- </div>
162
- }
163
- description={
164
- <div className={styles.itemDesc}>
165
- <span style={{ fontSize: 11, color: config.color }}>{config.label}</span>
166
- {item.description && (
167
- <>
168
- <span style={{ color: 'var(--text-tertiary)' }}>•</span>
169
- <span style={{ fontSize: 12 }}>{item.description}</span>
170
- </>
171
- )}
172
- </div>
173
- }
174
- />
175
- {isSelected && (
176
- <div className={styles.enterHint}>
177
- <kbd>↵</kbd>
178
- </div>
179
- )}
180
- </List.Item>
181
- );
182
- }}
183
- />
184
- )}
185
- </div>
186
-
187
- <div className={styles.footer}>
188
- <div className={styles.footerLeft}>
189
- <div className={styles.footerHint}><kbd>↑↓</kbd> Navigate</div>
190
- <div className={styles.footerHint}><kbd>↵</kbd> Select</div>
191
- </div>
192
- <div>{filteredItems.length} result{filteredItems.length !== 1 ? 's' : ''}</div>
193
- </div>
194
- </Modal>
195
- );
196
- }
@@ -1,47 +0,0 @@
1
- .sider {
2
- overflow: hidden;
3
- height: calc(100vh - 28px);
4
- position: fixed;
5
- left: 0;
6
- top: 0;
7
- bottom: 28px;
8
- background-color: var(--bg-sidebar);
9
- border-right: none;
10
- box-shadow: 1px 0 0 var(--border-primary), 2px 0 8px rgba(0, 0, 0, 0.03);
11
- z-index: var(--z-sidebar);
12
- display: flex;
13
- flex-direction: column;
14
- }
15
-
16
- .header {
17
- height: 64px;
18
- display: flex;
19
- align-items: center;
20
- justify-content: center;
21
- border-bottom: 1px solid var(--border-primary);
22
- flex-shrink: 0;
23
- }
24
-
25
- .scrollArea {
26
- position: absolute;
27
- top: 64px;
28
- left: 0;
29
- right: 0;
30
- bottom: 48px;
31
- overflow-y: auto;
32
- overflow-x: hidden;
33
- }
34
-
35
- .menu {
36
- border-right: 0 !important;
37
- padding: 4px 8px;
38
- }
39
-
40
- .settingsArea {
41
- position: absolute;
42
- bottom: 0;
43
- left: 0;
44
- right: 0;
45
- border-top: 1px solid var(--border-primary);
46
- background-color: var(--bg-sidebar);
47
- }
@@ -1,196 +0,0 @@
1
- import * as React from 'react';
2
- import { Layout, Menu } from 'antd';
3
- import type { MenuProps } from 'antd';
4
- import { PanelLeftClose, PanelLeftOpen } from 'lucide-react';
5
- import { UIButton } from '@kb-labs/studio-ui-kit';
6
- import styles from './kb-sidebar.module.css';
7
-
8
- const { Sider: AntSider } = Layout;
9
-
10
- export interface NavigationItem {
11
- key: string;
12
- label: string;
13
- icon?: React.ReactNode;
14
- path?: string;
15
- children?: NavigationItem[];
16
- type?: 'group' | 'divider';
17
- }
18
-
19
- export interface KBSidebarProps {
20
- items: NavigationItem[];
21
- collapsed?: boolean;
22
- onCollapse?: (collapsed: boolean) => void;
23
- width?: number;
24
- collapsedWidth?: number;
25
- currentPath?: string;
26
- onNavigate?: (path: string) => void;
27
- }
28
-
29
- export function KBSidebar({
30
- items,
31
- collapsed: controlledCollapsed,
32
- onCollapse,
33
- width = 220,
34
- collapsedWidth = 64,
35
- currentPath,
36
- onNavigate,
37
- }: KBSidebarProps) {
38
- const [internalCollapsed, setInternalCollapsed] = React.useState(false);
39
-
40
- const collapsed = controlledCollapsed !== undefined ? controlledCollapsed : internalCollapsed;
41
- const setCollapsed = React.useCallback(
42
- (newCollapsed: boolean) => {
43
- if (controlledCollapsed === undefined) {
44
- setInternalCollapsed(newCollapsed);
45
- }
46
- onCollapse?.(newCollapsed);
47
- },
48
- [controlledCollapsed, onCollapse]
49
- );
50
-
51
- const keyToPathMap = React.useMemo(() => {
52
- const map = new Map<string, string>();
53
- const buildMap = (navItems: NavigationItem[]) => {
54
- for (const item of navItems) {
55
- if (item.path && item.key) {
56
- map.set(item.key, item.path);
57
- }
58
- if (item.children) {
59
- buildMap(item.children);
60
- }
61
- }
62
- };
63
- buildMap(items);
64
- return map;
65
- }, [items]);
66
-
67
- const menuItems: MenuProps['items'] = React.useMemo(() => {
68
- const convertItems = (navItems: NavigationItem[]): MenuProps['items'] => {
69
- return navItems.map((item) => {
70
- const hasChildren = item.children && item.children.length > 0;
71
-
72
- if (item.type === 'divider') {
73
- return { type: 'divider' as const, key: item.key };
74
- }
75
-
76
- if (item.type === 'group' && hasChildren) {
77
- return {
78
- type: 'group' as const,
79
- key: item.key,
80
- label: item.label,
81
- children: convertItems(item.children!),
82
- };
83
- }
84
-
85
- const menuItem: any = {
86
- key: item.key,
87
- icon: item.icon,
88
- label: item.label,
89
- };
90
-
91
- if (hasChildren && item.children) {
92
- menuItem.children = convertItems(item.children);
93
- }
94
-
95
- return menuItem;
96
- });
97
- };
98
-
99
- return convertItems(items);
100
- }, [items]);
101
-
102
- const selectedKeys = React.useMemo(() => {
103
- if (!currentPath) { return []; }
104
-
105
- const findKeys = (path: string, navItems: NavigationItem[]): string[] => {
106
- for (const item of navItems) {
107
- if (item.path === path) {
108
- return [item.key || item.path || `item-${Math.random()}`];
109
- }
110
- if (item.children?.length) {
111
- const childKeys = findKeys(path, item.children);
112
- if (childKeys.length > 0) {return childKeys;}
113
- }
114
- }
115
- for (const item of navItems) {
116
- if (item.path && !item.children?.length && path.startsWith(item.path + '/')) {
117
- return [item.key || item.path || `item-${Math.random()}`];
118
- }
119
- }
120
- return [];
121
- };
122
-
123
- return findKeys(currentPath, items);
124
- }, [currentPath, items]);
125
-
126
- const openKeys = React.useMemo(() => {
127
- if (!currentPath) { return []; }
128
-
129
- const findOpenKeys = (path: string, navItems: NavigationItem[]): string[] => {
130
- for (const item of navItems) {
131
- if (item.children) {
132
- const childKeys = findOpenKeys(path, item.children);
133
- if (childKeys.length > 0) {
134
- return [item.key || item.path || `item-${Math.random()}`, ...childKeys];
135
- }
136
- }
137
- }
138
- return [];
139
- };
140
-
141
- return findOpenKeys(currentPath, items);
142
- }, [currentPath, items]);
143
-
144
- const handleMenuClick = (e: { key: string }) => {
145
- const path = keyToPathMap.get(e.key);
146
- if (path && onNavigate) {
147
- onNavigate(path);
148
- }
149
- };
150
-
151
- const mainItems = (menuItems ?? []).filter((item: any) => item?.key !== 'settings');
152
- const settingsItems = (menuItems ?? []).filter((item: any) => item?.key === 'settings');
153
-
154
- return (
155
- <AntSider
156
- collapsible
157
- collapsed={collapsed}
158
- width={width}
159
- collapsedWidth={collapsedWidth}
160
- trigger={null}
161
- className={styles.sider}
162
- theme="light"
163
- >
164
- <div className={styles.header}>
165
- <UIButton
166
- variant="text"
167
- icon={collapsed ? <PanelLeftOpen size={16} /> : <PanelLeftClose size={16} />}
168
- onClick={() => setCollapsed(!collapsed)}
169
- />
170
- </div>
171
-
172
- <div className={styles.scrollArea}>
173
- <Menu
174
- mode="inline"
175
- selectedKeys={selectedKeys}
176
- defaultOpenKeys={openKeys}
177
- items={mainItems}
178
- onClick={handleMenuClick}
179
- className={styles.menu}
180
- />
181
- </div>
182
-
183
- {settingsItems.length > 0 && (
184
- <div className={styles.settingsArea}>
185
- <Menu
186
- mode="inline"
187
- selectedKeys={selectedKeys}
188
- items={settingsItems}
189
- onClick={handleMenuClick}
190
- className={styles.menu}
191
- />
192
- </div>
193
- )}
194
- </AntSider>
195
- );
196
- }
@@ -1,21 +0,0 @@
1
- .label {
2
- font-size: 11px;
3
- font-weight: 600;
4
- color: var(--text-tertiary);
5
- text-transform: uppercase;
6
- letter-spacing: 0.06em;
7
- margin-bottom: 10px;
8
- }
9
-
10
- .value {
11
- font-size: 28px;
12
- font-weight: 700;
13
- line-height: 1.1;
14
- letter-spacing: -0.02em;
15
- font-family: var(--font-heading);
16
- color: var(--text-primary);
17
- }
18
-
19
- .value.positive { color: #52c41a; }
20
- .value.negative { color: #ff4d4f; }
21
- .value.warning { color: #faad14; }
@@ -1,22 +0,0 @@
1
- import * as React from 'react';
2
- import { UICard } from '@kb-labs/studio-ui-kit';
3
- import styles from './kb-stat-card.module.css';
4
-
5
- export interface KBStatCardProps {
6
- label: string;
7
- value: React.ReactNode;
8
- variant?: 'positive' | 'negative' | 'warning' | 'default';
9
- }
10
-
11
- export function KBStatCard({ label, value, variant = 'default' }: KBStatCardProps) {
12
- return (
13
- <UICard>
14
- <div>
15
- <div className={styles.label}>{label}</div>
16
- <div className={`${styles.value} ${variant !== 'default' ? styles[variant] : ''}`}>
17
- {value}
18
- </div>
19
- </div>
20
- </UICard>
21
- );
22
- }
@@ -1,22 +0,0 @@
1
- import * as React from 'react';
2
- import { UIRow, UICol } from '@kb-labs/studio-ui-kit';
3
-
4
- export interface KBStatGridProps {
5
- columns?: number;
6
- children: React.ReactNode;
7
- }
8
-
9
- export function KBStatGrid({ columns = 4, children }: KBStatGridProps) {
10
- const span = 24 / columns;
11
-
12
- return (
13
- <UIRow gutter={[16, 16]}>
14
- {React.Children.map(children, (child, index) => (
15
- <UICol span={span} key={index}>
16
- {child}
17
- </UICol>
18
- ))}
19
- </UIRow>
20
- );
21
- }
22
-
@@ -1,49 +0,0 @@
1
- .bar {
2
- position: fixed;
3
- bottom: 0;
4
- left: 0;
5
- right: 0;
6
- height: 28px;
7
- background-color: var(--bg-secondary);
8
- border-top: 1px solid var(--border-primary);
9
- display: flex;
10
- align-items: center;
11
- justify-content: space-between;
12
- padding: 0 8px;
13
- z-index: var(--z-sticky);
14
- font-size: 12px;
15
- transition: background-color 150ms ease-in-out, border-color 150ms ease-in-out;
16
- }
17
-
18
- .side {
19
- display: flex;
20
- align-items: center;
21
- }
22
-
23
- .item {
24
- display: flex;
25
- align-items: center;
26
- gap: 6px;
27
- padding: 0 12px;
28
- height: 28px;
29
- font-size: 12px;
30
- cursor: default;
31
- color: var(--text-secondary);
32
- transition: background-color 150ms ease-in-out, color 150ms ease-in-out;
33
- border-radius: 4px;
34
- user-select: none;
35
- }
36
-
37
- .item.clickable {
38
- cursor: pointer;
39
- }
40
-
41
- .item.clickable:hover {
42
- background-color: var(--bg-hover);
43
- color: var(--text-primary);
44
- }
45
-
46
- .itemIcon {
47
- display: flex;
48
- align-items: center;
49
- }