import { Link } from 'react-router-dom' import { gatePath } from '../utils/routes.js' import { gateTitleById } from './GateSelect.jsx' const DEPENDENCY_TYPE_LABELS = { requires: 'Voraussetzung', blocks: 'Blockiert', related: 'Bezug', } const OUTGOING_PHRASES = { requires: 'benötigt', blocks: 'blockiert', related: 'Bezug zu', } const INCOMING_PHRASES = { requires: 'Voraussetzung für', blocks: 'Wird blockiert von', related: 'Bezug von', } function groupDependencies(itemId, dependencies) { /** @type {{ outgoing: typeof dependencies, incoming: typeof dependencies }} */ const groups = { outgoing: [], incoming: [] } for (const dep of dependencies) { if (dep.from_item_id === itemId) groups.outgoing.push(dep) else if (dep.to_item_id === itemId) groups.incoming.push(dep) } return groups } function DependencyRow({ dep, itemId, siblingItems, direction, canManage, busy, onDelete }) { const otherId = direction === 'outgoing' ? dep.to_item_id : dep.from_item_id const otherTitle = gateTitleById(siblingItems, otherId) || otherId const phrase = direction === 'outgoing' ? OUTGOING_PHRASES[dep.dependency_type] || dep.dependency_type : INCOMING_PHRASES[dep.dependency_type] || dep.dependency_type return (
{direction === 'outgoing' ? ( <> Dieses Gate {phrase}{' '} {otherTitle} > ) : ( <> {phrase}{' '} {otherTitle} > )}
{DEPENDENCY_TYPE_LABELS[dep.dependency_type] || dep.dependency_type}
Kanten für den Gate-Graph — ausgehende Abhängigkeiten kannst du hier anlegen und entfernen.
Noch keine Kanten — im Graph erscheinen Gates sonst nach Reihenfolge.
)} {outgoing.length > 0 && ( <>Mindestens ein weiteres Gate im Vorhaben nötig, um Kanten zu definieren.
)}