diff --git a/config/allowed_files.php b/config/allowed_files.php index 4d3aa75..1fb98f9 100644 --- a/config/allowed_files.php +++ b/config/allowed_files.php @@ -335,6 +335,7 @@ 'views/templates/hook/prettyblocks/prettyblock_link_list.tpl', 'views/templates/hook/prettyblocks/prettyblock_login.tpl', 'views/templates/hook/prettyblocks/prettyblock_lookbook.tpl', + 'views/templates/hook/prettyblocks/prettyblock_llm_links.tpl', 'views/templates/hook/prettyblocks/prettyblock_masonry_gallery.tpl', 'views/templates/hook/prettyblocks/prettyblock_modal.tpl', 'views/templates/hook/prettyblocks/prettyblock_mystery_boxes.tpl', diff --git a/src/Service/EverblockPrettyBlocks.php b/src/Service/EverblockPrettyBlocks.php index a4b25ba..7bd9140 100644 --- a/src/Service/EverblockPrettyBlocks.php +++ b/src/Service/EverblockPrettyBlocks.php @@ -199,6 +199,7 @@ public static function getEverPrettyBlocks($context) $ctaTemplate = 'module:' . $module->name . '/views/templates/hook/prettyblocks/prettyblock_cta.tpl'; $googleReviewsTemplate = 'module:' . $module->name . '/views/templates/hook/prettyblocks/prettyblock_google_reviews.tpl'; $sharerTemplate = 'module:' . $module->name . '/views/templates/hook/prettyblocks/prettyblock_sharer.tpl'; + $llmLinksTemplate = 'module:' . $module->name . '/views/templates/hook/prettyblocks/prettyblock_llm_links.tpl'; $linkListTemplate = 'module:' . $module->name . '/views/templates/hook/prettyblocks/prettyblock_link_list.tpl'; $downloadsTemplate = 'module:' . $module->name . '/views/templates/hook/prettyblocks/prettyblock_downloads.tpl'; $socialLinksTemplate = 'module:' . $module->name . '/views/templates/hook/prettyblocks/prettyblock_social_links.tpl'; @@ -2643,6 +2644,69 @@ public static function getEverPrettyBlocks($context) ], $module), ], ]; + $blocks[] = [ + 'name' => $module->l('LLM links'), + 'description' => $module->l('Display a banner of links to AI assistants'), + 'code' => 'everblock_llm_links', + 'tab' => 'general', + 'icon_path' => $defaultLogo, + 'need_reload' => true, + 'templates' => [ + 'default' => $llmLinksTemplate, + ], + 'config' => [ + 'fields' => static::appendSpacingFields([ + 'heading_text' => [ + 'type' => 'text', + 'label' => $module->l('Heading text'), + 'default' => $module->l('Résumer cet article avec :'), + ], + 'link_hover_effect' => [ + 'type' => 'checkbox', + 'label' => $module->l('Enable hover effect on links'), + 'default' => '1', + ], + ], $module), + ], + 'repeater' => [ + 'name' => 'LLM link', + 'nameFrom' => 'label', + 'groups' => static::appendSpacingFields([ + 'label' => [ + 'type' => 'text', + 'label' => $module->l('Label'), + 'default' => $module->l('ChatGPT'), + ], + 'base_url' => [ + 'type' => 'text', + 'label' => $module->l('Base URL (ends with the prompt parameter, e.g. https://chat.openai.com/?prompt=)'), + 'default' => 'https://chat.openai.com/?prompt=', + ], + 'prompt_template' => [ + 'type' => 'textarea', + 'label' => $module->l('Prompt template (use {{title}} and {{url}} placeholders)'), + 'default' => $module->l('Résume cet article de manière concise, en listant les points clés à retenir. Titre : {{title}} — URL : {{url}}'), + ], + 'icon' => [ + 'type' => 'fileupload', + 'label' => $module->l('Icon image'), + 'default' => [ + 'url' => '', + ], + ], + 'icon_alt' => [ + 'type' => 'text', + 'label' => $module->l('Icon alt text'), + 'default' => $module->l('Open in assistant'), + ], + 'open_in_new_tab' => [ + 'type' => 'checkbox', + 'label' => $module->l('Open in a new tab'), + 'default' => '1', + ], + ], $module), + ], + ]; $blocks[] = [ 'name' => $module->l('Social links'), 'description' => $module->l('Display custom links to social networks'), diff --git a/views/css/everblock.css b/views/css/everblock.css index 5921f4e..d4b81ca 100644 --- a/views/css/everblock.css +++ b/views/css/everblock.css @@ -67,6 +67,52 @@ transform: scale(1.04); } +/* Prettyblock LLM links */ +.prettyblock-llm-links__inner { + display: flex; + flex-direction: column; + gap: 1rem; +} + +.prettyblock-llm-links__heading strong { + font-weight: 600; + font-size: 1rem; +} + +.prettyblock-llm-links__list { + margin-right: -0.75rem; + margin-left: -0.75rem; +} + +.prettyblock-llm-links__list > [class*="col-"] { + padding: 0.75rem; +} + +.prettyblock-llm-links__item { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 0.5rem; + padding: 1rem; + height: 100%; + border: 1px solid rgba(0, 0, 0, 0.08); + border-radius: 0.75rem; + background-color: #fff; + text-decoration: none; + color: inherit; +} + +.prettyblock-llm-links__icon { + max-width: 92px; + max-height: 92px; + object-fit: contain; +} + +.prettyblock-llm-links__label { + font-weight: 600; +} + /* Lookbook product markers */ .lookbook-marker { diff --git a/views/js/everblock.js b/views/js/everblock.js index 592a988..48939aa 100644 --- a/views/js/everblock.js +++ b/views/js/everblock.js @@ -3529,6 +3529,7 @@ $(document).ready(function(){ initPrettyblockCategoryTabs(); initPrettyblockToc(); + initPrettyblockLlmLinks(); function initPrettyblockCategoryTabs() { var $blocks = $('.prettyblock-category-tabs'); @@ -3685,6 +3686,29 @@ $(document).ready(function(){ }); } + function initPrettyblockLlmLinks() { + $('.prettyblock-llm-links').each(function () { + var $block = $(this); + var pageTitle = $block.data('page-title') || document.title || ''; + var pageUrl = $block.data('page-url') || window.location.href || ''; + + $block.find('.prettyblock-llm-links__item').each(function () { + var $link = $(this); + var baseUrl = $link.data('base-url') || ''; + var promptTemplate = $link.data('prompt-template') || ''; + + if (!baseUrl || !promptTemplate) { + return; + } + + var promptText = promptTemplate + .replace(/{{\s*title\s*}}/g, pageTitle) + .replace(/{{\s*url\s*}}/g, pageUrl); + $link.attr('href', baseUrl + encodeURIComponent(promptText)); + }); + }); + } + var $everblockImageModal = $('#everblockImageModal'); if ($everblockImageModal.length) { $(document).on('click', '.everblock-page__content img', function (event) { diff --git a/views/templates/hook/prettyblocks/prettyblock_llm_links.tpl b/views/templates/hook/prettyblocks/prettyblock_llm_links.tpl new file mode 100644 index 0000000..c7eb656 --- /dev/null +++ b/views/templates/hook/prettyblocks/prettyblock_llm_links.tpl @@ -0,0 +1,75 @@ +{* + * 2019-2025 Team Ever + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * @author Team Ever + * @copyright 2019-2025 Team Ever + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +*} +{include file='module:everblock/views/templates/hook/prettyblocks/_partials/visibility_class.tpl'} +{include file='module:everblock/views/templates/hook/prettyblocks/_partials/spacing_style.tpl' spacing=$block.settings assign='prettyblock_spacing_style'} + +{assign var='page_url' value=$urls.current_url|default:''} +{assign var='page_title' value=$page.meta.title|default:$page.meta.page_title|default:$page.page_title|default:$page_title|default:''} + +
+ {if $block.settings.default.force_full_width} +
+ {elseif $block.settings.default.container} +
+ {/if} + + + + {if $block.settings.default.force_full_width || $block.settings.default.container} +
+ {/if} +