From 82abdf047a02ec6111ab0466bd9eb1e1b28735f4 Mon Sep 17 00:00:00 2001 From: FrankZamora Date: Thu, 27 Nov 2025 18:47:13 -0600 Subject: [PATCH] ui(theme-settings): split into two cards (CSS left, JS right) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - CSS Personalizado card on left column (10 rows textarea) - JavaScript Personalizado card on right column (Header + Footer) - Improved visual organization with separate alerts per card 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../Ui/ThemeSettingsFormBuilder.php | 80 ++++++++++++++----- 1 file changed, 61 insertions(+), 19 deletions(-) diff --git a/Admin/ThemeSettings/Infrastructure/Ui/ThemeSettingsFormBuilder.php b/Admin/ThemeSettings/Infrastructure/Ui/ThemeSettingsFormBuilder.php index f468ff91..77472a73 100644 --- a/Admin/ThemeSettings/Infrastructure/Ui/ThemeSettingsFormBuilder.php +++ b/Admin/ThemeSettings/Infrastructure/Ui/ThemeSettingsFormBuilder.php @@ -29,9 +29,14 @@ final class ThemeSettingsFormBuilder $html .= '
'; - // Columna unica - Custom Code - $html .= '
'; - $html .= $this->buildCustomCodeGroup($componentId); + // Columna izquierda - CSS + $html .= '
'; + $html .= $this->buildCssGroup($componentId); + $html .= '
'; + + // Columna derecha - JavaScript + $html .= '
'; + $html .= $this->buildJsGroup($componentId); $html .= '
'; $html .= '
'; @@ -63,27 +68,27 @@ final class ThemeSettingsFormBuilder return $html; } - private function buildCustomCodeGroup(string $componentId): string + private function buildCssGroup(string $componentId): string { $html = '
'; $html .= '
'; $html .= '
'; - $html .= ' '; - $html .= ' Codigo Personalizado'; + $html .= ' '; + $html .= ' CSS Personalizado'; $html .= '
'; $customCss = $this->renderer->getFieldValue($componentId, 'custom_code', 'custom_css', ''); - $html .= $this->buildTextareaCode('themeSettingsCustomCss', 'CSS Personalizado', 'bi-filetype-css', $customCss, 'Se inyecta en wp_head. No incluir etiquetas <style>'); + $html .= $this->buildTextareaCode( + 'themeSettingsCustomCss', + 'Estilos CSS', + $customCss, + 'Se inyecta en wp_head. No incluir etiquetas <style>', + 10 + ); - $customJsHeader = $this->renderer->getFieldValue($componentId, 'custom_code', 'custom_js_header', ''); - $html .= $this->buildTextareaCode('themeSettingsCustomJsHeader', 'JavaScript en Header', 'bi-filetype-js', $customJsHeader, 'Se inyecta en wp_head. No incluir etiquetas <script>'); - - $customJsFooter = $this->renderer->getFieldValue($componentId, 'custom_code', 'custom_js_footer', ''); - $html .= $this->buildTextareaCode('themeSettingsCustomJsFooter', 'JavaScript en Footer', 'bi-filetype-js', $customJsFooter, 'Se inyecta en wp_footer. No incluir etiquetas <script>'); - - $html .= '
'; - $html .= ' '; - $html .= ' Advertencia: El codigo personalizado puede afectar el rendimiento y seguridad del sitio.'; + $html .= '
'; + $html .= ' '; + $html .= ' El CSS se carga despues de los estilos del tema.'; $html .= '
'; $html .= '
'; @@ -92,16 +97,53 @@ final class ThemeSettingsFormBuilder return $html; } - private function buildTextareaCode(string $id, string $label, string $icon, mixed $value, string $helpText = ''): string + private function buildJsGroup(string $componentId): string + { + $html = '
'; + $html .= '
'; + $html .= '
'; + $html .= ' '; + $html .= ' JavaScript Personalizado'; + $html .= '
'; + + $customJsHeader = $this->renderer->getFieldValue($componentId, 'custom_code', 'custom_js_header', ''); + $html .= $this->buildTextareaCode( + 'themeSettingsCustomJsHeader', + 'JavaScript en Header', + $customJsHeader, + 'Se inyecta en wp_head. No incluir etiquetas <script>', + 5 + ); + + $customJsFooter = $this->renderer->getFieldValue($componentId, 'custom_code', 'custom_js_footer', ''); + $html .= $this->buildTextareaCode( + 'themeSettingsCustomJsFooter', + 'JavaScript en Footer', + $customJsFooter, + 'Se inyecta en wp_footer. No incluir etiquetas <script>', + 5 + ); + + $html .= '
'; + $html .= ' '; + $html .= ' Advertencia: El codigo JS puede afectar el rendimiento y seguridad del sitio.'; + $html .= '
'; + + $html .= '
'; + $html .= '
'; + + return $html; + } + + private function buildTextareaCode(string $id, string $label, mixed $value, string $helpText = '', int $rows = 4): string { $value = $this->normalizeStringValue($value); $html = '
'; $html .= ' '; - $html .= ' '; + $html .= ' '; if (!empty($helpText)) { $html .= '
' . $helpText . '
'; }