Commit 637bbc92 authored by jan.koester's avatar jan.koester
Browse files

test

parent 0cf91d01
Loading
Loading
Loading
Loading
+114 −21
Changes for client/qml/PropertyPanel.qml: 114 added lines, 21 removed lines.
Original line number Diff line number Diff line
@@ -73,36 +73,128 @@ ColumnLayout {
        Layout.fillWidth: true
    }

    /* Desktop properties */
    /* Device + Theme mode tabs */
    property int activeDevice: 0  // 0 = desktop, 1 = mobile
    property int activeTheme: 0   // 0 = dark, 1 = light
    property bool hasOverrides: currentSchema.some(function(s) {
        var t = s.target || "all";
        return t !== "all";
    })

    /* Device tabs: Desktop / Mobile */
    RowLayout {
        visible: hasOverrides
        Layout.fillWidth: true
        spacing: 0

        Repeater {
        model: currentSchema.filter(function(s) { return !s.key.startsWith("m_") && !s.key.startsWith("l_") })
            model: [
                { label: "\u{1F5A5} Desktop", idx: 0, col: "#89b4fa" },
                { label: "\u{1F4F1} Mobile",  idx: 1, col: "#a6e3a1" }
            ]

        Loader {
            Button {
                required property var modelData
                Layout.fillWidth: true
            sourceComponent: fieldComponent
            property var fieldDef: modelData
                implicitHeight: 26
                text: modelData.label
                font.pixelSize: 11
                font.bold: propPanel.activeDevice === modelData.idx

                background: Rectangle {
                    color: propPanel.activeDevice === modelData.idx
                           ? Qt.rgba(Qt.color(modelData.col).r, Qt.color(modelData.col).g, Qt.color(modelData.col).b, 0.18)
                           : "transparent"
                    border.width: 0
                    Rectangle {
                        anchors.bottom: parent.bottom
                        width: parent.width
                        height: 2
                        color: propPanel.activeDevice === modelData.idx ? modelData.col : Theme.border
                    }
                }

    /* Mobile / Light overrides */
    Label {
        visible: currentSchema.some(function(s) { return s.key.startsWith("m_") || s.key.startsWith("l_") })
        text: qsTr("Mobile / Light Mode Overrides")
        font.pixelSize: 11; font.weight: Font.Bold; font.capitalization: Font.AllUppercase
        color: Theme.warning
        Layout.fillWidth: true
        Layout.topMargin: 8
                contentItem: Text {
                    text: parent.text
                    font: parent.font
                    color: propPanel.activeDevice === modelData.idx ? modelData.col : Theme.textMuted
                    horizontalAlignment: Text.AlignHCenter
                    verticalAlignment: Text.AlignVCenter
                }

    Rectangle {
        visible: currentSchema.some(function(s) { return s.key.startsWith("m_") || s.key.startsWith("l_") })
                onClicked: propPanel.activeDevice = modelData.idx
            }
        }
    }

    /* Theme tabs: Dark / Light */
    RowLayout {
        visible: hasOverrides && currentSchema.some(function(s) {
            var t = s.target || "all";
            return t === "light" || t === "desktop_light" || t === "mobile_light";
        })
        Layout.fillWidth: true
        spacing: 0

        Repeater {
            model: [
                { label: "\u263E Dark",  idx: 0, col: "#cdd6f4" },
                { label: "\u2600 Light", idx: 1, col: "#f9e2af" }
            ]

            Button {
                required property var modelData
                Layout.fillWidth: true
        height: 1
        color: Theme.border
                implicitHeight: 24
                text: modelData.label
                font.pixelSize: 10
                font.bold: propPanel.activeTheme === modelData.idx

                background: Rectangle {
                    color: propPanel.activeTheme === modelData.idx
                           ? Qt.rgba(Qt.color(modelData.col).r, Qt.color(modelData.col).g, Qt.color(modelData.col).b, 0.15)
                           : "transparent"
                    border.width: 0
                    Rectangle {
                        anchors.bottom: parent.bottom
                        width: parent.width
                        height: 2
                        color: propPanel.activeTheme === modelData.idx ? modelData.col : "transparent"
                    }
                }

                contentItem: Text {
                    text: parent.text
                    font: parent.font
                    color: propPanel.activeTheme === modelData.idx ? modelData.col : Theme.textMuted
                    horizontalAlignment: Text.AlignHCenter
                    verticalAlignment: Text.AlignVCenter
                }

                onClicked: propPanel.activeTheme = modelData.idx
            }
        }
    }

    /* Filtered properties based on activeDevice + activeTheme */
    Repeater {
        model: currentSchema.filter(function(s) { return s.key.startsWith("m_") || s.key.startsWith("l_") })
        model: currentSchema.filter(function(s) {
            var t = s.target || "all";
            var dev = propPanel.activeDevice; // 0=desktop, 1=mobile
            var thm = propPanel.activeTheme;  // 0=dark, 1=light

            if (t === "all") return true;

            if (dev === 0 && thm === 0) // Desktop Dark
                return t === "desktop";
            if (dev === 0 && thm === 1) // Desktop Light
                return t === "desktop" || t === "light" || t === "desktop_light";
            if (dev === 1 && thm === 0) // Mobile Dark
                return t === "mobile";
            if (dev === 1 && thm === 1) // Mobile Light
                return t === "mobile" || t === "light" || t === "mobile_light";
            return false;
        })

        Loader {
            Layout.fillWidth: true
@@ -464,16 +556,17 @@ ColumnLayout {
                    sectionListModel.clear()
                    sectionListModel.append({ text: qsTr("(none)"), value: "" })
                    try {
                        var tree = JSON.parse(localApi.getDocTree())
                        var resp = JSON.parse(localApi.getDocTree())
                        var tree = resp.doc_tree
                        function collectSections(nodes) {
                            for (var i = 0; i < nodes.length; i++) {
                                var n = nodes[i]
                                var label = (n.type || "?") + " — " + (n.uuid || "").substring(0, 8)
                                var label = (n.name || "?") + " — " + (n.uuid || "").substring(0, 8)
                                sectionListModel.append({ text: label, value: n.uuid || "" })
                                if (n.children) collectSections(n.children)
                            }
                        }
                        if (tree.children) collectSections(tree.children)
                        if (tree && tree.children) collectSections(tree.children)
                    } catch(e) {}

                    // Select current value
+11 −11
Changes for client/widgets/accordion/accordion.cpp: 11 added lines, 11 removed lines.
Original line number Diff line number Diff line
@@ -165,7 +165,7 @@ extern "C" {
            static json_object* getSchemaJson() {
                json_object *arr = json_object_new_array();
                auto addField = [&](const char *key, const char *label, const char *type,
                                    const char *placeholder = nullptr, bool responsive = false,
                                    const char *placeholder = nullptr, const char *target = "all",
                                    json_object *options = nullptr,
                                    json_object *visibleWhen = nullptr) {
                    json_object *f = json_object_new_object();
@@ -173,7 +173,7 @@ extern "C" {
                    json_object_object_add(f, "label", json_object_new_string(label));
                    json_object_object_add(f, "type", json_object_new_string(type));
                    if (placeholder) json_object_object_add(f, "placeholder", json_object_new_string(placeholder));
                    if (responsive) json_object_object_add(f, "responsive", json_object_new_boolean(true));
                    json_object_object_add(f, "target", json_object_new_string(target));
                    if (options) json_object_object_add(f, "options", options);
                    if (visibleWhen) json_object_object_add(f, "visibleWhen", visibleWhen);
                    json_object_array_add(arr, f);
@@ -187,29 +187,29 @@ extern "C" {
                // Header settings
                addField("header_label", "Header Label", "text", "Toggle Section");
                addField("header_bg_color", "Header Background (Dark)", "color_var");
                addField("l_header_bg_color", "Header Background (Light)", "color_var");
                addField("l_header_bg_color", "Header Background (Light)", "color_var", nullptr, "light");
                addField("header_text_color", "Header Text Color (Dark)", "color_var");
                addField("l_header_text_color", "Header Text Color (Light)", "color_var");
                addField("header_font_size", "Header Font Size", "text", "16px", true);
                addField("l_header_text_color", "Header Text Color (Light)", "color_var", nullptr, "light");
                addField("header_font_size", "Header Font Size", "text", "16px", "desktop");
                addField("header_font_weight", "Header Font Weight", "text", "bold");
                addField("header_padding", "Header Padding", "text", "12px 16px", true);
                addField("header_padding", "Header Padding", "text", "12px 16px", "desktop");
                addField("header_border_radius", "Header Border Radius", "text", "4px");

                // Content settings
                addField("content_bg_color", "Content Background (Dark)", "color_var");
                addField("l_content_bg_color", "Content Background (Light)", "color_var");
                addField("l_content_bg_color", "Content Background (Light)", "color_var", nullptr, "light");
                addField("content_text_color", "Content Text Color (Dark)", "color_var");
                addField("l_content_text_color", "Content Text Color (Light)", "color_var");
                addField("content_padding", "Content Padding", "text", "16px", true);
                addField("l_content_text_color", "Content Text Color (Light)", "color_var", nullptr, "light");
                addField("content_padding", "Content Padding", "text", "16px", "desktop");
                addField("border_color", "Border Color (Dark)", "color_var");
                addField("border_radius", "Border Radius", "text", "4px");

                // Behaviour
                addField("open_by_default", "Open by Default", "checkbox");
                addField("icon_position", "Toggle Icon Position", "select", nullptr, false, mkOpts({"right", "left", "none"}));
                addField("icon_position", "Toggle Icon Position", "select", nullptr, "all", mkOpts({"right", "left", "none"}));

                // Visibility
                addField("hidden", "Hidden", "checkbox", nullptr, true);
                addField("hidden", "Hidden", "checkbox", nullptr, "desktop");
                addField("custom_css", "Custom CSS", "textarea", ".we-xxx { ... }");

                return arr;
+15 −15
Changes for client/widgets/article/article.cpp: 15 added lines, 15 removed lines.
Original line number Diff line number Diff line
@@ -152,14 +152,14 @@ extern "C" {
            static json_object* getSchemaJson() {
                json_object *arr = json_object_new_array();
                auto addField = [&](const char *key, const char *label, const char *type,
                                    const char *placeholder = nullptr, bool responsive = false,
                                    const char *placeholder = nullptr, const char *target = "all",
                                    json_object *options = nullptr) {
                    json_object *f = json_object_new_object();
                    json_object_object_add(f, "key", json_object_new_string(key));
                    json_object_object_add(f, "label", json_object_new_string(label));
                    json_object_object_add(f, "type", json_object_new_string(type));
                    if (placeholder) json_object_object_add(f, "placeholder", json_object_new_string(placeholder));
                    if (responsive) json_object_object_add(f, "responsive", json_object_new_boolean(true));
                    json_object_object_add(f, "target", json_object_new_string(target));
                    if (options) json_object_object_add(f, "options", options);
                    json_object_array_add(arr, f);
                };
@@ -168,20 +168,20 @@ extern "C" {
                    for (auto v : vals) json_object_array_add(a, json_object_new_string(v));
                    return a;
                };
                addField("background_color", "Background Color (Dark)", "color_var", nullptr, true);
                addField("l_background_color", "Background Color (Light)", "color_var");
                addField("background_color", "Background Color (Dark)", "color_var", nullptr, "desktop");
                addField("l_background_color", "Background Color (Light)", "color_var", nullptr, "light");
                addField("css_class", "CSS Class", "text", "e.g. card");
                addField("padding", "Padding", "text", "e.g. 28px", true);
                addField("margin", "Margin", "text", "e.g. 0 auto", true);
                addField("max_width", "Max Width", "text", "e.g. 800px", true);
                addField("min_height", "Min Height", "text", "e.g. 200px", true);
                addField("width", "Width", "text", "e.g. 100%", true);
                addField("height", "Height", "text", "e.g. auto", true);
                addField("border_radius", "Border Radius", "text", "e.g. 24px", true);
                addField("border_style", "Border", "text", "e.g. 1px solid #ccc", true);
                addField("opacity", "Opacity", "text", "0.0 - 1.0", true);
                addField("vertical_align", "Vertical Align", "select", nullptr, true, mkOpts({"top","center","bottom"}));
                addField("hidden", "Hidden", "checkbox", nullptr, true);
                addField("padding", "Padding", "text", "e.g. 28px", "desktop");
                addField("margin", "Margin", "text", "e.g. 0 auto", "desktop");
                addField("max_width", "Max Width", "text", "e.g. 800px", "desktop");
                addField("min_height", "Min Height", "text", "e.g. 200px", "desktop");
                addField("width", "Width", "text", "e.g. 100%", "desktop");
                addField("height", "Height", "text", "e.g. auto", "desktop");
                addField("border_radius", "Border Radius", "text", "e.g. 24px", "desktop");
                addField("border_style", "Border", "text", "e.g. 1px solid #ccc", "desktop");
                addField("opacity", "Opacity", "text", "0.0 - 1.0", "desktop");
                addField("vertical_align", "Vertical Align", "select", nullptr, "desktop", mkOpts({"top","center","bottom"}));
                addField("hidden", "Hidden", "checkbox", nullptr, "desktop");
                addField("custom_css", "Custom CSS", "textarea", ".we-xxx { color: red; }");
                return arr;
            }
+19 −19
Changes for client/widgets/button/button.cpp: 19 added lines, 19 removed lines.
Original line number Diff line number Diff line
@@ -316,7 +316,7 @@ extern "C" {
            static json_object* getSchemaJson() {
                json_object *arr = json_object_new_array();
                auto addField = [&](const char *key, const char *label, const char *type,
                                    const char *placeholder = nullptr, bool responsive = false,
                                    const char *placeholder = nullptr, const char *target = "all",
                                    json_object *options = nullptr,
                                    json_object *visibleWhen = nullptr) {
                    json_object *f = json_object_new_object();
@@ -324,7 +324,7 @@ extern "C" {
                    json_object_object_add(f, "label", json_object_new_string(label));
                    json_object_object_add(f, "type", json_object_new_string(type));
                    if (placeholder) json_object_object_add(f, "placeholder", json_object_new_string(placeholder));
                    if (responsive) json_object_object_add(f, "responsive", json_object_new_boolean(true));
                    json_object_object_add(f, "target", json_object_new_string(target));
                    if (options) json_object_object_add(f, "options", options);
                    if (visibleWhen) json_object_object_add(f, "visibleWhen", visibleWhen);
                    json_object_array_add(arr, f);
@@ -341,27 +341,27 @@ extern "C" {
                    return o;
                };
                addField("label", "Button Label", "text");
                addField("link_type", "Link Type", "select", nullptr, false, mkOpts({"url","section"}));
                addField("link_url", "Link URL", "text", "https://...", false, nullptr, mkVisible("link_type","url"));
                addField("open_new_tab", "Open in New Tab", "checkbox", nullptr, false, nullptr, mkVisible("link_type","url"));
                addField("section_id", "Target Section", "section_select", nullptr, false, nullptr, mkVisible("link_type","section"));
                addField("link_type", "Link Type", "select", nullptr, "all", mkOpts({"url","section"}));
                addField("link_url", "Link URL", "text", "https://...", "all", nullptr, mkVisible("link_type","url"));
                addField("open_new_tab", "Open in New Tab", "checkbox", nullptr, "all", nullptr, mkVisible("link_type","url"));
                addField("section_id", "Target Section", "section_select", nullptr, "all", nullptr, mkVisible("link_type","section"));
                addField("background_color", "Background Color (Dark)", "color_var");
                addField("l_background_color", "Background Color (Light)", "color_var");
                addField("l_background_color", "Background Color (Light)", "color_var", nullptr, "light");
                addField("text_color", "Text Color (Dark)", "color_var");
                addField("l_text_color", "Text Color (Light)", "color_var");
                addField("font_size", "Font Size", "text", "16px", true);
                addField("border_radius", "Border Radius", "text", "4px", true);
                addField("padding", "Padding", "text", "10px 20px", true);
                addField("width", "Width", "text", "e.g. 200px", true);
                addField("height", "Height", "text", "e.g. auto", true);
                addField("hidden", "Hidden", "checkbox", nullptr, true);
                addField("l_text_color", "Text Color (Light)", "color_var", nullptr, "light");
                addField("font_size", "Font Size", "text", "16px", "desktop");
                addField("border_radius", "Border Radius", "text", "4px", "desktop");
                addField("padding", "Padding", "text", "10px 20px", "desktop");
                addField("width", "Width", "text", "e.g. 200px", "desktop");
                addField("height", "Height", "text", "e.g. auto", "desktop");
                addField("hidden", "Hidden", "checkbox", nullptr, "desktop");
                addField("custom_css", "Custom CSS", "textarea", ".we-xxx { color: red; }");
                addField("g_event_enabled", "Enable Google Event", "checkbox");
                addField("g_event_name", "Event Name", "text", "button_click", false, nullptr, mkVisible("g_event_enabled", "true"));
                addField("g_event_category", "Event Category", "text", "engagement", false, nullptr, mkVisible("g_event_enabled", "true"));
                addField("g_event_label", "Event Label", "text", "cta_button", false, nullptr, mkVisible("g_event_enabled", "true"));
                addField("g_event_value", "Event Value", "text", "1", false, nullptr, mkVisible("g_event_enabled", "true"));
                addField("g_consent_update", "Send Consent Update on Click", "checkbox", nullptr, false, nullptr, mkVisible("g_event_enabled", "true"));
                addField("g_event_name", "Event Name", "text", "button_click", "all", nullptr, mkVisible("g_event_enabled", "true"));
                addField("g_event_category", "Event Category", "text", "engagement", "all", nullptr, mkVisible("g_event_enabled", "true"));
                addField("g_event_label", "Event Label", "text", "cta_button", "all", nullptr, mkVisible("g_event_enabled", "true"));
                addField("g_event_value", "Event Value", "text", "1", "all", nullptr, mkVisible("g_event_enabled", "true"));
                addField("g_consent_update", "Send Consent Update on Click", "checkbox", nullptr, "all", nullptr, mkVisible("g_event_enabled", "true"));
                return arr;
            }

+11 −11
Changes for client/widgets/container.cpp: 11 added lines, 11 removed lines.
Original line number Diff line number Diff line
@@ -205,14 +205,14 @@ extern "C" {
            static json_object* getSchemaJson() {
                json_object *arr = json_object_new_array();
                auto addField = [&](const char *key, const char *label, const char *type,
                                    const char *placeholder = nullptr, bool responsive = false,
                                    const char *placeholder = nullptr, const char *target = "all",
                                    json_object *options = nullptr) {
                    json_object *f = json_object_new_object();
                    json_object_object_add(f, "key", json_object_new_string(key));
                    json_object_object_add(f, "label", json_object_new_string(label));
                    json_object_object_add(f, "type", json_object_new_string(type));
                    if (placeholder) json_object_object_add(f, "placeholder", json_object_new_string(placeholder));
                    if (responsive) json_object_object_add(f, "responsive", json_object_new_boolean(true));
                    json_object_object_add(f, "target", json_object_new_string(target));
                    if (options) json_object_object_add(f, "options", options);
                    json_object_array_add(arr, f);
                };
@@ -221,16 +221,16 @@ extern "C" {
                    for (auto v : vals) json_object_array_add(a, json_object_new_string(v));
                    return a;
                };
                addField("background_color", "Background Color (Dark)", "color_var", nullptr, true);
                addField("l_background_color", "Background Color (Light)", "color_var");
                addField("width", "Width", "text", "e.g. 100%", true);
                addField("height", "Height", "text", "e.g. auto", true);
                addField("background_color", "Background Color (Dark)", "color_var", nullptr, "desktop");
                addField("l_background_color", "Background Color (Light)", "color_var", nullptr, "light");
                addField("width", "Width", "text", "e.g. 100%", "desktop");
                addField("height", "Height", "text", "e.g. auto", "desktop");
                addField("css_class", "CSS Class", "text", "e.g. my-container");
                addField("border_radius", "Border Radius", "text", "e.g. 8px", true);
                addField("border_style", "Border", "text", "e.g. 1px solid #ccc", true);
                addField("opacity", "Opacity", "text", "0.0 - 1.0", true);
                addField("vertical_align", "Vertical Align", "select", nullptr, true, mkOpts({"top","center","bottom"}));
                addField("hidden", "Hidden", "checkbox", nullptr, true);
                addField("border_radius", "Border Radius", "text", "e.g. 8px", "desktop");
                addField("border_style", "Border", "text", "e.g. 1px solid #ccc", "desktop");
                addField("opacity", "Opacity", "text", "0.0 - 1.0", "desktop");
                addField("vertical_align", "Vertical Align", "select", nullptr, "desktop", mkOpts({"top","center","bottom"}));
                addField("hidden", "Hidden", "checkbox", nullptr, "desktop");
                return arr;
            }

Loading