import { useEffect } from 'react';
import { useSceneContext } from '../../../scene/sceneContext'
import { useToggleView } from '../../../../store/builder/store';
import WallAssetInstance from './Instance/wallAssetInstance';

function WallAssetInstances() {
    const { wallAssetStore } = useSceneContext();
    const { wallAssets } = wallAssetStore();
    const { toggleView } = useToggleView();

    useEffect(() => {
        // console.log('wallAssets: ', wallAssets);
    }, [wallAssets])

    return (
        <>

            {!toggleView && wallAssets.length > 0 && (
                <>
                    {wallAssets.map((wallAsset) => (
                        <WallAssetInstance key={wallAsset.modelUuid} wallAsset={wallAsset} />
                    ))}
                </>
            )}

        </>
    )
}

export default WallAssetInstances