Adicionou demo B126 cotovelo

X-Lovable-Edit-ID: edt-0d946be8-3f53-4818-a2c4-0244637c984e
Co-authored-by: Reifonas <211114984+Reifonas@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-05-13 21:55:06 +00:00
2 changed files with 108343 additions and 1 deletions
File diff suppressed because it is too large Load Diff
+28 -1
View File
@@ -13,6 +13,7 @@ const Index = () => {
const fileInputRef = useRef<HTMLInputElement>(null);
const [loadingDemo, setLoadingDemo] = useState(false);
const [loadingDemoIFC, setLoadingDemoIFC] = useState(false);
const [loadingDemoCotovelo, setLoadingDemoCotovelo] = useState(false);
const [converting, setConverting] = useState(false);
const { model, setModel, xrSupported, setXrSupported } = useModelStore();
@@ -94,6 +95,23 @@ const Index = () => {
}
}, [setModel]);
const handleLoadDemoCotovelo = useCallback(async () => {
setLoadingDemoCotovelo(true);
try {
const response = await fetch('/models/B126-COTOVELO.ifc');
const buffer = await response.arrayBuffer();
const result = await convertIFCtoGLB(buffer, 'B126-COTOVELO.ifc');
const url = URL.createObjectURL(result.blob);
setModel({ fileName: result.fileName, fileSize: result.fileSize, url });
toast.success('Modelo demo "B126 Cotovelo" (IFC) carregado!');
} catch (err) {
console.error(err);
toast.error('Falha ao converter modelo demo Cotovelo');
} finally {
setLoadingDemoCotovelo(false);
}
}, [setModel]);
const handleEnterViewer = () => {
if (!model) {
toast.error('Importe um modelo GLB primeiro');
@@ -142,7 +160,7 @@ const Index = () => {
</Button>
{/* Demo buttons */}
<div className="grid grid-cols-2 gap-2">
<div className="grid grid-cols-3 gap-2">
<Button
variant="outline"
className="h-12 w-full gap-2 border-muted-foreground/30 text-muted-foreground hover:border-primary hover:text-primary transition-all text-xs"
@@ -160,6 +178,15 @@ const Index = () => {
{loadingDemoIFC ? <Loader2 className="h-4 w-4 animate-spin" /> : <Package className="h-4 w-4" />}
{loadingDemoIFC ? 'Convertendo…' : 'Demo — 250 HP (IFC)'}
</Button>
<Button
variant="outline"
className="h-12 w-full gap-2 border-muted-foreground/30 text-muted-foreground hover:border-primary hover:text-primary transition-all text-xs"
onClick={handleLoadDemoCotovelo}
disabled={loadingDemoCotovelo}>
{loadingDemoCotovelo ? <Loader2 className="h-4 w-4 animate-spin" /> : <Package className="h-4 w-4" />}
{loadingDemoCotovelo ? 'Convertendo…' : 'Demo — B126 Cotovelo (IFC)'}
</Button>
</div>