Refactor simulation types and update imports
- Renamed simulation type imports from `simulation` to `simulationTypes` across multiple files for consistency. - Consolidated simulation type definitions into a new `simulationTypes.d.ts` file. - Updated relevant components (e.g., `ArmBot`, `IkInstances`, `PathConnector`, etc.) to use the new type definitions. - Removed the old `simulation.d.ts` file to clean up the codebase. - Adjusted function signatures and state management in components to align with the new type structure.
This commit is contained in:
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from "react";
|
||||
import { useThree } from "@react-three/fiber";
|
||||
import useModuleStore from "../../../store/useModuleStore";
|
||||
import { useSimulationStates } from "../../../store/store";
|
||||
import * as SimulationTypes from '../../../types/simulation';
|
||||
import * as SimulationTypes from '../../../types/simulationTypes';
|
||||
import { ArmbotInstances } from "./ArmBotInstances";
|
||||
|
||||
interface ArmBotState {
|
||||
@@ -12,14 +12,18 @@ interface ArmBotState {
|
||||
status: string;
|
||||
material: string;
|
||||
triggerId: string;
|
||||
connections: any
|
||||
actions: { uuid: string; name: string; speed: number; processes: { triggerId: string; startPoint: string; endPoint: string }[]; };
|
||||
}
|
||||
|
||||
const ArmBot: React.FC = () => {
|
||||
interface ArmBotProps {
|
||||
armBots: ArmBotState[];
|
||||
setArmBots: React.Dispatch<React.SetStateAction<ArmBotState[]>>;
|
||||
}
|
||||
|
||||
const ArmBot = ({ armBots, setArmBots }: ArmBotProps) => {
|
||||
const { activeModule } = useModuleStore();
|
||||
const { scene } = useThree();
|
||||
const { simulationStates } = useSimulationStates();
|
||||
const [armBots, setArmBots] = useState<ArmBotState[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
const filtered = simulationStates.filter((s): s is SimulationTypes.ArmBotEventsSchema => s.type === "ArmBot");
|
||||
@@ -30,7 +34,7 @@ const ArmBot: React.FC = () => {
|
||||
status: "idle",
|
||||
material: "default",
|
||||
triggerId: '',
|
||||
connections: bot.points.connections
|
||||
actions: bot.points.actions
|
||||
}));
|
||||
setArmBots(initialStates);
|
||||
}, [simulationStates]);
|
||||
|
||||
Reference in New Issue
Block a user