Update NODEDC admin content and modules

This commit is contained in:
dcconstructions
2026-06-27 11:01:11 +03:00
parent 69e2b05fc2
commit bc0da49506
24 changed files with 1320 additions and 1049 deletions
+18 -6
View File
@@ -133,10 +133,10 @@ const blocks = [
},
{
region: "cViz",
id: "waitlist-files",
id: "request-demo-txt-files",
type: "staticHtml",
template: "waitlist-files.html",
adminLabel: "Форма ожидания и txt-файлы",
template: "request-demo-txt-files.html",
adminLabel: "Запрос DEMO и TXT-файлы",
anchor: "waitlist",
html: html.slice(waitlistFilesStart, demoVideoFolderStart),
},
@@ -173,6 +173,8 @@ function inferFieldGroup(path) {
if (path.startsWith("content.app.")) return "Карточка раннего доступа";
if (path.startsWith("content.form.")) return "Форма";
if (path === "content.legalHtml") return "Юридический блок";
if (path.startsWith("content.legal.")) return "Юридический блок";
if (path === "content.filesEnabled" || path.startsWith("content.files.")) return "TXT-файлы";
if (path === "content.windowTitle" || path === "content.videoSrc") return "Видео-окно";
if (path.startsWith("content.features.")) return "Пункты";
if (path.startsWith("content.sliderItems.")) return "Слайдер";
@@ -448,12 +450,22 @@ const typedBlockDefinitions = {
main: "режимы ИИ.",
},
introHtml: 'Разные <span class="darker-70">режимы</span> и <span class="darker-70">модели</span> для разных задач.',
bottomInfo: {
heading: {
muted: "Гибкие",
main: "режимы ИИ.",
},
introHtml: 'Разные <span class="darker-70">режимы</span> и <span class="darker-70">модели</span> для разных задач.',
},
sliderItems: demoSliderItems,
},
editableFields: [
field("content.heading.muted", "Заголовок: приглушённая строка"),
field("content.heading.main", "Заголовок: основная строка"),
field("content.introHtml", "Вводный текст", "html"),
field("content.heading.muted", "Приглушённая строка", "text", "text", "Верхний информационный блок"),
field("content.heading.main", "Основная строка", "text", "text", "Верхний информационный блок"),
field("content.introHtml", "Вводный текст", "html", "html", "Верхний информационный блок"),
field("content.bottomInfo.heading.muted", "Приглушённая строка", "text", "text", "Нижний информационный блок"),
field("content.bottomInfo.heading.main", "Основная строка", "text", "text", "Нижний информационный блок"),
field("content.bottomInfo.introHtml", "Вводный текст", "html", "html", "Нижний информационный блок"),
...sliderEditableFields(),
],
},
+27
View File
@@ -43,6 +43,31 @@ function isTruthy(value) {
return Boolean(value);
}
function cloneValue(value) {
return value == null ? value : JSON.parse(JSON.stringify(value));
}
function allBlocks(model) {
return (model.regions ?? []).flatMap((region) => region.blocks ?? []);
}
function applySharedDemoRequest(model) {
const blocks = allBlocks(model);
const source = blocks.find((block) => block.id === "hero-waitlist");
if (!source?.content) return;
for (const block of blocks) {
if (block.id === source.id || block.type !== "waitlistFiles") continue;
block.content ??= {};
block.content.accessCard = cloneValue(source.content.accessCard);
block.content.form = cloneValue(source.content.form);
block.content.legal ??= { enabled: true, html: "" };
block.content.legal.html = source.content.legalHtml ?? block.content.legal.html ?? "";
}
}
function escapeHtml(value) {
return String(value)
.replaceAll("&", "&amp;")
@@ -206,6 +231,8 @@ async function renderSections() {
return output.join("");
}
applySharedDemoRequest(page);
let output = renderTemplate(shell, { id: page.slug, ...page });
if (output.includes(REGION_TOKEN.sections)) {