Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 1m16s
Build & Deploy / 🧪 QA (push) Failing after 1m30s
Build & Deploy / 🏗️ Build (push) Has been skipped
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 2s
- fixed Sentry NDJSON parsing error in relay endpoint - fully isolated Annotator bundle via next/dynamic (60kb chunk, completely removed from main thread) - aligned images for Kabelleitungsbau & Bohrtechnik across Start and Kompetenzen pages - extended transition fallback timeout for slow dev server cold starts
43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
'use client';
|
|
|
|
import dynamic from 'next/dynamic';
|
|
import { useEffect, useState } from 'react';
|
|
import { getAnnotatorAssets } from '@/app/actions/getAnnotatorAssets';
|
|
import { submitAnnotations } from '@/app/actions/submitAnnotations';
|
|
|
|
const Annotator = dynamic(() => import('@/components/annotator-local/Annotator').then(mod => mod.Annotator), { ssr: false });
|
|
|
|
export default function AnnotatorClientWrapper() {
|
|
const [assets, setAssets] = useState<string[]>([]);
|
|
|
|
useEffect(() => {
|
|
const handleKeyDown = (e: KeyboardEvent) => {
|
|
// Toggle key from Annotator.tsx is Shift+A
|
|
if (e.shiftKey && e.key === "A") {
|
|
setAssets((prev) => {
|
|
if (prev.length === 0) {
|
|
getAnnotatorAssets().then(fetchedAssets => {
|
|
if (Array.isArray(fetchedAssets)) {
|
|
setAssets(fetchedAssets);
|
|
}
|
|
}).catch(err => console.error('[AnnotatorClientWrapper] Fetch failed:', err));
|
|
}
|
|
return prev;
|
|
});
|
|
}
|
|
};
|
|
|
|
window.addEventListener("keydown", handleKeyDown);
|
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
}, []);
|
|
|
|
const handleSubmit = async (annotations: any[]) => {
|
|
const result = await submitAnnotations(annotations);
|
|
if (!result.success) {
|
|
throw new Error(result.error);
|
|
}
|
|
};
|
|
|
|
return <Annotator assets={assets} onSubmit={handleSubmit} />;
|
|
}
|