Refactor log status messages to use material names instead of IDs for improved readability and context

This commit is contained in:
Vishnu 2025-05-13 14:01:56 +05:30
parent e44876fc38
commit 4c13d31931
10 changed files with 23 additions and 23 deletions

View File

@ -1,4 +1,4 @@
import React, { useEffect, useState } from "react"; import React, { useState } from "react";
import Card from "./Card"; import Card from "./Card";
import AssetPreview from "./AssetPreview"; import AssetPreview from "./AssetPreview";
@ -48,17 +48,18 @@ const CardsContainer: React.FC<ModelsProps> = ({ models }) => {
<div className="cards-wrapper-container"> <div className="cards-wrapper-container">
{models.length > 0 && {models.length > 0 &&
models.map((assetDetail) => ( models.map((assetDetail) => (
<Card <React.Fragment key={assetDetail._id}>
key={assetDetail._id} <Card
assetName={assetDetail?.filename} assetName={assetDetail?.filename}
uploadedOn={assetDetail.uploadDate} uploadedOn={assetDetail.uploadDate}
price={assetDetail?.price} price={assetDetail?.price}
rating={4.5} rating={4.5}
views={800} views={800}
onSelectCard={handleCardSelect} onSelectCard={handleCardSelect}
image={assetDetail.thumbnail} image={assetDetail.thumbnail}
description={assetDetail.description} description={assetDetail.description}
/> />
</React.Fragment>
))} ))}
{/* <RenderOverlay> */} {/* <RenderOverlay> */}
{selectedCard && ( {selectedCard && (

View File

@ -1,7 +1,6 @@
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import FilterSearch from "./FilterSearch"; import FilterSearch from "./FilterSearch";
import CardsContainer from "./CardsContainer"; import CardsContainer from "./CardsContainer";
import { fetchAssets } from "../../services/marketplace/fetchAssets";
import { getAssetImages } from "../../services/factoryBuilder/assest/assets/getAssetImages"; import { getAssetImages } from "../../services/factoryBuilder/assest/assets/getAssetImages";
import SkeletonUI from "../../components/templates/SkeletonUI"; import SkeletonUI from "../../components/templates/SkeletonUI";
interface ModelData { interface ModelData {

View File

@ -14,7 +14,7 @@ export function useDefaultHandler() {
const material = getMaterialById(materialId); const material = getMaterialById(materialId);
if (!material) return; if (!material) return;
defaultLogStatus(material.materialId, `performed Default action`); defaultLogStatus(material.materialName, `performed Default action`);
}, [getMaterialById]); }, [getMaterialById]);

View File

@ -16,7 +16,7 @@ export function useDespawnHandler() {
removeMaterial(material.materialId); removeMaterial(material.materialId);
deSpawnLogStatus(material.materialId, `Despawned`); deSpawnLogStatus(material.materialName, `Despawned`);
}, [getMaterialById, removeMaterial]); }, [getMaterialById, removeMaterial]);

View File

@ -142,7 +142,7 @@ export function useSpawnHandler() {
if (elapsed >= adjustedInterval) { if (elapsed >= adjustedInterval) {
const createdMaterial = createNewMaterial(material, action); const createdMaterial = createNewMaterial(material, action);
if (createdMaterial) { if (createdMaterial) {
spawnLogStatus(createdMaterial.materialId, `[${elapsed.toFixed(2)}ms] Spawned ${material} (1/${totalCount})`); spawnLogStatus(createdMaterial.materialName, `[${elapsed.toFixed(2)}ms] Spawned ${material} (1/${totalCount})`);
} }
spawn.lastSpawnTime = currentTime; spawn.lastSpawnTime = currentTime;
spawn.spawnCount = 1; spawn.spawnCount = 1;
@ -162,7 +162,7 @@ export function useSpawnHandler() {
const count = spawn.spawnCount + 1; const count = spawn.spawnCount + 1;
const createdMaterial = createNewMaterial(material, action); const createdMaterial = createNewMaterial(material, action);
if (createdMaterial) { if (createdMaterial) {
spawnLogStatus(createdMaterial.materialId, `[${timeSinceLast.toFixed(2)}ms] Spawned ${material} (${count}/${totalCount})`); spawnLogStatus(createdMaterial.materialName, `[${timeSinceLast.toFixed(2)}ms] Spawned ${material} (${count}/${totalCount})`);
} }
spawn.lastSpawnTime = currentTime; spawn.lastSpawnTime = currentTime;
spawn.spawnCount = count; spawn.spawnCount = count;

View File

@ -16,7 +16,7 @@ export function useSwapHandler() {
if (!material) return; if (!material) return;
setMaterial(material.materialId, newMaterialType); setMaterial(material.materialId, newMaterialType);
swapLogStatus(material.materialId, `Swapped to ${newMaterialType}`); swapLogStatus(material.materialName, `Swapped to ${newMaterialType}`);
}, [getMaterialById, setMaterial]); }, [getMaterialById, setMaterial]);

View File

@ -29,8 +29,8 @@ export function useProcessHandler() {
addCurrentAction(modelUuid, action.actionUuid, newMaterialType, material.materialId); addCurrentAction(modelUuid, action.actionUuid, newMaterialType, material.materialId);
processLogStatus(material.materialId, `Swapped to ${newMaterialType}`); processLogStatus(material.materialName, `Swapped to ${newMaterialType}`);
processLogStatus(material.materialId, `starts Process action`); processLogStatus(material.materialName, `starts Process action`);
}, [getMaterialById]); }, [getMaterialById]);

View File

@ -31,7 +31,7 @@ export function usePickAndPlaceHandler() {
material.materialId material.materialId
); );
pickAndPlaceLogStatus(material.materialId, `is going to be picked by armBot ${modelUuid}`); pickAndPlaceLogStatus(material.materialName, `is going to be picked by armBot ${modelUuid}`);
}, [getMaterialById, getModelUuidByActionUuid, selectedProduct.productId, addCurrentAction]); }, [getMaterialById, getModelUuidByActionUuid, selectedProduct.productId, addCurrentAction]);

View File

@ -27,7 +27,7 @@ export function useStoreHandler() {
addCurrentMaterial(modelUuid, material.materialType, material.materialId); addCurrentMaterial(modelUuid, material.materialType, material.materialId);
updateCurrentLoad(modelUuid, 1); updateCurrentLoad(modelUuid, 1);
storeLogStatus(material.materialId, `performed Store action`); storeLogStatus(material.materialName, `performed Store action`);
}, [getMaterialById]); }, [getMaterialById]);

View File

@ -27,7 +27,7 @@ export function useTravelHandler() {
incrementVehicleLoad(modelUuid, 1); incrementVehicleLoad(modelUuid, 1);
addCurrentMaterial(modelUuid, material.materialType, material.materialId); addCurrentMaterial(modelUuid, material.materialType, material.materialId);
travelLogStatus(material.materialId, `is triggering travel from ${modelUuid}`); travelLogStatus(material.materialName, `is triggering travel from ${modelUuid}`);
}, [addCurrentMaterial, getMaterialById, getModelUuidByActionUuid, incrementVehicleLoad, selectedProduct.productId]); }, [addCurrentMaterial, getMaterialById, getModelUuidByActionUuid, incrementVehicleLoad, selectedProduct.productId]);