- Refactor BevyScene to replace script injection with dynamic import.

- Update `NavItem` to provide fallback route for invalid `path`.
- Temporarily stub metric API endpoints with placeholders.
This commit is contained in:
geoffsee
2025-07-01 12:28:44 -04:00
committed by Geoff Seemueller
parent 0ff8b5c03e
commit 3901337163
3 changed files with 20 additions and 12 deletions

View File

@@ -9,13 +9,19 @@ export interface BevySceneProps {
export const BevyScene: React.FC<BevySceneProps> = ({ speed = 1, intensity = 1, glow = false }) => { export const BevyScene: React.FC<BevySceneProps> = ({ speed = 1, intensity = 1, glow = false }) => {
useEffect(() => { useEffect(() => {
const script = document.createElement('script'); (async () => {
script.src = '/yachtpit.js'; const module = await import('/public/yachtpit.js', { type: 'module' });
script.type = 'module'; console.log('init', module);
document.body.appendChild(script); await module.default();
script.onload = loaded => { })();
console.log('loaded', loaded); // const script = document.createElement('script');
}; // script.src = '';
// script.type = 'module';
// document.body.appendChild(script);
// script.onload = loaded => {
// loaded.target?.init();
// console.log('loaded', loaded);
// };
}, []); }, []);
return ( return (

View File

@@ -5,7 +5,7 @@ function NavItem({ path, children, color, onClick, as, cursor }) {
return ( return (
<Box <Box
as={as ?? 'a'} as={as ?? 'a'}
href={path} href={path && path.length > 1 ? path : '/'}
mb={2} mb={2}
cursor={cursor} cursor={cursor}
// ml={5} // ml={5}

View File

@@ -52,13 +52,15 @@ export function createRouter() {
// }) // })
.get('/api/metrics*', async (r, e, c) => { .get('/api/metrics*', async (r, e, c) => {
const { metricsService } = createRequestContext(e, c); return new Response('ok');
return metricsService.handleMetricsRequest(r); // const { metricsService } = createRequestContext(e, c);
// return metricsService.handleMetricsRequest(r);
}) })
.post('/api/metrics*', async (r, e, c) => { .post('/api/metrics*', async (r, e, c) => {
const { metricsService } = createRequestContext(e, c); return new Response('ok');
return metricsService.handleMetricsRequest(r); // const { metricsService } = createRequestContext(e, c);
// return metricsService.handleMetricsRequest(r);
}) })
// renders the app // renders the app