Files
aerbim-ht-monitor/frontend/app/(protected)/model/page.tsx

40 lines
1004 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
'use client'
import React, { useState } from 'react'
import ModelViewer from '@/components/model/ModelViewer'
export default function Home() {
const [error, setError] = useState<string | null>(null)
const handleModelLoaded = (data: {
meshes: unknown[]
boundingBox: {
min: { x: number; y: number; z: number }
max: { x: number; y: number; z: number }
}
}) => {
setError(null)
console.log('Model loaded successfully:', data)
}
const handleError = (errorMessage: string) => {
setError(errorMessage)
}
return (
<div className="relative h-screen">
<ModelViewer
modelPath="/models/EXPO_АР_PostRecon_level.gltf"
onModelLoaded={handleModelLoaded}
onError={handleError}
/>
{error && (
<div className="absolute top-4 right-4 left-4 z-50 rounded-lg bg-red-600/90 p-4 text-sm text-white md:right-auto md:left-4 md:w-80">
<strong>Error:</strong> {error}
</div>
)}
</div>
)
}