import { useDialogueStore } from '../../store/dialogueStore'; import { LineInspector } from './inspectors/LineInspector'; import { ChoiceInspector } from './inspectors/ChoiceInspector'; import { ConditionInspector } from './inspectors/ConditionInspector'; import { SetFlagInspector } from './inspectors/SetFlagInspector'; import { CutsceneStartInspector, EndInspector } from './inspectors/OtherInspectors'; import { DialogueNode } from '../../types/dialogue'; import styles from './RightPanel.module.css'; // Helper to update start node ID function useUpdateStart() { const store = useDialogueStore; return (dialogueId: string, start: string) => { store.setState(state => { const d = state.file?.dialogues.find(x => x.id === dialogueId); if (d) d.start = start; }); }; } export function RightPanel() { const { file, selectedDialogueId, selectedNodeId } = useDialogueStore(); const updateStart = useUpdateStart(); const dialogue = file?.dialogues.find(d => d.id === selectedDialogueId); if (!dialogue) { return (
No dialogue selected
); } if (!selectedNodeId) { return (
Dialogue Properties
{ if (selectedDialogueId) updateStart(selectedDialogueId, e.target.value); }} list="startNodeList" /> {dialogue.nodes.map(n =>
Click a node in the graph to inspect it.
Node Count
{(['Line', 'Choice', 'Condition', 'SetFlag', 'CutsceneStart', 'End'] as DialogueNode['type'][]).map(t => { const count = dialogue.nodes.filter(n => n.type === t).length; return count > 0 ? ( {t}: {count} ) : null; })}
); } const node = dialogue.nodes.find(n => n.id === selectedNodeId); if (!node) return null; return (
{node.type === 'Line' && ( )} {node.type === 'Choice' && ( )} {node.type === 'Condition' && ( )} {node.type === 'SetFlag' && ( )} {node.type === 'CutsceneStart' && ( )} {node.type === 'End' && ( )}
); }