@minnai/create-aura-app 0.0.10 → 0.0.12

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 (33) hide show
  1. package/dist/scaffold.js +8 -32
  2. package/package.json +1 -1
  3. package/templates/starter/package.json +3 -0
  4. package/templates/starter/src/src/App.css +32 -0
  5. package/templates/starter/src/src/App.tsx +82 -0
  6. package/templates/starter/src/src/ambiance/currency-air/index.tsx +25 -0
  7. package/templates/starter/src/src/ambiance/currency-air/logic.ts +49 -0
  8. package/templates/starter/src/src/ambiance/currency-air/manifest.ts +15 -0
  9. package/templates/starter/src/src/ambiance/currency-air/resources.ts +16 -0
  10. package/templates/starter/src/src/ambiance/currency-air/ui/index.tsx +42 -0
  11. package/templates/starter/src/src/ambiance/index.ts +48 -0
  12. package/templates/starter/src/src/ambiance/stocks-air/index.ts +3 -0
  13. package/templates/starter/src/src/ambiance/stocks-air/index.tsx +28 -0
  14. package/templates/starter/src/src/ambiance/stocks-air/logic.ts +87 -0
  15. package/templates/starter/src/src/ambiance/stocks-air/manifest.ts +15 -0
  16. package/templates/starter/src/src/ambiance/stocks-air/resources.ts +23 -0
  17. package/templates/starter/src/src/ambiance/stocks-air/ui/index.tsx +67 -0
  18. package/templates/starter/src/src/assets/react.svg +1 -0
  19. package/templates/starter/src/src/components/AnalyticsTracker.tsx +13 -0
  20. package/templates/starter/src/src/components/Playground/CodeEditor.tsx +121 -0
  21. package/templates/starter/src/src/components/Playground/Debugger.tsx +71 -0
  22. package/templates/starter/src/src/components/Playground/Playground.tsx +221 -0
  23. package/templates/starter/src/src/components/Playground/Sidebar.tsx +68 -0
  24. package/templates/starter/src/src/components/ProjectSidebar/ProjectSidebar.tsx +219 -0
  25. package/templates/starter/src/src/components/TourGuide/TourGuide.tsx +16 -0
  26. package/templates/starter/src/src/components/TourGuide/index.ts +1 -0
  27. package/templates/starter/src/src/components/TourGuide/tour-flow.yaml +137 -0
  28. package/templates/starter/src/src/components/TourGuide/useTourEngine.ts +376 -0
  29. package/templates/starter/src/src/index.css +68 -0
  30. package/templates/starter/src/src/main.tsx +10 -0
  31. package/templates/starter/src/src/services/AnalyticsService.ts +181 -0
  32. package/templates/starter/src/src/types/ContextHandler.ts +13 -0
  33. package/templates/starter/vite.config.ts +0 -9
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
@@ -0,0 +1,13 @@
1
+ import { useEffect } from 'react';
2
+ import { useLocation } from 'react-router-dom';
3
+ import { analyticsService } from '../services/AnalyticsService';
4
+
5
+ export function AnalyticsTracker() {
6
+ const location = useLocation();
7
+
8
+ useEffect(() => {
9
+ analyticsService.logPageView(location.pathname + location.search);
10
+ }, [location]);
11
+
12
+ return null;
13
+ }
@@ -0,0 +1,121 @@
1
+ import { useState, useRef, useEffect } from 'react';
2
+ import Editor from '@monaco-editor/react';
3
+ import { atmosphere } from '@minnai/aura/atmosphere';
4
+
5
+ interface CodeEditorProps {
6
+ airId: string;
7
+ filePath: string;
8
+ initialCode: string;
9
+ }
10
+
11
+ export function CodeEditor({ airId, filePath, initialCode }: CodeEditorProps) {
12
+ const [isDirty, setIsDirty] = useState(false);
13
+ const [status, setStatus] = useState<'idle' | 'saving' | 'saved'>('idle');
14
+ const editorRef = useRef<any>(null);
15
+
16
+ function handleEditorDidMount(editor: any, monaco: any) {
17
+ editorRef.current = editor;
18
+
19
+ // Disable internal linting/errors
20
+ monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
21
+ noSemanticValidation: true,
22
+ noSyntaxValidation: true,
23
+ });
24
+ }
25
+
26
+ const handleSave = async () => {
27
+ const content = editorRef.current?.getValue() || '';
28
+ setStatus('saving');
29
+
30
+ try {
31
+ // 1. Persist to Filesystem
32
+ const response = await fetch('/api/save-code', {
33
+ method: 'POST',
34
+ headers: { 'Content-Type': 'application/json' },
35
+ body: JSON.stringify({ filePath, content })
36
+ });
37
+
38
+ if (!response.ok) throw new Error("Failed to save to disk");
39
+
40
+ setStatus('saved');
41
+ setIsDirty(false);
42
+ setTimeout(() => setStatus('idle'), 3000);
43
+
44
+ // Note: Since we saved to the filesystem, Vite should ideally hot-reload.
45
+ // But if user wants a manual reload of the AIR, we could trigger flux dispatch.
46
+ // For now, persistence is verified.
47
+ } catch (err: any) {
48
+ console.error(err);
49
+ alert("Save failed: " + err.message);
50
+ setStatus('idle');
51
+ }
52
+ };
53
+
54
+ return (
55
+ <div style={{ display: 'flex', flexDirection: 'column', height: '100%', background: '#1e1e1e' }}>
56
+ <div style={{
57
+ padding: '10px 20px',
58
+ background: '#2d2d2d',
59
+ color: '#ddd',
60
+ display: 'flex',
61
+ justifyContent: 'space-between',
62
+ alignItems: 'center',
63
+ borderBottom: '1px solid #333',
64
+ height: '40px',
65
+ userSelect: 'none'
66
+ }}>
67
+ <div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
68
+ <span style={{ fontSize: '0.75rem', opacity: 0.7, fontFamily: 'monospace' }}>{filePath}</span>
69
+ {isDirty && <span style={{ width: 8, height: 8, borderRadius: '50%', background: '#ff9500' }} title="Unsaved changes" />}
70
+ </div>
71
+
72
+ <div style={{ display: 'flex', alignItems: 'center', gap: 15 }}>
73
+ {status === 'saved' && (
74
+ <span style={{ fontSize: '0.75rem', color: '#4cd964', fontWeight: 600 }}>Saved ✔</span>
75
+ )}
76
+ {status === 'saving' && (
77
+ <span style={{ fontSize: '0.75rem', color: '#888' }}>Saving...</span>
78
+ )}
79
+ <button
80
+ onClick={handleSave}
81
+ style={{
82
+ padding: '4px 12px',
83
+ background: isDirty ? '#007aff' : '#444',
84
+ color: 'white',
85
+ border: 'none',
86
+ borderRadius: 4,
87
+ cursor: isDirty ? 'pointer' : 'default',
88
+ fontSize: '0.75rem',
89
+ fontWeight: 600,
90
+ transition: 'all 0.2s',
91
+ opacity: isDirty ? 1 : 0.6
92
+ }}
93
+ >
94
+ Save & Reload
95
+ </button>
96
+ </div>
97
+ </div>
98
+ <div style={{ flex: 1 }}>
99
+ <Editor
100
+ key={filePath} // Force re-mount when file changes
101
+ height="100%"
102
+ defaultLanguage="typescript"
103
+ theme="vs-dark"
104
+ value={initialCode}
105
+ onChange={() => setIsDirty(true)}
106
+ onMount={handleEditorDidMount}
107
+ options={{
108
+ minimap: { enabled: false },
109
+ fontSize: 13,
110
+ scrollBeyondLastLine: false,
111
+ automaticLayout: true,
112
+ tabSize: 4,
113
+ padding: { top: 10 },
114
+ wordWrap: 'on'
115
+ }}
116
+ />
117
+ </div>
118
+ </div>
119
+ );
120
+ }
121
+
@@ -0,0 +1,71 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { flux } from '@minnai/aura/flux/index';
3
+
4
+ interface DebuggerProps {
5
+ airId: string;
6
+ }
7
+
8
+ export function Debugger({ airId }: DebuggerProps) {
9
+ const [state] = useState<any>(null);
10
+ const [history, setHistory] = useState<any[]>([]);
11
+
12
+ useEffect(() => {
13
+ // Listen to all flux actions (simplified for playground)
14
+ const unsubscribe = flux.subscribe((action) => {
15
+ if (action.to === airId || action.type.includes(airId.toUpperCase())) {
16
+ setHistory(prev => [action, ...prev].slice(0, 20));
17
+ }
18
+
19
+ // Attempt to get current state (this requires a specific flux pattern or selector)
20
+ // For now, we assume the state is exposed or we track updates
21
+ });
22
+
23
+ return () => unsubscribe();
24
+ }, [airId]);
25
+
26
+ return (
27
+ <div style={{
28
+ width: '350px',
29
+ borderLeft: '1px solid #ddd',
30
+ background: 'white',
31
+ padding: '20px',
32
+ display: 'flex',
33
+ flexDirection: 'column',
34
+ gap: '20px',
35
+ overflowY: 'auto'
36
+ }}>
37
+ <section>
38
+ <h3 style={{ margin: '0 0 10px 0', fontSize: '0.9rem', color: '#666', textTransform: 'uppercase' }}>State (Live)</h3>
39
+ <pre style={{
40
+ background: '#f8f8f8',
41
+ padding: '10px',
42
+ borderRadius: '6px',
43
+ fontSize: '0.8rem',
44
+ overflowX: 'auto',
45
+ border: '1px solid #eee'
46
+ }}>
47
+ {JSON.stringify(state || { message: 'State tracking pending flux integration' }, null, 2)}
48
+ </pre>
49
+ </section>
50
+
51
+ <section>
52
+ <h3 style={{ margin: '0 0 10px 0', fontSize: '0.9rem', color: '#666', textTransform: 'uppercase' }}>Action History</h3>
53
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
54
+ {history.length === 0 && <div style={{ fontSize: '0.8rem', color: '#999' }}>No recent actions</div>}
55
+ {history.map((action, i) => (
56
+ <div key={i} style={{
57
+ fontSize: '0.75rem',
58
+ padding: '8px',
59
+ background: '#f0f0f0',
60
+ borderRadius: '4px',
61
+ borderLeft: '3px solid #007aff'
62
+ }}>
63
+ <div style={{ fontWeight: 'bold' }}>{action.type}</div>
64
+ <div style={{ color: '#666', marginTop: '4px' }}>{JSON.stringify(action.payload)}</div>
65
+ </div>
66
+ ))}
67
+ </div>
68
+ </section>
69
+ </div>
70
+ );
71
+ }
@@ -0,0 +1,221 @@
1
+ import { useState, useEffect } from 'react';
2
+ import { flux } from '@minnai/aura/flux/index';
3
+ import { Sidebar } from './Sidebar';
4
+ import { Debugger } from './Debugger';
5
+ import { Space } from '@minnai/aura/controller/Space';
6
+ import { CodeEditor } from './CodeEditor';
7
+
8
+ export function Playground() {
9
+ const [selectedId, setSelectedId] = useState<string | undefined>();
10
+ const [editorHeight, setEditorHeight] = useState(350);
11
+ const [isResizing, setIsResizing] = useState(false);
12
+ const [files, setFiles] = useState<string[]>([]);
13
+ const [activeFile, setActiveFile] = useState<string | null>(null);
14
+ const [fileContent, setFileContent] = useState<string>('');
15
+
16
+ const BUILTIN_AIRS = ['note-taker-air', 'youtube-player-air', 'tasks-air'];
17
+
18
+ const handleSelect = async (id: string) => {
19
+ setSelectedId(id);
20
+ flux.dispatch({ type: 'SPAWN_AIR', payload: { id }, to: 'controller' });
21
+
22
+ if (BUILTIN_AIRS.includes(id)) {
23
+ setFiles([]);
24
+ setActiveFile(null);
25
+ setFileContent('');
26
+ return;
27
+ }
28
+
29
+ // Fetch files for this AIR
30
+ try {
31
+ const res = await fetch(`/api/list-files?airId=${id}`);
32
+ const data = await res.json();
33
+ setFiles(data.files || []);
34
+ if (data.files && data.files.length > 0) {
35
+ // Default to index.tsx or first file
36
+ const defaultFile = data.files.find((f: string) => f.endsWith('index.tsx')) || data.files[0];
37
+ handleFileSelect(defaultFile);
38
+ }
39
+ } catch (err) {
40
+ console.error("Failed to list files:", err);
41
+ setFiles([]);
42
+ }
43
+ };
44
+
45
+ const handleFileSelect = async (filePath: string) => {
46
+ setActiveFile(filePath);
47
+ try {
48
+ const url = filePath.startsWith('/') ? filePath : '/' + filePath;
49
+ const res = await fetch(url);
50
+ if (!res.ok) throw new Error("File not found");
51
+ const text = await res.text();
52
+ setFileContent(text);
53
+ } catch (err) {
54
+ console.error("Failed to load file content:", err);
55
+ setFileContent("// Error loading file: " + filePath);
56
+ }
57
+ };
58
+
59
+ const handleAddAIR = async () => {
60
+ const name = window.prompt("Enter AIR Name (e.g. My Custom Tool):");
61
+ if (!name) return;
62
+ const id = name.toLowerCase().replace(/\s+/g, '-') + '-air';
63
+
64
+ try {
65
+ const res = await fetch('/api/scaffold-air', {
66
+ method: 'POST',
67
+ headers: { 'Content-Type': 'application/json' },
68
+ body: JSON.stringify({ airId: id, name })
69
+ });
70
+ const data = await res.json();
71
+ if (data.success) {
72
+ alert("Scaffolded successfully! Refreshing...");
73
+ window.location.reload();
74
+ } else {
75
+ alert("Scaffold failed: " + data.error);
76
+ }
77
+ } catch (err) {
78
+ alert("Scaffold error");
79
+ }
80
+ };
81
+
82
+ const handleMouseDown = (e: React.MouseEvent) => {
83
+ setIsResizing(true);
84
+ e.preventDefault();
85
+ };
86
+
87
+ useEffect(() => {
88
+ const handleMouseMove = (e: MouseEvent) => {
89
+ if (!isResizing) return;
90
+ const newHeight = window.innerHeight - e.clientY;
91
+ setEditorHeight(Math.max(100, Math.min(newHeight, window.innerHeight - 200)));
92
+ };
93
+ const handleMouseUp = () => setIsResizing(false);
94
+ if (isResizing) {
95
+ window.addEventListener('mousemove', handleMouseMove);
96
+ window.addEventListener('mouseup', handleMouseUp);
97
+ }
98
+ return () => {
99
+ window.removeEventListener('mousemove', handleMouseMove);
100
+ window.removeEventListener('mouseup', handleMouseUp);
101
+ };
102
+ }, [isResizing]);
103
+
104
+ const isBuiltIn = selectedId && BUILTIN_AIRS.includes(selectedId);
105
+
106
+ return (
107
+ <div style={{ display: 'flex', height: 'calc(100vh - 60px)', width: '100vw', overflow: 'hidden' }}>
108
+ <div style={{
109
+ width: '250px',
110
+ height: '100%',
111
+ borderRight: '1px solid #ddd',
112
+ background: 'white',
113
+ display: 'flex',
114
+ flexDirection: 'column'
115
+ }}>
116
+ <Sidebar onSelect={handleSelect} onAddAIR={handleAddAIR} selectedId={selectedId} />
117
+ </div>
118
+
119
+
120
+ <main style={{ flex: 1, display: 'flex', flexDirection: 'column', background: '#fafafa' }}>
121
+ <div style={{ flex: 1, position: 'relative', overflow: 'hidden' }}>
122
+ {!selectedId ? (
123
+ <div style={{ display: 'flex', height: '100%', alignItems: 'center', justifyContent: 'center', color: '#999' }}>
124
+ Select an AIR from the sidebar to begin testing
125
+ </div>
126
+ ) : (
127
+ <Space />
128
+ )}
129
+ </div>
130
+
131
+ {selectedId && (
132
+ <div style={{ height: editorHeight, display: 'flex', flexDirection: 'column', borderTop: '1px solid #ddd', position: 'relative', background: '#fff' }}>
133
+ <div
134
+ onMouseDown={handleMouseDown}
135
+ style={{
136
+ height: '4px',
137
+ width: '100%',
138
+ position: 'absolute',
139
+ top: '-2px',
140
+ cursor: 'ns-resize',
141
+ zIndex: 10,
142
+ background: isResizing ? '#007aff' : 'transparent',
143
+ transition: 'background 0.2s'
144
+ }}
145
+ />
146
+
147
+ <div style={{ display: 'flex', flex: 1, overflow: 'hidden' }}>
148
+ {/* File Explorer */}
149
+ <div style={{
150
+ width: '250px',
151
+ borderRight: '1px solid #eee',
152
+ background: '#fcfcfc',
153
+ display: 'flex',
154
+ flexDirection: 'column',
155
+ overflowY: 'auto'
156
+ }}>
157
+ <div style={{ padding: '10px 15px', fontSize: '0.7rem', color: '#999', fontWeight: 600, borderBottom: '1px solid #f0f0f0', textTransform: 'uppercase' }}>
158
+ File Explorer
159
+ </div>
160
+ {isBuiltIn ? (
161
+ <div style={{ padding: 20, color: '#999', fontSize: '0.8rem', textAlign: 'center', fontStyle: 'italic' }}>
162
+ Built-in Atmosphere AIR
163
+ </div>
164
+ ) : (
165
+ files.map(file => (
166
+ <div
167
+ key={file}
168
+ onClick={() => handleFileSelect(file)}
169
+ style={{
170
+ padding: '8px 15px',
171
+ fontSize: '0.8rem',
172
+ cursor: 'pointer',
173
+ background: activeFile === file ? '#eef6ff' : 'transparent',
174
+ color: activeFile === file ? '#007aff' : '#555',
175
+ fontFamily: 'monospace',
176
+ textOverflow: 'ellipsis',
177
+ whiteSpace: 'nowrap',
178
+ overflow: 'hidden',
179
+ borderRight: activeFile === file ? '2px solid #007aff' : 'none'
180
+ }}
181
+ title={file}
182
+ >
183
+ {file.split(/[\\\/]/).pop()}
184
+ </div>
185
+ ))
186
+ )}
187
+ </div>
188
+
189
+ {/* Editor */}
190
+ <div style={{ flex: 1 }}>
191
+ {isBuiltIn ? (
192
+ <div style={{ height: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center', background: '#1e1e1e', color: '#888', flexDirection: 'column', gap: 10 }}>
193
+ <div style={{ fontSize: '2rem' }}>🔒</div>
194
+ <div style={{ fontWeight: 600 }}>Built-in Atmosphere AIR</div>
195
+ <div style={{ fontSize: '0.8rem', opacity: 0.7 }}>Source code is managed by the main Aura package.</div>
196
+ </div>
197
+ ) : activeFile ? (
198
+ <CodeEditor
199
+ airId={selectedId}
200
+ filePath={activeFile}
201
+ initialCode={fileContent}
202
+ />
203
+ ) : (
204
+ <div style={{ height: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center', background: '#f5f5f5', color: '#999' }}>
205
+ Select a file to edit
206
+ </div>
207
+ )}
208
+ </div>
209
+ </div>
210
+ </div>
211
+ )}
212
+ </main>
213
+
214
+ {selectedId && (
215
+ <div style={{ width: '300px', borderLeft: '1px solid #ddd', background: 'white', overflowY: 'auto' }}>
216
+ <Debugger airId={selectedId} />
217
+ </div>
218
+ )}
219
+ </div>
220
+ );
221
+ }
@@ -0,0 +1,68 @@
1
+ import { EXAMPLE_AIRS } from '../../ambiance';
2
+
3
+ interface SidebarProps {
4
+ onSelect: (id: string) => void;
5
+ onAddAIR: () => void;
6
+ selectedId?: string;
7
+ }
8
+
9
+ export function Sidebar({ onSelect, onAddAIR, selectedId }: SidebarProps) {
10
+ return (
11
+ <div style={{
12
+ flex: 1,
13
+ padding: '20px',
14
+ display: 'flex',
15
+ flexDirection: 'column',
16
+ gap: '10px',
17
+ overflowY: 'auto'
18
+ }}>
19
+ <h3 style={{ margin: '0 0 10px 0', fontSize: '0.9rem', color: '#666', textTransform: 'uppercase', letterSpacing: '0.05em' }}>
20
+ Available AIRs
21
+ </h3>
22
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '8px', flex: 1 }}>
23
+ {EXAMPLE_AIRS.map(air => (
24
+ <button
25
+ key={air.id}
26
+ onClick={() => onSelect(air.id)}
27
+ style={{
28
+ padding: '12px 15px',
29
+ textAlign: 'left',
30
+ borderRadius: '8px',
31
+ border: selectedId === air.id ? '1px solid #007aff' : '1px solid #eee',
32
+ background: selectedId === air.id ? '#f0f7ff' : 'white',
33
+ color: selectedId === air.id ? '#007aff' : '#1d1d1f',
34
+ cursor: 'pointer',
35
+ fontSize: '0.9rem',
36
+ fontWeight: selectedId === air.id ? '600' : '400',
37
+ transition: 'all 0.2s ease'
38
+ }}
39
+ >
40
+ {typeof air.meta.title === 'function' ? air.meta.title('en') : air.meta.title}
41
+ </button>
42
+ ))}
43
+ </div>
44
+
45
+ <button
46
+ onClick={onAddAIR}
47
+ style={{
48
+ marginTop: '20px',
49
+ padding: '12px',
50
+ background: '#007aff',
51
+ color: 'white',
52
+ border: 'none',
53
+ borderRadius: 8,
54
+ cursor: 'pointer',
55
+ fontSize: '0.85rem',
56
+ fontWeight: 600,
57
+ display: 'flex',
58
+ alignItems: 'center',
59
+ justifyContent: 'center',
60
+ gap: '8px',
61
+ boxShadow: '0 2px 8px rgba(0,122,255,0.2)'
62
+ }}
63
+ >
64
+ <span>+</span> Add Custom AIR
65
+ </button>
66
+ </div>
67
+ );
68
+ }