@minnai/create-aura-app 0.0.2

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 (55) hide show
  1. package/dist/index.js +108 -0
  2. package/dist/scaffold.js +61 -0
  3. package/package.json +36 -0
  4. package/templates/blank/index.html +12 -0
  5. package/templates/blank/package.json +23 -0
  6. package/templates/blank/src/App.tsx +21 -0
  7. package/templates/blank/src/index.css +40 -0
  8. package/templates/blank/src/main.tsx +10 -0
  9. package/templates/blank/tsconfig.json +31 -0
  10. package/templates/blank/tsconfig.node.json +12 -0
  11. package/templates/blank/vite.config.ts +7 -0
  12. package/templates/starter/.env.example +14 -0
  13. package/templates/starter/README.md +31 -0
  14. package/templates/starter/_gitignore +24 -0
  15. package/templates/starter/aura.config.ts +19 -0
  16. package/templates/starter/eslint.config.js +23 -0
  17. package/templates/starter/index.html +16 -0
  18. package/templates/starter/package.json +37 -0
  19. package/templates/starter/public/favicon.png +0 -0
  20. package/templates/starter/public/usd.json +9 -0
  21. package/templates/starter/public/vite.svg +1 -0
  22. package/templates/starter/src/App.css +32 -0
  23. package/templates/starter/src/App.tsx +82 -0
  24. package/templates/starter/src/ambiance/currency-air/index.tsx +25 -0
  25. package/templates/starter/src/ambiance/currency-air/logic.ts +49 -0
  26. package/templates/starter/src/ambiance/currency-air/manifest.ts +15 -0
  27. package/templates/starter/src/ambiance/currency-air/resources.ts +16 -0
  28. package/templates/starter/src/ambiance/currency-air/ui/index.tsx +42 -0
  29. package/templates/starter/src/ambiance/index.ts +48 -0
  30. package/templates/starter/src/ambiance/stocks-air/index.ts +3 -0
  31. package/templates/starter/src/ambiance/stocks-air/index.tsx +28 -0
  32. package/templates/starter/src/ambiance/stocks-air/logic.ts +87 -0
  33. package/templates/starter/src/ambiance/stocks-air/manifest.ts +15 -0
  34. package/templates/starter/src/ambiance/stocks-air/resources.ts +23 -0
  35. package/templates/starter/src/ambiance/stocks-air/ui/index.tsx +67 -0
  36. package/templates/starter/src/assets/react.svg +1 -0
  37. package/templates/starter/src/components/AnalyticsTracker.tsx +13 -0
  38. package/templates/starter/src/components/Playground/CodeEditor.tsx +121 -0
  39. package/templates/starter/src/components/Playground/Debugger.tsx +71 -0
  40. package/templates/starter/src/components/Playground/Playground.tsx +221 -0
  41. package/templates/starter/src/components/Playground/Sidebar.tsx +68 -0
  42. package/templates/starter/src/components/ProjectSidebar/ProjectSidebar.tsx +219 -0
  43. package/templates/starter/src/components/TourGuide/TourGuide.tsx +16 -0
  44. package/templates/starter/src/components/TourGuide/index.ts +1 -0
  45. package/templates/starter/src/components/TourGuide/tour-flow.yaml +137 -0
  46. package/templates/starter/src/components/TourGuide/useTourEngine.ts +376 -0
  47. package/templates/starter/src/index.css +68 -0
  48. package/templates/starter/src/main.tsx +10 -0
  49. package/templates/starter/src/services/AnalyticsService.ts +181 -0
  50. package/templates/starter/src/types/ContextHandler.ts +13 -0
  51. package/templates/starter/tsconfig.app.json +40 -0
  52. package/templates/starter/tsconfig.json +7 -0
  53. package/templates/starter/tsconfig.node.json +26 -0
  54. package/templates/starter/verify_backend.ts +42 -0
  55. package/templates/starter/vite.config.ts +286 -0
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { CurrencyManifest } from './manifest';
3
+ import { resources } from './resources';
4
+ import CurrencyUI from './ui';
5
+ import { useCurrencyLogic } from './logic';
6
+
7
+ const CurrencyAIR = React.forwardRef<any, any>((props, ref) => {
8
+ const logic = useCurrencyLogic({ ...props, resources });
9
+
10
+ React.useImperativeHandle(ref, () => ({
11
+ getContext: async () => ({ from: logic.from, to: logic.to, amount: logic.amount, result: logic.result }),
12
+ capabilities: ['currency-conversion']
13
+ }));
14
+
15
+ return <CurrencyUI {...logic} />;
16
+ });
17
+
18
+ export default {
19
+ manifest: CurrencyManifest,
20
+ resources,
21
+ component: CurrencyAIR
22
+ };
23
+ export { CurrencyManifest } from './manifest';
24
+ export { resources } from './resources';
25
+ export const Component = CurrencyAIR;
@@ -0,0 +1,49 @@
1
+ import { useState, useEffect } from 'react';
2
+ import { flux } from '@minnai/aura/flux/index';
3
+
4
+ export function useCurrencyLogic(props: any) {
5
+ const [amount, setAmount] = useState(1);
6
+ const [from, setFrom] = useState('USD');
7
+ const [to, setTo] = useState('EUR');
8
+ const [result, setResult] = useState<number | null>(null);
9
+ const [loading, setLoading] = useState(false);
10
+ const [error, setError] = useState<string | null>(null);
11
+
12
+ const { resources } = props;
13
+ // BUG: This should use resources.api.currency.rates.config.url instead!
14
+ // It's currently hardcoded to the wrong file name
15
+ const API_URL = '/dollar.json'; // Should be '/usd.json'!
16
+
17
+ useEffect(() => {
18
+ convert();
19
+ }, []);
20
+
21
+ const convert = async () => {
22
+ setLoading(true);
23
+ setError(null);
24
+ try {
25
+ const response = await fetch(API_URL);
26
+ if (!response.ok) throw new Error(`Failed to fetch rates: ${response.statusText}`);
27
+ const data = await response.json();
28
+ const rate = data.rates[to];
29
+ const finalResult = amount * rate;
30
+ setResult(finalResult);
31
+ flux.dispatch({
32
+ type: 'UPDATE_STATE',
33
+ payload: { airId: 'currency-air', amount, from, to, result: finalResult },
34
+ to: 'all'
35
+ });
36
+ } catch (err: any) {
37
+ setError(err.message || "Conversion failed");
38
+ flux.dispatch({
39
+ type: 'AIR_ERROR',
40
+ payload: { airId: 'currency-air', error: err.message || "Conversion failed" },
41
+ to: 'all'
42
+ });
43
+ } finally {
44
+ setLoading(false);
45
+ }
46
+ };
47
+
48
+ return { amount, setAmount, from, setFrom, to, setTo, result, loading, error, convert };
49
+ }
@@ -0,0 +1,15 @@
1
+ export const CurrencyManifest = {
2
+ id: 'currency-air',
3
+ meta: {
4
+ title: 'Currency Converter',
5
+ icon: '💱',
6
+ description: 'Convert between different currencies.',
7
+ width: 350,
8
+ height: 400
9
+ },
10
+ instructions: {
11
+ tasks: {
12
+ 'convert': 'Convert an amount from one currency to another.'
13
+ }
14
+ }
15
+ };
@@ -0,0 +1,16 @@
1
+ // Currency conversion using local exchange rate data
2
+ export const resources = {
3
+ api: {
4
+ currency: {
5
+ rates: {
6
+ id: 'local-exchange-rates',
7
+ provider: 'static',
8
+ config: {
9
+ url: '/usd.json', // This should be 'usd.json' not 'dollar.json'!
10
+ method: 'GET',
11
+ base: 'USD'
12
+ }
13
+ }
14
+ }
15
+ }
16
+ } as const;
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+
3
+ export default function CurrencyUI({
4
+ amount, setAmount, from, setFrom, to, setTo, result, loading, error, convert
5
+ }: any) {
6
+ return (
7
+ <div style={{ paddingTop: 0, height: '100%', display: 'flex', flexDirection: 'column' }}>
8
+ <div style={{ marginTop: 10, fontSize: '0.8rem', fontWeight: 600, textTransform: 'uppercase', color: '#888', letterSpacing: '0.5px' }}>Currency Converter</div>
9
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 15, marginTop: 20 }}>
10
+ <div style={{ display: 'flex', gap: 10 }}>
11
+ <input type="number" value={amount} onChange={(e) => setAmount(parseFloat(e.target.value))} style={{ flex: 1, padding: 8, borderRadius: 4, border: '1px solid #ddd' }} />
12
+ <select value={from} onChange={(e) => setFrom(e.target.value)} style={{ padding: 8, borderRadius: 4, border: '1px solid #ddd' }}>
13
+ <option value="USD">USD</option>
14
+ <option value="EUR">EUR</option>
15
+ </select>
16
+ </div>
17
+ <div style={{ textAlign: 'center', color: '#999' }}>⬇️</div>
18
+ <div style={{ display: 'flex', gap: 10 }}>
19
+ <div style={{ flex: 1, padding: 8, background: '#f5f5f5', borderRadius: 4 }}>{result !== null ? result.toFixed(2) : '-'}</div>
20
+ <select value={to} onChange={(e) => setTo(e.target.value)} style={{ padding: 8, borderRadius: 4, border: '1px solid #ddd' }}>
21
+ <option value="EUR">EUR</option>
22
+ <option value="USD">USD</option>
23
+ </select>
24
+ </div>
25
+ <button onClick={convert} style={{ padding: 10, background: '#007aff', color: 'white', border: 'none', borderRadius: 6, cursor: 'pointer' }}>Convert</button>
26
+ </div>
27
+ {loading && <div style={{ textAlign: 'center', marginTop: 20, color: '#666' }}>Loading...</div>}
28
+ {error && (
29
+ <div style={{ marginTop: 20, padding: 15, background: '#fff0f0', border: '1px solid #ffcccc', borderRadius: 8, color: '#d32f2f', fontSize: '0.9rem' }}>
30
+ <strong>Error:</strong> {error}
31
+ <div style={{ marginTop: 5, fontSize: '0.8rem', opacity: 0.8 }}>File not found: /dollar.json</div>
32
+ </div>
33
+ )}
34
+ {result !== null && !loading && !error && (
35
+ <div style={{ marginTop: 20, padding: 15, background: '#e8f5e9', border: '1px solid #c8e6c9', borderRadius: 8, color: '#2e7d32', fontSize: '0.9rem', textAlign: 'center' }}>
36
+ <strong>Success!</strong>
37
+ <div style={{ fontSize: '1.2rem', fontWeight: 600, marginTop: 5 }}>Result: {result.toFixed(2)} {to}</div>
38
+ </div>
39
+ )}
40
+ </div>
41
+ );
42
+ }
@@ -0,0 +1,48 @@
1
+ import { atmosphere } from '@minnai/aura/atmosphere';
2
+ import TasksAIR from '@minnai/aura/atmosphere/tasks';
3
+ import YouTubeAIR from '@minnai/aura/atmosphere/youtube-player';
4
+ import NoteTakerAIR from '@minnai/aura/atmosphere/note-taker';
5
+
6
+ // Local Ambiance
7
+ import { StocksManifest, Component as StocksComponent, resources as stocksResources } from './stocks-air';
8
+ import { CurrencyManifest, Component as CurrencyComponent, resources as currencyResources } from './currency-air';
9
+ import { LOCAL_AIRS } from '../../aura.config';
10
+
11
+ export const registerExampleAIRs = () => {
12
+ // 1. Register Standard AIRs (Core)
13
+ // The Standard AIRs export a wrapper object { manifest, resources, component }
14
+ // We need to flatten this to match AIRManifest { id, meta, component }
15
+ [TasksAIR, YouTubeAIR, NoteTakerAIR].forEach((air: any) => {
16
+ if (LOCAL_AIRS.includes(air.manifest.id)) {
17
+ atmosphere.register({
18
+ ...air.manifest,
19
+ component: air.component,
20
+ resources: air.resources
21
+ });
22
+ }
23
+ });
24
+
25
+ // 2. Register Local Demo AIRs
26
+ if (LOCAL_AIRS.includes(StocksManifest.id)) {
27
+ atmosphere.register({
28
+ ...StocksManifest,
29
+ component: StocksComponent as any,
30
+ resources: stocksResources
31
+ });
32
+ }
33
+ if (LOCAL_AIRS.includes(CurrencyManifest.id)) {
34
+ atmosphere.register({
35
+ ...CurrencyManifest,
36
+ component: CurrencyComponent as any,
37
+ resources: currencyResources
38
+ });
39
+ }
40
+ };
41
+
42
+ export const EXAMPLE_AIRS = [
43
+ NoteTakerAIR.manifest,
44
+ YouTubeAIR.manifest,
45
+ TasksAIR.manifest,
46
+ StocksManifest,
47
+ CurrencyManifest
48
+ ].filter(manifest => LOCAL_AIRS.includes(manifest.id));
@@ -0,0 +1,3 @@
1
+ export * from './manifest';
2
+ export * from './index.tsx';
3
+ export * from './resources';
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import { StocksManifest } from './manifest';
3
+ import { resources } from './resources';
4
+ import StocksUI from './ui';
5
+ import { useStocksLogic } from './logic';
6
+
7
+ const StocksAIR = React.forwardRef<any, any>((props, ref) => {
8
+ const logic = useStocksLogic({ ...props, resources });
9
+
10
+ React.useImperativeHandle(ref, () => ({
11
+ getContext: async () => ({
12
+ symbol: logic.symbol,
13
+ lastPrice: logic.data?.price,
14
+ change: logic.data?.changePercent
15
+ }),
16
+ capabilities: ['market-data']
17
+ }));
18
+
19
+ return <StocksUI {...logic} onSearch={logic.fetchStock} />;
20
+ });
21
+
22
+ export default {
23
+ manifest: StocksManifest,
24
+ resources,
25
+ component: StocksAIR
26
+ };
27
+ export { StocksManifest } from './manifest';
28
+ export const Component = StocksAIR;
@@ -0,0 +1,87 @@
1
+ import { useState, useEffect } from 'react';
2
+ import { flux } from '@minnai/aura/flux/index';
3
+
4
+ export function useStocksLogic(props: any) {
5
+ const [symbol, setSymbol] = useState(props.symbol || 'AAPL');
6
+ const [data, setData] = useState<any>(null);
7
+ const [loading, setLoading] = useState(false);
8
+ const [error, setError] = useState<string | null>(null);
9
+ const [apiKeyMissing, setApiKeyMissing] = useState(false);
10
+
11
+ const { resources } = props;
12
+ const apiKey = resources?.keys?.STOCKS_API_KEY;
13
+ const apiConfig = resources?.api?.stocks?.timeSeries?.config;
14
+
15
+ useEffect(() => {
16
+ if (!apiKey || apiKey === 'YOUR_API_KEY' || apiKey.length < 5) {
17
+ setApiKeyMissing(true);
18
+ flux.dispatch({
19
+ type: 'AIR_ERROR',
20
+ payload: {
21
+ airId: 'stocks-air',
22
+ error: '🚨 STOCKS_API_KEY is missing in resources.ts!'
23
+ },
24
+ to: 'all'
25
+ });
26
+ return;
27
+ }
28
+ fetchStock(symbol);
29
+ }, [apiKey]);
30
+
31
+ const fetchStock = async (sym: string) => {
32
+ setLoading(true);
33
+ setError(null);
34
+ try {
35
+ const url = `${apiConfig.url}?function=${apiConfig.params.function}&symbol=${sym}&apikey=${apiKey}`;
36
+ const response = await fetch(url);
37
+ const json = await response.json();
38
+
39
+ if (json['Time Series (Daily)']) {
40
+ const timeSeries = json['Time Series (Daily)'];
41
+ const dates = Object.keys(timeSeries).sort();
42
+ const latestDate = dates[dates.length - 1];
43
+ const prevDate = dates[dates.length - 2];
44
+
45
+ const latestClose = parseFloat(timeSeries[latestDate]['4. close']);
46
+ const prevClose = parseFloat(timeSeries[prevDate]['4. close']);
47
+ const change = latestClose - prevClose;
48
+ const changePercent = (change / prevClose) * 100;
49
+
50
+ const history = dates.slice(-30).map(date => ({
51
+ date: date.substring(5),
52
+ price: parseFloat(timeSeries[date]['4. close'])
53
+ }));
54
+
55
+ setData({
56
+ symbol: json['Meta Data']['2. Symbol'],
57
+ price: latestClose.toFixed(2),
58
+ change: change.toFixed(2),
59
+ changePercent: `${changePercent.toFixed(2)}%`,
60
+ history
61
+ });
62
+
63
+ flux.dispatch({
64
+ type: 'UPDATE_STATE',
65
+ payload: { airId: 'stocks-air', price: latestClose.toFixed(2) },
66
+ to: 'all'
67
+ });
68
+ } else if (json['Note']) {
69
+ const msg = "API limit reached.";
70
+ setError(msg);
71
+ flux.dispatch({ type: 'AIR_ERROR', payload: { airId: 'stocks-air', error: msg }, to: 'all' });
72
+ } else {
73
+ const msg = "Symbol not found.";
74
+ setError(msg);
75
+ flux.dispatch({ type: 'AIR_ERROR', payload: { airId: 'stocks-air', error: msg }, to: 'all' });
76
+ }
77
+ } catch (err) {
78
+ const msg = "Network error.";
79
+ setError(msg);
80
+ flux.dispatch({ type: 'AIR_ERROR', payload: { airId: 'stocks-air', error: msg }, to: 'all' });
81
+ } finally {
82
+ setLoading(false);
83
+ }
84
+ };
85
+
86
+ return { symbol, setSymbol, data, loading, error, apiKeyMissing, fetchStock };
87
+ }
@@ -0,0 +1,15 @@
1
+ export const StocksManifest = {
2
+ id: 'stocks-air',
3
+ meta: {
4
+ title: 'Stock Tracker',
5
+ icon: '📈',
6
+ description: 'Track real-time stock prices.',
7
+ width: 350,
8
+ height: 400
9
+ },
10
+ instructions: {
11
+ tasks: {
12
+ 'check_price': 'Check the stock price for a given symbol.'
13
+ }
14
+ }
15
+ };
@@ -0,0 +1,23 @@
1
+ // Add your AlphaVantage API key here
2
+ // Get a free key at: https://www.alphavantage.co/support/#api-key
3
+ export const resources = {
4
+ api: {
5
+ stocks: {
6
+ timeSeries: {
7
+ id: 'alphavantage-timeseries',
8
+ provider: 'proxy',
9
+ config: {
10
+ url: 'https://www.alphavantage.co/query',
11
+ method: 'GET',
12
+ auth: 'STOCKS_API_KEY',
13
+ params: {
14
+ function: 'TIME_SERIES_DAILY'
15
+ }
16
+ }
17
+ }
18
+ }
19
+ },
20
+ keys: {
21
+ STOCKS_API_KEY: 'PUT YOUR API KEY HERE'
22
+ }
23
+ } as const;
@@ -0,0 +1,67 @@
1
+ import React from 'react';
2
+ import { LineChart, Line, ResponsiveContainer, YAxis, Tooltip } from 'recharts';
3
+
4
+ export default function StocksUI({
5
+ symbol, setSymbol, data, loading, error, apiKeyMissing, onSearch
6
+ }: any) {
7
+ const isPositive = data && parseFloat(data.change) >= 0;
8
+
9
+ return (
10
+ <div style={{ paddingTop: 0, height: '100%', display: 'flex', flexDirection: 'column' }}>
11
+ <div style={{ marginTop: 10, fontSize: '0.8rem', fontWeight: 600, textTransform: 'uppercase', color: '#888', letterSpacing: '0.5px' }}>Market Data</div>
12
+
13
+ {apiKeyMissing ? (
14
+ <div style={{ padding: 20, background: '#fff0f0', borderRadius: 8, border: '1px solid #ffcccc', color: '#d32f2f' }}>
15
+ <strong>API Key Missing</strong>
16
+ <p style={{ margin: '10px 0', fontSize: '0.9rem' }}>Please add <code>STOCK_API_KEY</code> to your environment variables.</p>
17
+ </div>
18
+ ) : (
19
+ <>
20
+ <form onSubmit={(e) => { e.preventDefault(); onSearch(symbol); }} style={{ marginBottom: 10 }}>
21
+ <input
22
+ value={symbol}
23
+ onChange={(e) => setSymbol(e.target.value.toUpperCase())}
24
+ placeholder="Enter Symbol (e.g. AAPL)"
25
+ style={{ width: '100%', padding: '10px', borderRadius: 8, border: '1px solid #ddd', outline: 'none' }}
26
+ />
27
+ </form>
28
+
29
+ {loading && <div style={{ textAlign: 'center', color: '#666' }}>Loading...</div>}
30
+ {error && <div style={{ color: 'red', textAlign: 'center' }}>{error}</div>}
31
+
32
+ {data && !loading && (
33
+ <div style={{ flex: 1, display: 'flex', flexDirection: 'column' }}>
34
+ <div style={{ textAlign: 'center', marginBottom: 10 }}>
35
+ <h2 style={{ fontSize: '2rem', margin: '0 0 5px 0', fontWeight: 800 }}>{data.price}</h2>
36
+ <div style={{ fontSize: '1.2rem', color: isPositive ? '#00c853' : '#d32f2f', fontWeight: 600 }}>
37
+ {isPositive ? '▲' : '▼'} {data.change} ({data.changePercent})
38
+ </div>
39
+ <div style={{ color: '#999', fontSize: '0.8rem' }}>{data.symbol} - Last 30 Days</div>
40
+ </div>
41
+
42
+ <div style={{ flex: 1, minHeight: 150, width: '100%' }}>
43
+ <ResponsiveContainer width="100%" height="100%">
44
+ <LineChart data={data.history}>
45
+ <YAxis domain={['auto', 'auto']} hide={true} />
46
+ <Tooltip
47
+ contentStyle={{ borderRadius: 8, border: 'none', boxShadow: '0 2px 10px rgba(0,0,0,0.1)' }}
48
+ itemStyle={{ color: '#333' }}
49
+ formatter={(value: any) => [parseFloat(value).toFixed(2), 'Price']}
50
+ />
51
+ <Line
52
+ type="monotone"
53
+ dataKey="price"
54
+ stroke={isPositive ? '#00c853' : '#d32f2f'}
55
+ strokeWidth={2}
56
+ dot={false}
57
+ />
58
+ </LineChart>
59
+ </ResponsiveContainer>
60
+ </div>
61
+ </div>
62
+ )}
63
+ </>
64
+ )}
65
+ </div>
66
+ );
67
+ }
@@ -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
+ }