import { useState, useEffect } from 'react'; import { Entity } from '@esengine/ecs-framework'; import { EntityStoreService, MessageHub } from '@esengine/editor-core'; import '../styles/EntityInspector.css'; interface EntityInspectorProps { entityStore: EntityStoreService; messageHub: MessageHub; } export function EntityInspector({ entityStore, messageHub }: EntityInspectorProps) { const [selectedEntity, setSelectedEntity] = useState(null); useEffect(() => { const handleSelection = (data: { entity: Entity | null }) => { setSelectedEntity(data.entity); }; const unsubSelect = messageHub.subscribe('entity:selected', handleSelection); return () => { unsubSelect(); }; }, [messageHub]); if (!selectedEntity) { return (

Inspector

No entity selected
); } const components = selectedEntity.components; return (

Inspector

Entity Info
ID: {selectedEntity.id}
Name: Entity {selectedEntity.id}
Enabled: {selectedEntity.enabled ? 'Yes' : 'No'}
Components ({components.length})
{components.length === 0 ? (
No components
) : (
    {components.map((component, index) => (
  • 🔧 {component.constructor.name}
  • ))}
)}
); }