feat: wire visual rewrite workspace UI

This commit is contained in:
DCCONSTRUCTIONS 2026-07-02 13:48:24 +03:00
parent f9b240dbd1
commit 214b714873
4 changed files with 6446 additions and 483 deletions

File diff suppressed because it is too large Load Diff

View File

@ -51,7 +51,7 @@ type ScopeNodeData = {
previewMode: "frame" | "empty" | "none"; previewMode: "frame" | "empty" | "none";
selected: boolean; selected: boolean;
sectionId?: string; sectionId?: string;
scope: ScopeType | "project" | "home_section" | "page_group"; scope: ScopeType | "project" | "source_section" | "page_group";
scopeLabel: string; scopeLabel: string;
status: "coverage" | "excluded" | "project"; status: "coverage" | "excluded" | "project";
subtitle: string; subtitle: string;
@ -125,7 +125,7 @@ const scopeGroupNames: Record<ScopeType, string> = {
admin_page: "Админка", admin_page: "Админка",
indexable_page: "Публичные страницы", indexable_page: "Публичные страницы",
technical_page: "Технический слой", technical_page: "Технический слой",
template_block: "Секции главной" template_block: "Секции сайта"
}; };
function isHomePage(page: ScanPage) { function isHomePage(page: ScanPage) {
@ -145,12 +145,12 @@ function getPageTitle(page: ScanPage) {
} }
function getPagePath(page: ScanPage) { function getPagePath(page: ScanPage) {
if (page.scope === "template_block" && page.previewKind === "home_section") { if (page.scope === "template_block" && page.previewKind === "source_section") {
return `${page.sourcePath} · секция главной`; return `${page.sourcePath} · секция сайта`;
} }
if (page.scope === "template_block" && page.visibleInSite === false) { if (page.scope === "template_block" && page.visibleInSite === false) {
return `${page.sourcePath} · выключено в home.json`; return `${page.sourcePath} · выключено в модели источника`;
} }
if (isHomePage(page)) { if (isHomePage(page)) {
@ -374,8 +374,8 @@ function getSectionPreviewUrl(projectId: string, cacheVersion: string, section:
} }
function getPagePreviewNote(page: ScanPage) { function getPagePreviewNote(page: ScanPage) {
if (page.previewKind === "home_section") { if (page.previewKind === "source_section") {
return page.previewTargetSelector ? `Превью секции: ${page.previewTargetSelector}` : "Превью секции главной"; return page.previewTargetSelector ? `Превью секции: ${page.previewTargetSelector}` : "Превью секции сайта";
} }
if (page.visibleInSite === false) { if (page.visibleInSite === false) {
@ -396,10 +396,10 @@ function getSectionPreviewNote(section: ScanSection) {
if (section.previewTargetSelector) { if (section.previewTargetSelector) {
const suffix = section.previewTargetIndex ? ` #${section.previewTargetIndex + 1}` : ""; const suffix = section.previewTargetIndex ? ` #${section.previewTargetIndex + 1}` : "";
return `Секция главной: ${section.previewTargetSelector}${suffix}`; return `Секция сайта: ${section.previewTargetSelector}${suffix}`;
} }
return "Секция главной страницы"; return "Секция модели источника";
} }
function getProjectTitle(scan: ProjectScanSummary, projectName: string) { function getProjectTitle(scan: ProjectScanSummary, projectName: string) {
@ -410,7 +410,7 @@ function getProjectTitle(scan: ProjectScanSummary, projectName: string) {
function getNodeIcon(scope: ScopeNodeData["scope"]) { function getNodeIcon(scope: ScopeNodeData["scope"]) {
if (scope === "project") return <Globe2 size={17} />; if (scope === "project") return <Globe2 size={17} />;
if (scope === "home_section") return <Layers3 size={17} />; if (scope === "source_section") return <Layers3 size={17} />;
if (scope === "page_group") return <FileText size={17} />; if (scope === "page_group") return <FileText size={17} />;
if (scope === "indexable_page") return <PanelTop size={17} />; if (scope === "indexable_page") return <PanelTop size={17} />;
if (scope === "template_block") return <Layers3 size={17} />; if (scope === "template_block") return <Layers3 size={17} />;
@ -913,7 +913,7 @@ function buildScopeFlow(
const previewMode: ScopeNodeData["previewMode"] = section.enabled ? "frame" : "empty"; const previewMode: ScopeNodeData["previewMode"] = section.enabled ? "frame" : "empty";
nodes.push({ nodes.push({
id: `home-section-${section.sectionId}`, id: `source-section-${section.sectionId}`,
position, position,
style: { style: {
height, height,
@ -934,10 +934,10 @@ function buildScopeFlow(
previewUrl: previewMode === "frame" ? getSectionPreviewUrl(projectId, cacheVersion, section) : null, previewUrl: previewMode === "frame" ? getSectionPreviewUrl(projectId, cacheVersion, section) : null,
selected: section.selected, selected: section.selected,
sectionId: section.sectionId, sectionId: section.sectionId,
scope: "home_section", scope: "source_section",
scopeLabel: section.enabled ? "секция главной" : "выключенная секция", scopeLabel: section.enabled ? "секция сайта" : "выключенная секция",
status: section.enabled ? "coverage" : "excluded", status: section.enabled ? "coverage" : "excluded",
subtitle: section.enabled ? "Секция главной страницы" : "Выключена в home.json", subtitle: section.enabled ? "Секция модели источника" : "Выключена в модели источника",
visibleInSite: section.enabled visibleInSite: section.enabled
} }
}); });
@ -991,7 +991,7 @@ function buildScopeFlow(
siteSections.forEach((section, index) => { siteSections.forEach((section, index) => {
const column = index % MAX_COLUMNS; const column = index % MAX_COLUMNS;
const row = Math.floor(index / MAX_COLUMNS); const row = Math.floor(index / MAX_COLUMNS);
const nodeId = `home-section-${section.sectionId}`; const nodeId = `source-section-${section.sectionId}`;
const previousSection = siteSections[index - 1]; const previousSection = siteSections[index - 1];
const width = section.enabled ? NODE_WIDTH : NODE_WIDTH - 80; const width = section.enabled ? NODE_WIDTH : NODE_WIDTH - 80;
@ -1008,7 +1008,7 @@ function buildScopeFlow(
if (index === 0) { if (index === 0) {
addEdge(homePage ? `${homePage.scope}-${homePage.pageId}` : "project-root", nodeId, "scope-flow-edge muted"); addEdge(homePage ? `${homePage.scope}-${homePage.pageId}` : "project-root", nodeId, "scope-flow-edge muted");
} else if (previousSection) { } else if (previousSection) {
addEdge(`home-section-${previousSection.sectionId}`, nodeId, "scope-flow-edge muted"); addEdge(`source-section-${previousSection.sectionId}`, nodeId, "scope-flow-edge muted");
} }
}); });
@ -1245,7 +1245,7 @@ export default function ProjectScopeFlow({
currentNodes.map((node) => { currentNodes.map((node) => {
const pageState = node.data.pageId ? nodeLiveState.pages.get(node.data.pageId) : undefined; const pageState = node.data.pageId ? nodeLiveState.pages.get(node.data.pageId) : undefined;
const sectionState = node.data.sectionId ? nodeLiveState.sections.get(node.data.sectionId) : undefined; const sectionState = node.data.sectionId ? nodeLiveState.sections.get(node.data.sectionId) : undefined;
const disabled = node.data.scope === "project" || isBusy || (node.data.scope === "home_section" && !node.data.pageId); const disabled = node.data.scope === "project" || isBusy || (node.data.scope === "source_section" && !node.data.pageId);
const selected = sectionState?.selected ?? pageState?.selected ?? node.data.selected; const selected = sectionState?.selected ?? pageState?.selected ?? node.data.selected;
const status = const status =
node.data.scope === "project" node.data.scope === "project"
@ -1307,7 +1307,7 @@ export default function ProjectScopeFlow({
{ {
icon: <Layers3 size={13} />, icon: <Layers3 size={13} />,
key: "sections", key: "sections",
label: "Секции главной", label: "Секции сайта",
value: `${stats.selectedSections}/${scan.siteSections.length}` value: `${stats.selectedSections}/${scan.siteSections.length}`
}, },
{ {
@ -1369,7 +1369,7 @@ export default function ProjectScopeFlow({
const data = node.data as ScopeNodeData; const data = node.data as ScopeNodeData;
if (data.scope === "project") return "#83918b"; if (data.scope === "project") return "#83918b";
if (data.scope === "indexable_page") return "#bfc9c4"; if (data.scope === "indexable_page") return "#bfc9c4";
if (data.scope === "home_section") return "#d3ddd8"; if (data.scope === "source_section") return "#d3ddd8";
if (data.scope === "admin_page") return "#d7dedb"; if (data.scope === "admin_page") return "#d7dedb";
return "#e1e6e3"; return "#e1e6e3";
}} }}

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@ export default defineConfig({
} }
}, },
server: { server: {
port: 5173, port: 5177,
strictPort: false strictPort: true
} }
}); });