From 4c13d31931bd80bcb4b3d6bc651ee18e2be31691 Mon Sep 17 00:00:00 2001 From: Vishnu Date: Tue, 13 May 2025 14:01:56 +0530 Subject: [PATCH] Refactor log status messages to use material names instead of IDs for improved readability and context --- app/src/modules/market/CardsContainer.tsx | 25 ++++++++++--------- app/src/modules/market/MarketPlace.tsx | 1 - .../actionHandler/useDefaultHandler.ts | 2 +- .../actionHandler/useDespawnHandler.ts | 2 +- .../conveyor/actionHandler/useSpawnHandler.ts | 4 +-- .../conveyor/actionHandler/useSwapHandler.ts | 2 +- .../actionHandler/useProcessHandler.ts | 4 +-- .../actionHandler/usePickAndPlaceHandler.ts | 2 +- .../actionHandler/useStoreHandler.ts | 2 +- .../vehicle/actionHandler/useTravelHandler.ts | 2 +- 10 files changed, 23 insertions(+), 23 deletions(-) diff --git a/app/src/modules/market/CardsContainer.tsx b/app/src/modules/market/CardsContainer.tsx index eabcbe4..62b905b 100644 --- a/app/src/modules/market/CardsContainer.tsx +++ b/app/src/modules/market/CardsContainer.tsx @@ -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 = ({ models }) => {
{models.length > 0 && models.map((assetDetail) => ( - + + + ))} {/* */} {selectedCard && ( diff --git a/app/src/modules/market/MarketPlace.tsx b/app/src/modules/market/MarketPlace.tsx index 3b4b87c..6de3fea 100644 --- a/app/src/modules/market/MarketPlace.tsx +++ b/app/src/modules/market/MarketPlace.tsx @@ -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 { diff --git a/app/src/modules/simulation/actions/conveyor/actionHandler/useDefaultHandler.ts b/app/src/modules/simulation/actions/conveyor/actionHandler/useDefaultHandler.ts index 2b48a25..ef8160e 100644 --- a/app/src/modules/simulation/actions/conveyor/actionHandler/useDefaultHandler.ts +++ b/app/src/modules/simulation/actions/conveyor/actionHandler/useDefaultHandler.ts @@ -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]); diff --git a/app/src/modules/simulation/actions/conveyor/actionHandler/useDespawnHandler.ts b/app/src/modules/simulation/actions/conveyor/actionHandler/useDespawnHandler.ts index 5136e51..9364d70 100644 --- a/app/src/modules/simulation/actions/conveyor/actionHandler/useDespawnHandler.ts +++ b/app/src/modules/simulation/actions/conveyor/actionHandler/useDespawnHandler.ts @@ -16,7 +16,7 @@ export function useDespawnHandler() { removeMaterial(material.materialId); - deSpawnLogStatus(material.materialId, `Despawned`); + deSpawnLogStatus(material.materialName, `Despawned`); }, [getMaterialById, removeMaterial]); diff --git a/app/src/modules/simulation/actions/conveyor/actionHandler/useSpawnHandler.ts b/app/src/modules/simulation/actions/conveyor/actionHandler/useSpawnHandler.ts index 544dc06..c4f9e6f 100644 --- a/app/src/modules/simulation/actions/conveyor/actionHandler/useSpawnHandler.ts +++ b/app/src/modules/simulation/actions/conveyor/actionHandler/useSpawnHandler.ts @@ -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; diff --git a/app/src/modules/simulation/actions/conveyor/actionHandler/useSwapHandler.ts b/app/src/modules/simulation/actions/conveyor/actionHandler/useSwapHandler.ts index 59de9b6..0f9af26 100644 --- a/app/src/modules/simulation/actions/conveyor/actionHandler/useSwapHandler.ts +++ b/app/src/modules/simulation/actions/conveyor/actionHandler/useSwapHandler.ts @@ -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]); diff --git a/app/src/modules/simulation/actions/machine/actionHandler/useProcessHandler.ts b/app/src/modules/simulation/actions/machine/actionHandler/useProcessHandler.ts index 8cb07fb..cfd0c5a 100644 --- a/app/src/modules/simulation/actions/machine/actionHandler/useProcessHandler.ts +++ b/app/src/modules/simulation/actions/machine/actionHandler/useProcessHandler.ts @@ -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]); diff --git a/app/src/modules/simulation/actions/roboticArm/actionHandler/usePickAndPlaceHandler.ts b/app/src/modules/simulation/actions/roboticArm/actionHandler/usePickAndPlaceHandler.ts index d880ae0..b134d78 100644 --- a/app/src/modules/simulation/actions/roboticArm/actionHandler/usePickAndPlaceHandler.ts +++ b/app/src/modules/simulation/actions/roboticArm/actionHandler/usePickAndPlaceHandler.ts @@ -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]); diff --git a/app/src/modules/simulation/actions/storageUnit/actionHandler/useStoreHandler.ts b/app/src/modules/simulation/actions/storageUnit/actionHandler/useStoreHandler.ts index beb3d79..2b0e990 100644 --- a/app/src/modules/simulation/actions/storageUnit/actionHandler/useStoreHandler.ts +++ b/app/src/modules/simulation/actions/storageUnit/actionHandler/useStoreHandler.ts @@ -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]); diff --git a/app/src/modules/simulation/actions/vehicle/actionHandler/useTravelHandler.ts b/app/src/modules/simulation/actions/vehicle/actionHandler/useTravelHandler.ts index af7793c..c661883 100644 --- a/app/src/modules/simulation/actions/vehicle/actionHandler/useTravelHandler.ts +++ b/app/src/modules/simulation/actions/vehicle/actionHandler/useTravelHandler.ts @@ -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]);