import React, { Suspense, useEffect } from "react"; import assetImage from "../../assets/image/image.png"; import { FiileedStarsIconSmall } from "../../components/icons/marketPlaceIcons"; import { Canvas, useThree } from "@react-three/fiber"; import { ContactShadows, OrbitControls, Text } from "@react-three/drei"; import GltfLoader from "./GltfLoader"; import * as THREE from "three"; // Define the shape of the selected card interface SelectedCard { assetName: string; uploadedOn: number; price: number; rating: number; views: number; description: string; } // Define the props type for AssetPreview interface AssetPreviewProps { selectedCard: SelectedCard; setSelectedCard: React.Dispatch>; // Type for setter function } function Ui() { return ( Loading your model... ); } const AssetPreview: React.FC = ({ selectedCard, setSelectedCard, }) => { // Ensure rating is a valid number between 0 and 5 const rating = Math.max( 0, Math.min(5, isNaN(selectedCard.rating) ? 0 : selectedCard.rating) ); // Ensure that the rating is a valid positive integer for array length const starsArray = Array.from({ length: rating }, (_, index) => index); return (
{/* */} {/* Add canvas here */}
{ scene.background = new THREE.Color(0xffffff); }} > }> {selectedCard.assetName && ( )}
H
HERX FACTORY
Follow +
{/* asset details */}
{selectedCard.assetName}
{`${selectedCard.description} is used in factories to improve efficiency and production speed It is designed to handle heavy workloads and perform repetitive tasks with precision. Many industries rely on this machine to manufacture products quickly and accurately. It reduces human effort and minimizes errors in the production process. Regular maintenance is required to keep the machine in good working condition.With advanced technology, this machine continues to enhance industrial operations and increase productivity.`}
{selectedCard.rating}
{selectedCard.views} views
₹ {selectedCard.price}
{/* buttons */}
Add to cart
Buy now
{/* close button */}
setSelectedCard(null)}> {`<-back`}
); }; export default AssetPreview;