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

View File

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

View File

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

View File

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

View File

@ -142,7 +142,7 @@ export function useSpawnHandler() {
if (elapsed >= adjustedInterval) {
const createdMaterial = createNewMaterial(material, action);
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.spawnCount = 1;
@ -162,7 +162,7 @@ export function useSpawnHandler() {
const count = spawn.spawnCount + 1;
const createdMaterial = createNewMaterial(material, action);
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.spawnCount = count;

View File

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

View File

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

View File

@ -31,7 +31,7 @@ export function usePickAndPlaceHandler() {
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]);

View File

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

View File

@ -27,7 +27,7 @@ export function useTravelHandler() {
incrementVehicleLoad(modelUuid, 1);
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]);