import React from 'react'; import { useEditor } from '@craftjs/core'; import { Card } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Type, Box, Image, Layers } from 'lucide-react'; import { Text, Container } from './UserBlocks'; export const Toolbox = () => { const { connectors } = useEditor(); return (

Blocks

); }; export const SettingsPanel = () => { // Fix: Correctly access node state using type assertion or checking if exists const { selected, actions } = useEditor((state) => { const [currentNodeId] = state.events.selected; let selected; if (currentNodeId) { const node = state.nodes[currentNodeId]; selected = { id: currentNodeId, name: node.data.displayName, settings: node.related && node.related.settings, isDeletable: (node.data as any).isDeletable !== false, // Use type assertion or default true props: node.data.props }; } return { selected }; }); if (!selected) { return (
Select an element to edit properties
) } return (

{selected.name}

{selected.isDeletable && ( )}
{selected.settings && React.createElement(selected.settings, { ...selected.props, setProp: (cb: any) => actions.setProp(selected.id, cb) })}
) }