refactor: clean up code in various components; streamline material properties and improve state management

This commit is contained in:
Jerald-Golden-B 2025-03-29 18:35:34 +05:30
parent df571e18fb
commit 98eb403b4a
5 changed files with 11 additions and 19 deletions

View File

@ -28,7 +28,6 @@ const Header: React.FC = () => {
<div className="other-guest">+{guestUsers.length - 3}</div> <div className="other-guest">+{guestUsers.length - 3}</div>
)} )}
{guestUsers.slice(0, 3).map((user, index) => ( {guestUsers.slice(0, 3).map((user, index) => (
<>
<div <div
key={index} key={index}
className="user-profile" className="user-profile"
@ -36,7 +35,6 @@ const Header: React.FC = () => {
> >
{user.userName[0]} {user.userName[0]}
</div> </div>
</>
))} ))}
</div> </div>
<div className="user-profile-container"> <div className="user-profile-container">

View File

@ -17,7 +17,7 @@ function addRoofToScene(
}; };
const geometry = new THREE.ExtrudeGeometry(shape, extrudeSettings); const geometry = new THREE.ExtrudeGeometry(shape, extrudeSettings);
const material = new THREE.MeshStandardMaterial({ color: CONSTANTS.roofConfig.defaultColor, side: THREE.DoubleSide, transparent: true, depthWrite: false }); const material = new THREE.MeshStandardMaterial({ color: CONSTANTS.roofConfig.defaultColor, side: THREE.DoubleSide });
const mesh = new THREE.Mesh(geometry, material); const mesh = new THREE.Mesh(geometry, material);
mesh.position.y = CONSTANTS.wallConfig.height + floor; mesh.position.y = CONSTANTS.wallConfig.height + floor;
mesh.castShadow = true; mesh.castShadow = true;

View File

@ -22,8 +22,7 @@ function hideRoof(
if (roofChild.material) { if (roofChild.material) {
const materials = Array.isArray(roofChild.material) ? roofChild.material : [roofChild.material]; const materials = Array.isArray(roofChild.material) ? roofChild.material : [roofChild.material];
materials.forEach(material => { materials.forEach(material => {
// material.visible = v.dot(u) < 0.25; material.visible = v.dot(u) < 0.25;
material.visible = true;
}); });
} }
} }

View File

@ -20,12 +20,7 @@ const CamModelsGroup = () => {
const loader = new GLTFLoader(); const loader = new GLTFLoader();
const dracoLoader = new DRACOLoader(); const dracoLoader = new DRACOLoader();
const [cams, setCams] = useState<any[]>([]); const [cams, setCams] = useState<any[]>([]);
const [models, setModels] = useState< const [models, setModels] = useState<Record<string, { targetPosition: THREE.Vector3; targetRotation: THREE.Euler }>>({});
Record<
string,
{ targetPosition: THREE.Vector3; targetRotation: THREE.Euler }
>
>({});
dracoLoader.setDecoderPath("three/examples/jsm/libs/draco/gltf/"); dracoLoader.setDecoderPath("three/examples/jsm/libs/draco/gltf/");
loader.setDRACOLoader(dracoLoader); loader.setDRACOLoader(dracoLoader);
@ -163,7 +158,6 @@ const CamModelsGroup = () => {
cam.rotation.z cam.rotation.z
); );
newModel.userData = cam.userData; newModel.userData = cam.userData;
console.log('cam.userData: ', cam.userData);
setActiveUsers([...activeUsers, cam.userData]); setActiveUsers([...activeUsers, cam.userData]);
return newModel; return newModel;
}); });

View File

@ -15,6 +15,7 @@ export const deleteZonesApi = async (userId: string, organization: string, zoneI
} }
const result = await response.json(); const result = await response.json();
console.log('result: ', result);
return result; return result;
} catch (error) { } catch (error) {
if (error instanceof Error) { if (error instanceof Error) {