Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 38s
Build & Deploy / 🧪 QA (push) Failing after 36s
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 3s
31 lines
948 B
TypeScript
31 lines
948 B
TypeScript
'use client';
|
|
|
|
import { Annotator } from '@mintel/annotator';
|
|
import { useEffect, useState } from 'react';
|
|
import { getAnnotatorAssets } from '@/app/actions/getAnnotatorAssets';
|
|
import { submitAnnotations } from '@/app/actions/submitAnnotations';
|
|
|
|
export default function AnnotatorClientWrapper() {
|
|
const [assets, setAssets] = useState<string[]>([]);
|
|
|
|
useEffect(() => {
|
|
getAnnotatorAssets().then(fetchedAssets => {
|
|
console.log('[AnnotatorClientWrapper] fetchedAssets:', fetchedAssets);
|
|
if (Array.isArray(fetchedAssets)) {
|
|
setAssets(fetchedAssets);
|
|
}
|
|
}).catch(err => {
|
|
console.error('[AnnotatorClientWrapper] Action failed:', err);
|
|
});
|
|
}, []);
|
|
|
|
const handleSubmit = async (annotations: any[]) => {
|
|
const result = await submitAnnotations(annotations);
|
|
if (!result.success) {
|
|
throw new Error(result.error);
|
|
}
|
|
};
|
|
|
|
return <Annotator assets={assets} onSubmit={handleSubmit} />;
|
|
}
|