35 lines
1.3 KiB
TypeScript
35 lines
1.3 KiB
TypeScript
import { memo } from 'react';
|
|
import { Handle, Position, NodeProps } from '@xyflow/react';
|
|
import { CutsceneStartNode as CutsceneStartNodeData } from '../../types/dialogue';
|
|
import { useValidation } from '../../hooks/useValidation';
|
|
import styles from './nodes.module.css';
|
|
|
|
export const CutsceneStartNode = memo(({ data, selected }: NodeProps & { data: CutsceneStartNodeData }) => {
|
|
const { hasError, hasWarning } = useValidation();
|
|
const error = hasError(data.id);
|
|
const warning = !error && hasWarning(data.id);
|
|
|
|
return (
|
|
<div
|
|
className={[
|
|
styles.node,
|
|
styles.cutsceneNode,
|
|
selected ? styles.selected : '',
|
|
error ? styles.hasError : '',
|
|
warning ? styles.hasWarning : '',
|
|
].join(' ')}
|
|
>
|
|
<Handle type="target" position={Position.Top} id="target" className={styles.handle} />
|
|
<div className={styles.nodeHeader}>
|
|
<span className={styles.speakerName}>Cutscene</span>
|
|
<span className={styles.nodeType}>Scene</span>
|
|
</div>
|
|
<div className={styles.nodeId}>{data.id}</div>
|
|
<div className={styles.nodeBody}>
|
|
<span className={styles.textSnippet}>{data.cutsceneId || '(no cutscene ID)'}</span>
|
|
</div>
|
|
<Handle type="source" position={Position.Bottom} id="source" className={styles.handle} />
|
|
</div>
|
|
);
|
|
});
|