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,6 +1,6 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useDiagramSnapshotStore } from '../../state/diagramSnapshotStore'
|
||||
import { useProjectStore } from '../../state/projectStore'
|
||||
import { useDiagramStore } from '../../state/diagramStore'
|
||||
import Modal from '../common/Modal'
|
||||
|
||||
function formatDateTime(iso: string): string {
|
||||
@@ -8,10 +8,10 @@ function formatDateTime(iso: string): string {
|
||||
}
|
||||
|
||||
export default function VersionHistoryModal({ onClose }: { onClose: () => void }) {
|
||||
const project = useProjectStore((s) => s.project)
|
||||
const access = useProjectStore((s) => s.access)
|
||||
const diagram = useDiagramStore((s) => s.diagram)
|
||||
const access = useDiagramStore((s) => s.access)
|
||||
const canRestore = access?.myPermission === 'owner' || access?.myPermission === 'edit'
|
||||
const diagramId = project.id
|
||||
const diagramId = diagram.id
|
||||
|
||||
const snapshots = useDiagramSnapshotStore((s) => s.snapshots)
|
||||
const isLoaded = useDiagramSnapshotStore((s) => s.isLoaded)
|
||||
@@ -37,7 +37,7 @@ export default function VersionHistoryModal({ onClose }: { onClose: () => void }
|
||||
}
|
||||
|
||||
return (
|
||||
<Modal title={`Version History — "${project.name}"`} onClose={onClose} width="max-w-md">
|
||||
<Modal title={`Version History — "${diagram.name}"`} onClose={onClose} width="max-w-md">
|
||||
<div className="space-y-1.5">
|
||||
<p className="text-[11px] text-slate-500">
|
||||
Checkpoints saved periodically while editing (up to the 50 most recent).
|
||||
|
||||
Reference in New Issue
Block a user