Fix preview issues: add fallback colors, improve settings handling, simplify Handlebars conditions

This commit is contained in:
gabeszm 2025-10-15 21:59:41 +02:00
parent 49a711320c
commit 9fc91f14e4
4 changed files with 19 additions and 12 deletions

View file

@ -1,13 +1,17 @@
/* Theme colors - configurable from admin settings */
:root {
--primary-color: #{$primary_color};
--page-bg: #{$page_background};
--card-bg: #{$card_background};
--text-color: #{$text_color};
--primary-color: var(--nyv-primary-color, #e81f2d);
--page-bg: var(--nyv-page-bg, #14191f);
--card-bg: var(--nyv-card-bg, #1b2028);
--text-color: var(--nyv-text-color, #ddd);
}
/* Welcome kártya konténer */
.welcome-card {
--nyv-primary-color: #{$primary_color};
--nyv-page-bg: #{$page_background};
--nyv-card-bg: #{$card_background};
--nyv-text-color: #{$text_color};
border-radius: 4px;
}

View file

@ -5,7 +5,7 @@ export default apiInitializer("1.8.0", (api) => {
const welcomeCard = document.querySelector(".welcome-card");
if (!welcomeCard) return;
const showOnPages = settings.theme_vars?.show_on_pages || "homepage_only";
const showOnPages = settings?.theme_vars?.show_on_pages || "homepage_only";
if (showOnPages === "all_pages") {
// Show on all pages
@ -24,9 +24,8 @@ export default apiInitializer("1.8.0", (api) => {
// Render search input with SearchMenu integration
function renderSearchInput() {
// Check if search is enabled in settings
const searchEnabled = settings.theme_vars?.enable_hero_search;
if (!searchEnabled) return;
// Check if search is enabled in settings (default to true if not set)
const searchEnabled = settings?.theme_vars?.enable_hero_search !== false;
if (isMobileView()) return;
@ -46,7 +45,7 @@ export default apiInitializer("1.8.0", (api) => {
const input = document.createElement("input");
input.type = "text";
input.className = "search-input";
input.placeholder = settings.theme_vars?.search_placeholder || "Search...";
input.placeholder = settings?.theme_vars?.search_placeholder || "Keresés a fórumon…";
input.setAttribute("aria-label", "Search");
// Open and sync SearchMenu

View file

@ -1,4 +1,5 @@
{{#if (and theme.enable_welcome_banner (eq theme.banner_position "above_content"))}}
{{#if theme.enable_welcome_banner}}
{{#unless (eq theme.banner_position "below_header")}}
<section class="above-main-container-outlet welcome-card">
<div class="hero-section">
<div class="hero-deco"></div>
@ -123,4 +124,5 @@
</ul>
</div>
</section>
{{/unless}}
{{/if}}

View file

@ -1,4 +1,5 @@
{{#if (and theme.enable_welcome_banner (eq theme.banner_position "below_header"))}}
{{#if theme.enable_welcome_banner}}
{{#if (eq theme.banner_position "below_header")}}
<section class="below-site-header welcome-card">
<div class="hero-section">
<div class="hero-deco"></div>
@ -124,3 +125,4 @@
</div>
</section>
{{/if}}
{{/if}}