import React, { useRef, useState } from "react"; import InputWithDropDown from "../../../../ui/inputs/InputWithDropDown"; import LabledDropdown from "../../../../ui/inputs/LabledDropdown"; import { AddIcon, RemoveIcon, ResizeHeightIcon, } from "../../../../icons/ExportCommonIcons"; import RenameInput from "../../../../ui/inputs/RenameInput"; import { handleResize } from "../../../../../functions/handleResizePannel"; import { handleActionToggle } from "./functions/handleActionToggle"; import { handleDeleteAction } from "./functions/handleDeleteAction"; import DefaultAction from "./actions/DefaultAction"; import SpawnAction from "./actions/SpawnAction"; import SwapAction from "./actions/SwapAction"; import DespawnAction from "./actions/DespawnAction"; import TravelAction from "./actions/TravelAction"; import PickAndPlaceAction from "./actions/PickAndPlaceAction"; import ProcessAction from "./actions/ProcessAction"; import StorageAction from "./actions/StorageAction"; interface EventPropertiesProps { assetType: string; selectedPoint: { name: string; uuid: string; actions: { uuid: string; name: string; isUsed: boolean; }[]; }; selectedItem: { item: { uuid: string; name: string; isUsed: boolean; } | null; }; setSelectedPoint: (value: string) => void; selectedActionSphere: string; } const EventProperties: React.FC = ({ assetType, selectedPoint, selectedItem, setSelectedPoint, selectedActionSphere, }) => { const actionsContainerRef = useRef(null); const [activeOption, setActiveOption] = useState("default"); const [dummyactiveOption, setTypeOption] = useState("default"); const getAvailableActions = () => { if (assetType === "conveyor") { return { defaultOption: "default", options: ["default", "spawn", "swap", "despawn"], }; } if (assetType === "vehicle") { return { defaultOption: "travel", options: ["travel"], }; } if (assetType === "roboticArm") { return { defaultOption: "pickAndPlace", options: ["pickAndPlace"], }; } if (assetType === "machine") { return { defaultOption: "process", options: ["process"], }; } if (assetType === "store") { return { defaultOption: "store", options: ["store", "spawn"], }; } else { return { defaultOption: "default", options: ["default"], }; } }; return (
{selectedPoint.name}
setTypeOption(option)} />
{}} onChange={(value) => console.log(value)} />
{}} onChange={(value) => console.log(value)} />
Actions
{}}> Add
{selectedPoint?.actions.map((action) => (
handleActionToggle(action.uuid)} >
{selectedPoint?.actions.length > 1 && (
handleDeleteAction(action.uuid)} >
)}
))}
handleResize(e, actionsContainerRef)} >
setActiveOption(option)} /> {activeOption === "default" && } {/* done */} {activeOption === "spawn" && } {/* done */} {activeOption === "swap" && } {/* done */} {activeOption === "despawn" && } {/* done */} {activeOption === "travel" && } {/* done */} {activeOption === "pickAndPlace" && } {activeOption === "process" && } {/* done */} {activeOption === "store" && } {/* done */}
); }; export default EventProperties;