Rename Project to Diagram throughout the app
Per organized-ideas.md §8: the storage layer (DiagramRepository etc.) was already renamed in an earlier phase; this finishes it everywhere else. - domain/types.ts: Project -> Diagram. domain/project.ts -> domain/diagram.ts (createEmptyProject -> createEmptyDiagram, default name "Untitled Diagram"). - domain/compatibility.ts, domain/bom.ts: Project param/type -> Diagram. - data/exportImport.ts: ProjectImportError -> DiagramImportError, projectToJson/downloadProjectFile/readProjectFile/normalizeProject -> their Diagram equivalents. - state/projectStore.ts -> state/diagramStore.ts: useProjectStore -> useDiagramStore, the `project` field -> `diagram`, newProject/renameProject/ importProject/applyRestoredProject -> *Diagram, restoredProjectUpdatedAt -> restoredDiagramUpdatedAt. - Every component updated to match, compiler-guided (tsc -b enumerated each remaining call site after the core rename, the same approach used for the earlier catalog-parameter refactor). - README updated for the terminology, and to match the repository class names (which had already been renamed but the README hadn't caught up). No backend/schema changes: the JSON shape stored in diagrams.data never changed, only TypeScript-side identifiers, so existing diagrams are unaffected. One SQL comment fixed for accuracy (no migration needed). Verified: tsc -b and oxlint clean; grepped src/ for any remaining Project/project reference (none) after the sweep.
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
import { useMemo } from 'react'
|
||||
import { cableTypesForConnection, getPortType } from '../../domain/project'
|
||||
import { cableTypesForConnection, getPortType } from '../../domain/diagram'
|
||||
import { useCatalogStore } from '../../state/catalogStore'
|
||||
import { useProjectStore } from '../../state/projectStore'
|
||||
import { useDiagramStore } from '../../state/diagramStore'
|
||||
|
||||
export default function ConnectionInspector({ connectionId }: { connectionId: string }) {
|
||||
const project = useProjectStore((s) => s.project)
|
||||
const diagram = useDiagramStore((s) => s.diagram)
|
||||
const catalog = useCatalogStore((s) => s.catalog)
|
||||
const access = useProjectStore((s) => s.access)
|
||||
const access = useDiagramStore((s) => s.access)
|
||||
const canEdit = access?.myPermission !== 'view'
|
||||
const updateConnection = useProjectStore((s) => s.updateConnection)
|
||||
const removeConnection = useProjectStore((s) => s.removeConnection)
|
||||
const updateConnection = useDiagramStore((s) => s.updateConnection)
|
||||
const removeConnection = useDiagramStore((s) => s.removeConnection)
|
||||
|
||||
const connection = project.connections.find((c) => c.id === connectionId)
|
||||
const sourceDevice = project.devices.find((d) => d.id === connection?.sourceDeviceId)
|
||||
const targetDevice = project.devices.find((d) => d.id === connection?.targetDeviceId)
|
||||
const connection = diagram.connections.find((c) => c.id === connectionId)
|
||||
const sourceDevice = diagram.devices.find((d) => d.id === connection?.sourceDeviceId)
|
||||
const targetDevice = diagram.devices.find((d) => d.id === connection?.targetDeviceId)
|
||||
const sourcePort = sourceDevice?.ports.find((p) => p.id === connection?.sourcePortId)
|
||||
const targetPort = targetDevice?.ports.find((p) => p.id === connection?.targetPortId)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user