refactor: update component structure and enhance list functionality with new asset and zone handling
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import React, { useEffect, useRef, useState } from "react";
|
import React, { useEffect, useRef, useState } from "react";
|
||||||
import { AddIcon, ArrowIcon, RemoveIcon, ResizeHeightIcon, } from "../../../icons/ExportCommonIcons";
|
import { AddIcon, ArrowIcon, RemoveIcon, ResizeHeightIcon } from "../../../icons/ExportCommonIcons";
|
||||||
import RenameInput from "../../../ui/inputs/RenameInput";
|
import RenameInput from "../../../ui/inputs/RenameInput";
|
||||||
import { handleResize } from "../../../../functions/handleResizePannel";
|
import { handleResize } from "../../../../functions/handleResizePannel";
|
||||||
import { useMainProduct, useSelectedAsset } from "../../../../store/simulation/useSimulationStore";
|
import { useMainProduct, useSelectedAsset } from "../../../../store/simulation/useSimulationStore";
|
||||||
@@ -13,7 +13,7 @@ import { deleteProductApi } from "../../../../services/simulation/products/delet
|
|||||||
import { renameProductApi } from "../../../../services/simulation/products/renameProductApi";
|
import { renameProductApi } from "../../../../services/simulation/products/renameProductApi";
|
||||||
import { determineExecutionMachineSequences } from "../../../../modules/simulation/simulator/functions/determineExecutionMachineSequences";
|
import { determineExecutionMachineSequences } from "../../../../modules/simulation/simulator/functions/determineExecutionMachineSequences";
|
||||||
import ComparePopUp from "../../../ui/compareVersion/Compare";
|
import ComparePopUp from "../../../ui/compareVersion/Compare";
|
||||||
import { useCompareStore, useSaveVersion, } from "../../../../store/builder/store";
|
import { useCompareStore, useSaveVersion } from "../../../../store/builder/store";
|
||||||
import { useToggleStore } from "../../../../store/useUIToggleStore";
|
import { useToggleStore } from "../../../../store/useUIToggleStore";
|
||||||
import { useProductContext } from "../../../../modules/simulation/products/productContext";
|
import { useProductContext } from "../../../../modules/simulation/products/productContext";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
@@ -25,22 +25,10 @@ interface Event {
|
|||||||
modelId: string;
|
modelId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ListProps {
|
|
||||||
val: Event;
|
|
||||||
}
|
|
||||||
|
|
||||||
const List: React.FC<ListProps> = ({ val }) => {
|
|
||||||
return (
|
|
||||||
<div className="process-container">
|
|
||||||
<div className="value">{val.modelName}</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const Simulations: React.FC = () => {
|
const Simulations: React.FC = () => {
|
||||||
const productsContainerRef = useRef<HTMLDivElement>(null);
|
const productsContainerRef = useRef<HTMLDivElement>(null);
|
||||||
const { eventStore, productStore } = useSceneContext();
|
const { eventStore, productStore } = useSceneContext();
|
||||||
const { products, addProduct, removeProduct, renameProduct, addEvent, removeEvent, getProductById, } = productStore();
|
const { products, addProduct, removeProduct, renameProduct, addEvent, removeEvent, getProductById } = productStore();
|
||||||
const { selectedProductStore } = useProductContext();
|
const { selectedProductStore } = useProductContext();
|
||||||
const { selectedProduct, setSelectedProduct } = selectedProductStore();
|
const { selectedProduct, setSelectedProduct } = selectedProductStore();
|
||||||
const { getEventByModelUuid } = eventStore();
|
const { getEventByModelUuid } = eventStore();
|
||||||
@@ -69,7 +57,7 @@ const Simulations: React.FC = () => {
|
|||||||
productName: name,
|
productName: name,
|
||||||
productUuid: id,
|
productUuid: id,
|
||||||
projectId: projectId,
|
projectId: projectId,
|
||||||
versionId: selectedVersion?.versionId || '',
|
versionId: selectedVersion?.versionId || "",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -85,14 +73,8 @@ const Simulations: React.FC = () => {
|
|||||||
if (currentIndex >= updatedProducts.length) {
|
if (currentIndex >= updatedProducts.length) {
|
||||||
newSelectedIndex = updatedProducts.length - 1;
|
newSelectedIndex = updatedProducts.length - 1;
|
||||||
}
|
}
|
||||||
setSelectedProduct(
|
setSelectedProduct(updatedProducts[newSelectedIndex].productUuid, updatedProducts[newSelectedIndex].productName);
|
||||||
updatedProducts[newSelectedIndex].productUuid,
|
setMainProduct(updatedProducts[newSelectedIndex].productUuid, updatedProducts[newSelectedIndex].productName);
|
||||||
updatedProducts[newSelectedIndex].productName
|
|
||||||
);
|
|
||||||
setMainProduct(
|
|
||||||
updatedProducts[newSelectedIndex].productUuid,
|
|
||||||
updatedProducts[newSelectedIndex].productName
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
setSelectedProduct("", "");
|
setSelectedProduct("", "");
|
||||||
setMainProduct("", "");
|
setMainProduct("", "");
|
||||||
@@ -102,14 +84,14 @@ const Simulations: React.FC = () => {
|
|||||||
removeProduct(productUuid);
|
removeProduct(productUuid);
|
||||||
deleteProductApi({
|
deleteProductApi({
|
||||||
productUuid,
|
productUuid,
|
||||||
versionId: selectedVersion?.versionId || '',
|
versionId: selectedVersion?.versionId || "",
|
||||||
projectId
|
projectId,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleRenameProduct = (productUuid: string, newName: string) => {
|
const handleRenameProduct = (productUuid: string, newName: string) => {
|
||||||
renameProduct(productUuid, newName);
|
renameProduct(productUuid, newName);
|
||||||
renameProductApi({ productName: newName, productUuid, projectId: projectId || '', versionId: selectedVersion?.versionId || '' });
|
renameProductApi({ productName: newName, productUuid, projectId: projectId || "", versionId: selectedVersion?.versionId || "" });
|
||||||
if (selectedProduct.productUuid === productUuid) {
|
if (selectedProduct.productUuid === productUuid) {
|
||||||
setSelectedProduct(productUuid, newName);
|
setSelectedProduct(productUuid, newName);
|
||||||
setMainProduct(productUuid, newName);
|
setMainProduct(productUuid, newName);
|
||||||
@@ -118,11 +100,10 @@ const Simulations: React.FC = () => {
|
|||||||
|
|
||||||
const handleRemoveEventFromProduct = () => {
|
const handleRemoveEventFromProduct = () => {
|
||||||
if (selectedAsset) {
|
if (selectedAsset) {
|
||||||
|
|
||||||
deleteEventDataApi({
|
deleteEventDataApi({
|
||||||
productUuid: selectedProduct.productUuid,
|
productUuid: selectedProduct.productUuid,
|
||||||
modelUuid: selectedAsset.modelUuid,
|
modelUuid: selectedAsset.modelUuid,
|
||||||
versionId: selectedVersion?.versionId || '',
|
versionId: selectedVersion?.versionId || "",
|
||||||
projectId: projectId,
|
projectId: projectId,
|
||||||
});
|
});
|
||||||
removeEvent(selectedProduct.productUuid, selectedAsset.modelUuid);
|
removeEvent(selectedProduct.productUuid, selectedAsset.modelUuid);
|
||||||
@@ -135,21 +116,18 @@ const Simulations: React.FC = () => {
|
|||||||
const selectedProductData = getProductById(selectedProduct.productUuid);
|
const selectedProductData = getProductById(selectedProduct.productUuid);
|
||||||
|
|
||||||
if (selectedProductData) {
|
if (selectedProductData) {
|
||||||
determineExecutionMachineSequences([selectedProductData]).then(
|
determineExecutionMachineSequences([selectedProductData]).then((sequences) => {
|
||||||
(sequences) => {
|
sequences.forEach((sequence) => {
|
||||||
sequences.forEach((sequence) => {
|
const events: Event[] =
|
||||||
const events: Event[] =
|
sequence.map((event) => ({
|
||||||
sequence.map((event) => ({
|
modelName: event.modelName,
|
||||||
modelName: event.modelName,
|
modelId: event.modelUuid,
|
||||||
modelId: event.modelUuid,
|
})) || [];
|
||||||
})) || [];
|
processes.push(events);
|
||||||
processes.push(events);
|
});
|
||||||
});
|
setProcesses(processes);
|
||||||
setProcesses(processes);
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}, [selectedProduct.productUuid, products]);
|
}, [selectedProduct.productUuid, products]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -159,77 +137,41 @@ const Simulations: React.FC = () => {
|
|||||||
<div className="actions section">
|
<div className="actions section">
|
||||||
<div className="header">
|
<div className="header">
|
||||||
<div className="header-value">Products</div>
|
<div className="header-value">Products</div>
|
||||||
<button
|
<button id="add-simulation" className="add-button" onClick={handleAddProduct}>
|
||||||
id="add-simulation"
|
|
||||||
className="add-button"
|
|
||||||
onClick={handleAddProduct}
|
|
||||||
>
|
|
||||||
<AddIcon /> Add
|
<AddIcon /> Add
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div className="lists-main-container" ref={productsContainerRef} style={{ height: "120px" }}>
|
||||||
className="lists-main-container"
|
|
||||||
ref={productsContainerRef}
|
|
||||||
style={{ height: "120px" }}
|
|
||||||
>
|
|
||||||
<div className="list-container">
|
<div className="list-container">
|
||||||
{products.map((product, index) => (
|
{products.map((product, index) => (
|
||||||
<div
|
<div key={product.productUuid} className={`list-item ${selectedProduct.productUuid === product.productUuid ? "active" : ""}`}>
|
||||||
key={product.productUuid}
|
|
||||||
className={`list-item ${selectedProduct.productUuid === product.productUuid
|
|
||||||
? "active"
|
|
||||||
: ""
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
{/* eslint-disable-next-line */}
|
{/* eslint-disable-next-line */}
|
||||||
<div
|
<div
|
||||||
className="value"
|
className="value"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setSelectedProduct(product.productUuid, product.productName)
|
setSelectedProduct(product.productUuid, product.productName);
|
||||||
setMainProduct(product.productUuid, product.productName)
|
setMainProduct(product.productUuid, product.productName);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<input
|
<input type="radio" name="products" checked={selectedProduct.productUuid === product.productUuid} readOnly />
|
||||||
type="radio"
|
<RenameInput value={product.productName} onRename={(newName) => handleRenameProduct(product.productUuid, newName)} />
|
||||||
name="products"
|
|
||||||
checked={selectedProduct.productUuid === product.productUuid}
|
|
||||||
readOnly
|
|
||||||
/>
|
|
||||||
<RenameInput
|
|
||||||
value={product.productName}
|
|
||||||
onRename={(newName) =>
|
|
||||||
handleRenameProduct(product.productUuid, newName)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
{products.length > 1 && (
|
{products.length > 1 && (
|
||||||
<button
|
<button id="remove-product-button" className="remove-button" onClick={() => handleRemoveProduct(product.productUuid)}>
|
||||||
id="remove-product-button"
|
|
||||||
className="remove-button"
|
|
||||||
onClick={() => handleRemoveProduct(product.productUuid)}
|
|
||||||
>
|
|
||||||
<RemoveIcon />
|
<RemoveIcon />
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button className="resize-icon" id="action-resize" onMouseDown={(e: any) => handleResize(e, productsContainerRef)}>
|
||||||
className="resize-icon"
|
|
||||||
id="action-resize"
|
|
||||||
onMouseDown={(e: any) => handleResize(e, productsContainerRef)}
|
|
||||||
>
|
|
||||||
<ResizeHeightIcon />
|
<ResizeHeightIcon />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="simulation-process section">
|
<div className="simulation-process section">
|
||||||
<button
|
<button id="collapse-header" className="collapse-header-container" onClick={() => setOpenObjects(!openObjects)}>
|
||||||
id="collapse-header"
|
|
||||||
className="collapse-header-container"
|
|
||||||
onClick={() => setOpenObjects(!openObjects)}
|
|
||||||
>
|
|
||||||
<div className="header">Process Flow</div>
|
<div className="header">Process Flow</div>
|
||||||
<div className="arrow-container">
|
<div className="arrow-container">
|
||||||
<ArrowIcon />
|
<ArrowIcon />
|
||||||
@@ -239,19 +181,18 @@ const Simulations: React.FC = () => {
|
|||||||
processes?.map((process, index) => (
|
processes?.map((process, index) => (
|
||||||
<section key={index}>
|
<section key={index}>
|
||||||
{process.map((event, index) => (
|
{process.map((event, index) => (
|
||||||
<List key={`${index}-${event.modelName}`} val={event} />
|
<div className="process-container" key={index}>
|
||||||
|
<div className="value">{event.modelName}</div>
|
||||||
|
</div>
|
||||||
))}
|
))}
|
||||||
</section>
|
</section>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="compare-simulations-container">
|
<div className="compare-simulations-container">
|
||||||
<div className="compare-simulations-header">
|
<div className="compare-simulations-header">Need to Compare Layout?</div>
|
||||||
Need to Compare Layout?
|
|
||||||
</div>
|
|
||||||
<div className="content">
|
<div className="content">
|
||||||
Click '<span>Compare</span>' to review and analyze the layout
|
Click '<span>Compare</span>' to review and analyze the layout differences between them.
|
||||||
differences between them.
|
|
||||||
</div>
|
</div>
|
||||||
<button className="input" onClick={() => setComparePopUp(true)}>
|
<button className="input" onClick={() => setComparePopUp(true)}>
|
||||||
<input type="button" value={"Compare"} className="submit" />
|
<input type="button" value={"Compare"} className="submit" />
|
||||||
@@ -270,8 +211,8 @@ const Simulations: React.FC = () => {
|
|||||||
addEvent,
|
addEvent,
|
||||||
selectedProduct,
|
selectedProduct,
|
||||||
clearSelectedAsset,
|
clearSelectedAsset,
|
||||||
projectId: projectId || '',
|
projectId: projectId || "",
|
||||||
versionId: selectedVersion?.versionId || '',
|
versionId: selectedVersion?.versionId || "",
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
handleRemoveEventFromProduct();
|
handleRemoveEventFromProduct();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import List from "./List";
|
|
||||||
import { AddIcon, ArrowIcon, FocusIcon } from "../../icons/ExportCommonIcons";
|
import { AddIcon, ArrowIcon, FocusIcon } from "../../icons/ExportCommonIcons";
|
||||||
import KebabMenuListMultiSelect from "./KebebMenuListMultiSelect";
|
import KebabMenuListMultiSelect from "./KebebMenuListMultiSelect";
|
||||||
|
import List from "./OutlineList/ListNew";
|
||||||
|
|
||||||
interface DropDownListProps {
|
interface DropDownListProps {
|
||||||
value?: string;
|
value?: string;
|
||||||
|
|||||||
@@ -1,368 +0,0 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
|
||||||
import RenameInput from "../inputs/RenameInput";
|
|
||||||
|
|
||||||
import { useSelectedZoneStore } from "../../../store/visualization/useZoneStore";
|
|
||||||
import { getZoneData } from "../../../services/visulization/zone/getZones";
|
|
||||||
import useModuleStore, {
|
|
||||||
useSubModuleStore,
|
|
||||||
} from "../../../store/useModuleStore";
|
|
||||||
import {
|
|
||||||
ArrowIcon,
|
|
||||||
EyeIcon,
|
|
||||||
LockIcon,
|
|
||||||
RemoveIcon,
|
|
||||||
} from "../../icons/ExportCommonIcons";
|
|
||||||
import { useZoneAssetId } from "../../../store/builder/store";
|
|
||||||
import { zoneCameraUpdate } from "../../../services/visulization/zone/zoneCameraUpdation";
|
|
||||||
import { setAssetsApi } from "../../../services/factoryBuilder/asset/floorAsset/setAssetsApi";
|
|
||||||
import { useParams } from "react-router-dom";
|
|
||||||
import { getUserData } from "../../../functions/getUserData";
|
|
||||||
import { useSceneContext } from "../../../modules/scene/sceneContext";
|
|
||||||
import { useVersionContext } from "../../../modules/builder/version/versionContext";
|
|
||||||
|
|
||||||
interface Asset {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
position?: [number, number, number]; // Proper 3D vector
|
|
||||||
rotation?: { x: number; y: number; z: number }; // Proper rotation format
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ZoneItem {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
assets?: Asset[];
|
|
||||||
active?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ListProps {
|
|
||||||
items?: ZoneItem[];
|
|
||||||
remove?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
const List: React.FC<ListProps> = ({ items = [], remove }) => {
|
|
||||||
const { activeModule } = useModuleStore();
|
|
||||||
const { selectedZone, setSelectedZone } = useSelectedZoneStore();
|
|
||||||
const { zoneAssetId, setZoneAssetId } = useZoneAssetId();
|
|
||||||
|
|
||||||
const { setSubModule } = useSubModuleStore();
|
|
||||||
const [expandedZones, setExpandedZones] = useState<Record<string, boolean>>(
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
const { projectId } = useParams();
|
|
||||||
const { assetStore } = useSceneContext();
|
|
||||||
const { setName } = assetStore();
|
|
||||||
const { organization } = getUserData();
|
|
||||||
const { selectedVersionStore } = useVersionContext();
|
|
||||||
const { selectedVersion } = selectedVersionStore();
|
|
||||||
const { zoneStore } = useSceneContext();
|
|
||||||
const { zones, setZoneName } = zoneStore();
|
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
useSelectedZoneStore.getState().setSelectedZone({
|
|
||||||
zoneName: "",
|
|
||||||
activeSides: [],
|
|
||||||
panelOrder: [],
|
|
||||||
lockedPanels: [],
|
|
||||||
zoneUuid: "",
|
|
||||||
zoneViewPortTarget: [],
|
|
||||||
zoneViewPortPosition: [],
|
|
||||||
widgets: [],
|
|
||||||
});
|
|
||||||
}, [activeModule]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const expanded: Record<string, boolean> = { "unassigned-zone": true };
|
|
||||||
if (zones.length > 0) {
|
|
||||||
zones.forEach((zone: any) => {
|
|
||||||
expanded[zone.zoneUuid] = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
setExpandedZones(expanded);
|
|
||||||
// eslint-disable-next-line
|
|
||||||
}, [zones.length]);
|
|
||||||
|
|
||||||
const toggleZoneExpansion = (zoneUuid: string) => {
|
|
||||||
setExpandedZones((prev) => ({
|
|
||||||
...prev,
|
|
||||||
[zoneUuid]: !prev[zoneUuid],
|
|
||||||
}));
|
|
||||||
};
|
|
||||||
|
|
||||||
async function handleSelectZone(id: string) {
|
|
||||||
try {
|
|
||||||
if (selectedZone?.zoneUuid === id || id === "unassigned-zone") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setSubModule("zoneProperties");
|
|
||||||
|
|
||||||
let response = await getZoneData(
|
|
||||||
id,
|
|
||||||
organization,
|
|
||||||
projectId,
|
|
||||||
selectedVersion?.versionId || ""
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!response) return;
|
|
||||||
|
|
||||||
setSelectedZone({
|
|
||||||
zoneName: response?.zoneName,
|
|
||||||
activeSides: response?.activeSides ?? [],
|
|
||||||
panelOrder: response?.panelOrder ?? [],
|
|
||||||
lockedPanels: response?.lockedPanels ?? [],
|
|
||||||
widgets: response?.widgets ?? [],
|
|
||||||
zoneUuid: response?.zoneUuid,
|
|
||||||
zoneViewPortTarget: response?.viewPortTarget ?? [],
|
|
||||||
zoneViewPortPosition: response?.viewPortPosition ?? [],
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
echo.error("Failed to select zone");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleAssetClick(asset: Asset) {
|
|
||||||
|
|
||||||
setZoneAssetId(asset);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleZoneNameChange(newName: string) {
|
|
||||||
const isDuplicate = zones.some(
|
|
||||||
(zone: any) =>
|
|
||||||
zone.zoneName?.trim().toLowerCase() === newName?.trim().toLowerCase() &&
|
|
||||||
zone.zoneUuid !== selectedZone.zoneUuid
|
|
||||||
);
|
|
||||||
|
|
||||||
if (isDuplicate) {
|
|
||||||
alert("Zone name already exists. Please choose a different name.");
|
|
||||||
return; // DO NOT update state
|
|
||||||
}
|
|
||||||
const zonesdata = {
|
|
||||||
zoneUuid: selectedZone.zoneUuid,
|
|
||||||
zoneName: newName,
|
|
||||||
};
|
|
||||||
const response = await zoneCameraUpdate(
|
|
||||||
zonesdata,
|
|
||||||
organization,
|
|
||||||
projectId,
|
|
||||||
selectedVersion?.versionId || ""
|
|
||||||
);
|
|
||||||
if (response.message === "zone updated") {
|
|
||||||
setSelectedZone((prev) => ({ ...prev, zoneName: newName }));
|
|
||||||
setZoneName(selectedZone.zoneUuid, newName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleZoneAssetName(newName: string) {
|
|
||||||
if (zoneAssetId?.id) {
|
|
||||||
let response = await setAssetsApi({
|
|
||||||
modelUuid: zoneAssetId.id,
|
|
||||||
modelName: newName,
|
|
||||||
projectId,
|
|
||||||
versionId: selectedVersion?.versionId || ''
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
setName(zoneAssetId.id, response.modelName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const checkZoneNameDuplicate = (name: string) => {
|
|
||||||
return zones.some(
|
|
||||||
(zone: any) =>
|
|
||||||
zone.zoneName?.trim().toLowerCase() === name?.trim().toLowerCase() &&
|
|
||||||
zone.zoneUuid !== selectedZone.zoneUuid
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
let drag = false;
|
|
||||||
let isLeftMouseDown = false;
|
|
||||||
|
|
||||||
const contextClassNames = [
|
|
||||||
"list-wrapper",
|
|
||||||
"zone-properties-container",
|
|
||||||
"list-container",
|
|
||||||
];
|
|
||||||
|
|
||||||
const isOutsideClick = (target: EventTarget | null) => {
|
|
||||||
if (!(target instanceof HTMLElement)) return true;
|
|
||||||
return !contextClassNames.some((className) =>
|
|
||||||
target.closest(`.${className}`)
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const onMouseDown = (evt: MouseEvent) => {
|
|
||||||
if (evt.button === 0) {
|
|
||||||
isLeftMouseDown = true;
|
|
||||||
drag = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const onMouseMove = () => {
|
|
||||||
if (isLeftMouseDown) {
|
|
||||||
drag = true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const onMouseUp = (evt: MouseEvent) => {
|
|
||||||
if (evt.button === 0) {
|
|
||||||
isLeftMouseDown = false;
|
|
||||||
if (drag) return;
|
|
||||||
|
|
||||||
if (isOutsideClick(evt.target)) {
|
|
||||||
// Clear selected zone
|
|
||||||
setSelectedZone({
|
|
||||||
zoneUuid: "",
|
|
||||||
zoneName: "",
|
|
||||||
activeSides: [],
|
|
||||||
panelOrder: [],
|
|
||||||
lockedPanels: [],
|
|
||||||
widgets: [],
|
|
||||||
zoneViewPortTarget: [],
|
|
||||||
zoneViewPortPosition: [],
|
|
||||||
});
|
|
||||||
setZoneAssetId({
|
|
||||||
id: "",
|
|
||||||
name: "",
|
|
||||||
});
|
|
||||||
setSubModule("properties");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (selectedZone.zoneName! === "" && activeModule === "Builder") {
|
|
||||||
document.addEventListener("mousedown", onMouseDown);
|
|
||||||
document.addEventListener("mousemove", onMouseMove);
|
|
||||||
document.addEventListener("mouseup", onMouseUp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
document.removeEventListener("mousedown", onMouseDown);
|
|
||||||
document.removeEventListener("mousemove", onMouseMove);
|
|
||||||
document.removeEventListener("mouseup", onMouseUp);
|
|
||||||
};
|
|
||||||
// eslint-disable-next-line
|
|
||||||
}, [selectedZone, activeModule]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{items?.length > 0 ? (
|
|
||||||
<ul className="list-wrapper">
|
|
||||||
{items?.map((item) => (
|
|
||||||
<React.Fragment key={`zone-${item.id}`}>
|
|
||||||
<li
|
|
||||||
className="list-container"
|
|
||||||
onClick={() => {
|
|
||||||
handleSelectZone(item.id);
|
|
||||||
toggleZoneExpansion(item.id);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className={`list-item ${selectedZone.zoneUuid === item.id ? "active" : ""
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
<div className="zone-header">
|
|
||||||
<button className="value" id="zone-name">
|
|
||||||
<RenameInput
|
|
||||||
value={item.name}
|
|
||||||
onRename={handleZoneNameChange}
|
|
||||||
checkDuplicate={checkZoneNameDuplicate}
|
|
||||||
canEdit={item.id !== "unassigned-zone"}
|
|
||||||
/>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div className="options-container">
|
|
||||||
<div className="lock option">
|
|
||||||
<LockIcon isLocked />
|
|
||||||
</div>
|
|
||||||
<div className="visibe option">
|
|
||||||
<EyeIcon isClosed />
|
|
||||||
</div>
|
|
||||||
{remove && (
|
|
||||||
<div className="remove option">
|
|
||||||
<RemoveIcon />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{item.assets && item.assets.length > 0 && (
|
|
||||||
<button
|
|
||||||
id="expand-btn"
|
|
||||||
className="expand-icon option"
|
|
||||||
onClick={() => toggleZoneExpansion(item.id)}
|
|
||||||
>
|
|
||||||
<ArrowIcon />
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
{/* Nested assets list - only shown when expanded */}
|
|
||||||
{item.assets &&
|
|
||||||
item.assets.length > 0 &&
|
|
||||||
expandedZones[item.id] && (
|
|
||||||
<ul className="asset-list">
|
|
||||||
{item.assets.map((asset) => (
|
|
||||||
<li
|
|
||||||
key={`asset-${asset.id}`}
|
|
||||||
className={`list-container asset-item ${zoneAssetId?.id === asset.id ? "active" : ""
|
|
||||||
}`}
|
|
||||||
onClick={() => handleAssetClick(asset)}
|
|
||||||
>
|
|
||||||
<div className="list-item">
|
|
||||||
<button
|
|
||||||
id={`${asset.name}-${asset.id}`}
|
|
||||||
className="value"
|
|
||||||
>
|
|
||||||
<RenameInput
|
|
||||||
value={asset.name}
|
|
||||||
onRename={handleZoneAssetName}
|
|
||||||
/>
|
|
||||||
</button>
|
|
||||||
<div className="options-container">
|
|
||||||
<button
|
|
||||||
className="lock option"
|
|
||||||
id="lock-btn"
|
|
||||||
onClick={(e) => {
|
|
||||||
e.stopPropagation();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<LockIcon isLocked />
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
className="visibe option"
|
|
||||||
id="visible-btn"
|
|
||||||
onClick={(e) => {
|
|
||||||
e.stopPropagation();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<EyeIcon isClosed />
|
|
||||||
</button>
|
|
||||||
{remove && (
|
|
||||||
<button
|
|
||||||
className="remove option"
|
|
||||||
id="remove-btn"
|
|
||||||
onClick={(e) => {
|
|
||||||
e.stopPropagation();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<RemoveIcon />
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
)}
|
|
||||||
</React.Fragment>
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
) : (
|
|
||||||
<div className="list-wrapper">
|
|
||||||
<div className="no-item">No items to display</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default List;
|
|
||||||
15
app/src/components/ui/list/OutlineList/AssetItem.tsx
Normal file
15
app/src/components/ui/list/OutlineList/AssetItem.tsx
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import React from "react";
|
||||||
|
import ListItemBase from "./ListItemBase";
|
||||||
|
|
||||||
|
const AssetItem: React.FC<AssetItemProps> = ({ asset, isActive, remove, onClick, onRename }) => (
|
||||||
|
<ListItemBase
|
||||||
|
id={asset.id}
|
||||||
|
name={asset.name}
|
||||||
|
isActive={isActive}
|
||||||
|
remove={remove}
|
||||||
|
onClick={() => onClick(asset)}
|
||||||
|
onRename={onRename}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default AssetItem;
|
||||||
83
app/src/components/ui/list/OutlineList/ListItemBase.tsx
Normal file
83
app/src/components/ui/list/OutlineList/ListItemBase.tsx
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
import React from "react";
|
||||||
|
import RenameInput from "../../inputs/RenameInput";
|
||||||
|
import { ArrowIcon, EyeIcon, LockIcon, RemoveIcon } from "../../../icons/ExportCommonIcons";
|
||||||
|
|
||||||
|
interface ListItemBaseProps {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
isActive?: boolean;
|
||||||
|
canEdit?: boolean;
|
||||||
|
remove?: boolean;
|
||||||
|
expandable?: boolean;
|
||||||
|
expanded?: boolean;
|
||||||
|
onClick?: () => void;
|
||||||
|
onRename: (newName: string) => void;
|
||||||
|
onToggleExpand?: () => void;
|
||||||
|
children?: React.ReactNode; // For nested assets
|
||||||
|
}
|
||||||
|
|
||||||
|
const ListItemBase: React.FC<ListItemBaseProps> = ({
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
isActive,
|
||||||
|
canEdit = true,
|
||||||
|
remove,
|
||||||
|
expandable,
|
||||||
|
expanded,
|
||||||
|
onClick,
|
||||||
|
onRename,
|
||||||
|
onToggleExpand,
|
||||||
|
children,
|
||||||
|
}) => (
|
||||||
|
<>
|
||||||
|
<li className={`list-container ${isActive ? "active" : ""}`} onClick={onClick}>
|
||||||
|
<div className="list-item">
|
||||||
|
<button className="value" id={`${name}-${id}`}>
|
||||||
|
<RenameInput value={name} onRename={onRename} canEdit={canEdit} />
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div className="options-container">
|
||||||
|
<button
|
||||||
|
className="lock option"
|
||||||
|
id="lock-btn"
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
|
<LockIcon isLocked />
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className="visibe option"
|
||||||
|
id="visible-btn"
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
|
<EyeIcon isClosed />
|
||||||
|
</button>
|
||||||
|
{remove && (
|
||||||
|
<button
|
||||||
|
className="remove option"
|
||||||
|
id="remove-btn"
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
|
<RemoveIcon />
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
{expandable && (
|
||||||
|
<button
|
||||||
|
id="expand-btn"
|
||||||
|
className="expand-icon option"
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
onToggleExpand?.();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ArrowIcon />
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
{expandable && expanded && <ul className="asset-list">{children}</ul>}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default ListItemBase;
|
||||||
49
app/src/components/ui/list/OutlineList/ListNew.tsx
Normal file
49
app/src/components/ui/list/OutlineList/ListNew.tsx
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
import React from "react";
|
||||||
|
import ZoneItemComponent from "./ZoneItem";
|
||||||
|
import { useSelectedZoneStore } from "../../../../store/visualization/useZoneStore";
|
||||||
|
import { useZoneAssetId } from "../../../../store/builder/store";
|
||||||
|
import { useZoneAssetHandlers } from "../../../../functions/outlineHelpers/useZoneAssetHandlers";
|
||||||
|
import { useZonesExpansion } from "../../../../functions/outlineHelpers/useZonesExpansion";
|
||||||
|
|
||||||
|
const List: React.FC<ListProps> = ({ items = [], remove }) => {
|
||||||
|
const { selectedZone } = useSelectedZoneStore();
|
||||||
|
const { zoneAssetId } = useZoneAssetId();
|
||||||
|
const { expandedZones, toggleZoneExpansion } = useZonesExpansion(items);
|
||||||
|
|
||||||
|
const {
|
||||||
|
handleSelectZone,
|
||||||
|
handleZoneNameChange,
|
||||||
|
handleAssetClick,
|
||||||
|
handleZoneAssetName,
|
||||||
|
} = useZoneAssetHandlers();
|
||||||
|
|
||||||
|
if (items.length === 0) {
|
||||||
|
return (
|
||||||
|
<div className="list-wrapper">
|
||||||
|
<div className="no-item">No items to display</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ul className="list-wrapper">
|
||||||
|
{items.map((item) => (
|
||||||
|
<ZoneItemComponent
|
||||||
|
key={item.id}
|
||||||
|
item={item}
|
||||||
|
remove={remove}
|
||||||
|
expanded={expandedZones[item.id]}
|
||||||
|
isActive={selectedZone.zoneUuid === item.id}
|
||||||
|
activeAssetId={zoneAssetId?.id}
|
||||||
|
onSelect={handleSelectZone}
|
||||||
|
onRename={handleZoneNameChange}
|
||||||
|
onToggleExpand={toggleZoneExpansion}
|
||||||
|
onAssetClick={handleAssetClick}
|
||||||
|
onAssetRename={handleZoneAssetName}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default List;
|
||||||
45
app/src/components/ui/list/OutlineList/ZoneItem.tsx
Normal file
45
app/src/components/ui/list/OutlineList/ZoneItem.tsx
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
import React from "react";
|
||||||
|
import ListItemBase from "./ListItemBase";
|
||||||
|
import AssetItem from "./AssetItem";
|
||||||
|
|
||||||
|
const ZoneItemComponent: React.FC<ZoneItemProps> = ({
|
||||||
|
item,
|
||||||
|
isActive,
|
||||||
|
expanded,
|
||||||
|
remove,
|
||||||
|
activeAssetId,
|
||||||
|
onSelect,
|
||||||
|
onRename,
|
||||||
|
onToggleExpand,
|
||||||
|
onAssetClick,
|
||||||
|
onAssetRename,
|
||||||
|
}) => (
|
||||||
|
<ListItemBase
|
||||||
|
id={item.id}
|
||||||
|
name={item.name}
|
||||||
|
isActive={isActive}
|
||||||
|
canEdit={item.id !== "unassigned-zone"}
|
||||||
|
remove={remove}
|
||||||
|
expandable={Boolean(item.assets?.length)}
|
||||||
|
expanded={expanded}
|
||||||
|
onClick={() => {
|
||||||
|
onSelect(item.id);
|
||||||
|
onToggleExpand(item.id);
|
||||||
|
}}
|
||||||
|
onRename={onRename}
|
||||||
|
onToggleExpand={() => onToggleExpand(item.id)}
|
||||||
|
>
|
||||||
|
{item.assets?.map((asset) => (
|
||||||
|
<AssetItem
|
||||||
|
key={asset.id}
|
||||||
|
asset={asset}
|
||||||
|
isActive={activeAssetId === asset.id}
|
||||||
|
remove={remove}
|
||||||
|
onClick={onAssetClick}
|
||||||
|
onRename={onAssetRename}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</ListItemBase>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default ZoneItemComponent;
|
||||||
111
app/src/functions/outlineHelpers/useZoneAssetHandlers.ts
Normal file
111
app/src/functions/outlineHelpers/useZoneAssetHandlers.ts
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
import { useCallback } from "react";
|
||||||
|
import { useParams } from "react-router-dom";
|
||||||
|
import { getUserData } from "../getUserData";
|
||||||
|
import { useVersionContext } from "../../modules/builder/version/versionContext";
|
||||||
|
import { getZoneData } from "../../services/visulization/zone/getZones";
|
||||||
|
import { zoneCameraUpdate } from "../../services/visulization/zone/zoneCameraUpdation";
|
||||||
|
import { setAssetsApi } from "../../services/factoryBuilder/asset/floorAsset/setAssetsApi";
|
||||||
|
import { useSelectedZoneStore } from "../../store/visualization/useZoneStore";
|
||||||
|
import { useSubModuleStore } from "../../store/useModuleStore";
|
||||||
|
import { useSceneContext } from "../../modules/scene/sceneContext";
|
||||||
|
import { useZoneAssetId } from "../../store/builder/store";
|
||||||
|
|
||||||
|
export const useZoneAssetHandlers = () => {
|
||||||
|
const { projectId } = useParams();
|
||||||
|
const { organization } = getUserData();
|
||||||
|
const { selectedVersionStore } = useVersionContext();
|
||||||
|
const { selectedVersion } = selectedVersionStore();
|
||||||
|
|
||||||
|
const { selectedZone, setSelectedZone } = useSelectedZoneStore();
|
||||||
|
const { setSubModule } = useSubModuleStore();
|
||||||
|
const { zoneAssetId, setZoneAssetId } = useZoneAssetId();
|
||||||
|
const { assetStore, zoneStore } = useSceneContext();
|
||||||
|
const { setName } = assetStore();
|
||||||
|
const { zones, setZoneName } = zoneStore();
|
||||||
|
|
||||||
|
// 🔹 Zone selection
|
||||||
|
const handleSelectZone = useCallback(
|
||||||
|
async (id: string) => {
|
||||||
|
if (selectedZone?.zoneUuid === id || id === "unassigned-zone") return;
|
||||||
|
setSubModule("zoneProperties");
|
||||||
|
|
||||||
|
const response = await getZoneData(
|
||||||
|
id,
|
||||||
|
organization,
|
||||||
|
projectId,
|
||||||
|
selectedVersion?.versionId || ""
|
||||||
|
);
|
||||||
|
if (!response) return;
|
||||||
|
|
||||||
|
setSelectedZone({
|
||||||
|
zoneName: response.zoneName,
|
||||||
|
activeSides: response.activeSides ?? [],
|
||||||
|
panelOrder: response.panelOrder ?? [],
|
||||||
|
lockedPanels: response.lockedPanels ?? [],
|
||||||
|
widgets: response.widgets ?? [],
|
||||||
|
zoneUuid: response.zoneUuid,
|
||||||
|
zoneViewPortTarget: response.viewPortTarget ?? [],
|
||||||
|
zoneViewPortPosition: response.viewPortPosition ?? [],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[organization, projectId, selectedVersion, selectedZone?.zoneUuid, setSelectedZone, setSubModule]
|
||||||
|
);
|
||||||
|
|
||||||
|
// 🔹 Zone rename
|
||||||
|
const handleZoneNameChange = useCallback(
|
||||||
|
async (newName: string) => {
|
||||||
|
const isDuplicate = zones.some(
|
||||||
|
(zone: any) =>
|
||||||
|
zone.zoneName?.trim().toLowerCase() === newName.trim().toLowerCase() &&
|
||||||
|
zone.zoneUuid !== selectedZone.zoneUuid
|
||||||
|
);
|
||||||
|
if (isDuplicate) {
|
||||||
|
alert("Zone name already exists. Please choose a different name.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await zoneCameraUpdate(
|
||||||
|
{ zoneUuid: selectedZone.zoneUuid, zoneName: newName },
|
||||||
|
organization,
|
||||||
|
projectId,
|
||||||
|
selectedVersion?.versionId || ""
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.message === "zone updated") {
|
||||||
|
setSelectedZone((prev) => ({ ...prev, zoneName: newName }));
|
||||||
|
setZoneName(selectedZone.zoneUuid, newName);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[organization, projectId, selectedVersion, selectedZone, setSelectedZone, setZoneName, zones]
|
||||||
|
);
|
||||||
|
|
||||||
|
// 🔹 Asset selection
|
||||||
|
const handleAssetClick = useCallback(
|
||||||
|
(asset: ListAsset) => {
|
||||||
|
setZoneAssetId(asset);
|
||||||
|
},
|
||||||
|
[setZoneAssetId]
|
||||||
|
);
|
||||||
|
|
||||||
|
// 🔹 Asset rename
|
||||||
|
const handleZoneAssetName = useCallback(
|
||||||
|
async (newName: string) => {
|
||||||
|
if (!zoneAssetId?.id) return;
|
||||||
|
const response = await setAssetsApi({
|
||||||
|
modelUuid: zoneAssetId.id,
|
||||||
|
modelName: newName,
|
||||||
|
projectId,
|
||||||
|
versionId: selectedVersion?.versionId || "",
|
||||||
|
});
|
||||||
|
setName(zoneAssetId.id, response.modelName);
|
||||||
|
},
|
||||||
|
[projectId, selectedVersion, setName, zoneAssetId]
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
handleSelectZone,
|
||||||
|
handleZoneNameChange,
|
||||||
|
handleAssetClick,
|
||||||
|
handleZoneAssetName,
|
||||||
|
};
|
||||||
|
};
|
||||||
22
app/src/functions/outlineHelpers/useZonesExpansion.ts
Normal file
22
app/src/functions/outlineHelpers/useZonesExpansion.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { useEffect, useState, useCallback } from "react";
|
||||||
|
|
||||||
|
export const useZonesExpansion = (zones: any[]) => {
|
||||||
|
const [expandedZones, setExpandedZones] = useState<Record<string, boolean>>({});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const expanded: Record<string, boolean> = { "unassigned-zone": true };
|
||||||
|
zones.forEach((zone) => {
|
||||||
|
expanded[zone.zoneUuid] = true;
|
||||||
|
});
|
||||||
|
setExpandedZones(expanded);
|
||||||
|
}, [zones, zones.length]);
|
||||||
|
|
||||||
|
const toggleZoneExpansion = useCallback((zoneUuid: string) => {
|
||||||
|
setExpandedZones((prev) => ({
|
||||||
|
...prev,
|
||||||
|
[zoneUuid]: !prev[zoneUuid],
|
||||||
|
}));
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return { expandedZones, toggleZoneExpansion };
|
||||||
|
};
|
||||||
43
app/src/types/uiTypes.d.ts
vendored
43
app/src/types/uiTypes.d.ts
vendored
@@ -27,3 +27,46 @@ interface CategoryListProp {
|
|||||||
categoryImage: string;
|
categoryImage: string;
|
||||||
category: string;
|
category: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface ListAsset {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface AssetItemProps {
|
||||||
|
asset: ListAsset;
|
||||||
|
isActive: boolean;
|
||||||
|
remove?: boolean;
|
||||||
|
onClick: (asset: ListAsset) => void;
|
||||||
|
onRename: (newName: string) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ZoneItem {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
assets?: ListAsset[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ZoneItemProps {
|
||||||
|
item: ZoneItem;
|
||||||
|
isActive: boolean;
|
||||||
|
expanded: boolean;
|
||||||
|
remove?: boolean;
|
||||||
|
activeAssetId?: string;
|
||||||
|
onSelect: (id: string) => void;
|
||||||
|
onRename: (newName: string) => void;
|
||||||
|
onToggleExpand: (id: string) => void;
|
||||||
|
onAssetClick: (asset: ListAsset) => void;
|
||||||
|
onAssetRename: (newName: string) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ZoneItem {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
assets?: ListAsset[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ListProps {
|
||||||
|
items?: ZoneItem[];
|
||||||
|
remove?: boolean;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user