feat(sprint-5.5): add block version snapshots with switching between versions

- Add BlockSnapshot Prisma model (html, css, version, changelog) + migration
- Add API endpoints: POST/GET /blocks/snapshots, GET /blocks/snapshots/:id
- BlockMetaBar: version dropdown, HTML capture on save, onSnapshotSelect prop
- "Сохранить версию" now captures innerHTML snapshot + CSS and stores in DB
- Selecting archived version shows stored HTML snapshot instead of live component
- Yellow banner "Архивная версия" with link to return to current
- Split all 8 block pages into Server Component (metadata) + Client Component
- Add data-block-capture attribute for snapshot capture targeting

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
AR 15 M4
2026-03-25 00:17:25 +05:00
parent 196526ffc4
commit 5b54ad5c23
21 changed files with 1962 additions and 1554 deletions
@@ -0,0 +1,18 @@
-- CreateTable
CREATE TABLE "BlockSnapshot" (
"id" TEXT NOT NULL,
"blockPath" TEXT NOT NULL,
"version" TEXT NOT NULL,
"changelog" JSONB NOT NULL DEFAULT '[]',
"html" TEXT NOT NULL,
"css" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "BlockSnapshot_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE INDEX "BlockSnapshot_blockPath_idx" ON "BlockSnapshot"("blockPath");
-- CreateIndex
CREATE UNIQUE INDEX "BlockSnapshot_blockPath_version_key" ON "BlockSnapshot"("blockPath", "version");
+13
View File
@@ -50,3 +50,16 @@ model Block {
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
}
model BlockSnapshot {
id String @id @default(uuid())
blockPath String
version String
changelog Json @default("[]")
html String @db.Text
css String @db.Text
createdAt DateTime @default(now())
@@unique([blockPath, version])
@@index([blockPath])
}