2026-01-17 11:36:24 +09:00

28 lines
671 B
TypeScript

import useEditor, { Phase, Tool } from "@/store/use-editor";
import { WallTool } from "./wall/wall-tool";
import { ItemTool } from "./item/item-tool";
const tools: Record<Phase, Partial<Record<Tool, React.FC>>> = {
site: {
},
structure: {
wall: WallTool,
item: ItemTool,
},
furnish: {
item: ItemTool
},
};
export const ToolManager: React.FC = () => {
const phase = useEditor((state) => state.phase);
const mode = useEditor((state) => state.mode);
const tool = useEditor((state) => state.tool);
if (mode !== "build" || tool === null) return null;
const Component = tools[phase]?.[tool];
return Component ? <Component /> : null;
};