From 89c23390126a80678b7124aadbd6e6b64323765b Mon Sep 17 00:00:00 2001 From: Jerald-Golden-B Date: Mon, 15 Dec 2025 16:32:39 +0530 Subject: [PATCH] feat: add decal library URL and update related components for decal handling --- app/.env | 3 +++ app/src/components/layout/sidebarLeft/assetList/Assets.tsx | 1 + .../assetList/assetsHelpers/renderAssetHelper.tsx | 6 +++--- .../modules/builder/Decal/decalInstance/decalInstance.tsx | 6 +++--- app/src/services/builder/asset/decals/getCategoryDecals.ts | 2 +- app/src/types/uiTypes.d.ts | 3 ++- 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app/.env b/app/.env index 4bfb63a..f0c86c1 100644 --- a/app/.env +++ b/app/.env @@ -13,6 +13,9 @@ REACT_APP_SERVER_MARKETPLACE_URL=185.100.212.76:50011 # Base URL for the asset library server, used for asset library images and model blob id. REACT_APP_SERVER_ASSET_LIBRARY_URL=185.100.212.76:50011 +# Base URL for the decal library server, used for decal library images and model blob id. +REACT_APP_SERVER_DECAL_LIBRARY_URL=185.100.212.76:9998 + # base url for IoT socket server REACT_APP_IOT_SOCKET_SERVER_URL =185.100.212.76:5010 diff --git a/app/src/components/layout/sidebarLeft/assetList/Assets.tsx b/app/src/components/layout/sidebarLeft/assetList/Assets.tsx index 2f5a283..4ac0130 100644 --- a/app/src/components/layout/sidebarLeft/assetList/Assets.tsx +++ b/app/src/components/layout/sidebarLeft/assetList/Assets.tsx @@ -111,6 +111,7 @@ const Assets: React.FC = () => { onClick={async () => { setIsLoading(true); const res = await fetchCategoryDecals(cat.name); + console.log('res: ', res); setAssets(res); setSelectedDecalCategory(cat.name); setIsLoading(false); diff --git a/app/src/components/layout/sidebarLeft/assetList/assetsHelpers/renderAssetHelper.tsx b/app/src/components/layout/sidebarLeft/assetList/assetsHelpers/renderAssetHelper.tsx index 9a3cf95..5438f37 100644 --- a/app/src/components/layout/sidebarLeft/assetList/assetsHelpers/renderAssetHelper.tsx +++ b/app/src/components/layout/sidebarLeft/assetList/assetsHelpers/renderAssetHelper.tsx @@ -10,15 +10,15 @@ export const RenderAsset: React.FC<{ asset: AssetProp | DecalProp; index: number return (
{asset.decalName} { setDroppedDecal({ category: asset.category, decalName: asset.decalName, - decalImage: asset.decalImage, - decalId: asset.id, + decalImage: asset.decalImage || "", + decalId: asset.decalUrl || "", }) }} /> diff --git a/app/src/modules/builder/Decal/decalInstance/decalInstance.tsx b/app/src/modules/builder/Decal/decalInstance/decalInstance.tsx index fd4c149..d246d50 100644 --- a/app/src/modules/builder/Decal/decalInstance/decalInstance.tsx +++ b/app/src/modules/builder/Decal/decalInstance/decalInstance.tsx @@ -18,7 +18,7 @@ function DecalInstance({ zPosition = decal.decalPosition[2], overWritePosition = null, }: Readonly<{ parent: Wall | Floor; visible?: boolean; decal: Decal; zPosition?: number; overWritePosition?: [number, number, number] | null }>) { - const url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_MARKETPLACE_URL}`; + const url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_DECAL_LIBRARY_URL}`; const { selectedDecal, deletableDecal, setSelectedDecal, setDeletableDecal } = useBuilderStore(); const { toolMode } = useToolMode(); const { toggleView } = useToggleView(); @@ -108,7 +108,7 @@ function DecalInstance({ }; const loadFromBackend = (decalId: string) => { - const textureUrl = `${url_Backend_dwinzo}/api/v1/DecalImage/${decalId}`; + const textureUrl = `${url_Backend_dwinzo}/${decalId}`; const textureLoader = new THREE.TextureLoader(); textureLoader.load( @@ -161,7 +161,7 @@ function DecalInstance({ return ( { try { const response = await fetch( - `${BackEnd_url}/api/v1/categoryDecalDatas/${category}`, + `${BackEnd_url}/api/v2/categoryDecalDatas/${category}`, { method: "GET", headers: { diff --git a/app/src/types/uiTypes.d.ts b/app/src/types/uiTypes.d.ts index 500b72e..ebbeb0a 100644 --- a/app/src/types/uiTypes.d.ts +++ b/app/src/types/uiTypes.d.ts @@ -18,7 +18,8 @@ interface AssetProp { interface DecalProp { id: string; decalName: string; - decalImage: string; + decalImage?: string; + decalUrl?: string; category: string; type?: string; }