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

View file

@ -5,7 +5,7 @@ export default apiInitializer("1.8.0", (api) => {
const welcomeCard = document.querySelector(".welcome-card"); const welcomeCard = document.querySelector(".welcome-card");
if (!welcomeCard) return; 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") { if (showOnPages === "all_pages") {
// Show on all pages // Show on all pages
@ -24,9 +24,8 @@ export default apiInitializer("1.8.0", (api) => {
// Render search input with SearchMenu integration // Render search input with SearchMenu integration
function renderSearchInput() { function renderSearchInput() {
// Check if search is enabled in settings // Check if search is enabled in settings (default to true if not set)
const searchEnabled = settings.theme_vars?.enable_hero_search; const searchEnabled = settings?.theme_vars?.enable_hero_search !== false;
if (!searchEnabled) return;
if (isMobileView()) return; if (isMobileView()) return;
@ -46,7 +45,7 @@ export default apiInitializer("1.8.0", (api) => {
const input = document.createElement("input"); const input = document.createElement("input");
input.type = "text"; input.type = "text";
input.className = "search-input"; 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"); input.setAttribute("aria-label", "Search");
// Open and sync SearchMenu // 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"> <section class="above-main-container-outlet welcome-card">
<div class="hero-section"> <div class="hero-section">
<div class="hero-deco"></div> <div class="hero-deco"></div>
@ -123,4 +124,5 @@
</ul> </ul>
</div> </div>
</section> </section>
{{/unless}}
{{/if}} {{/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"> <section class="below-site-header welcome-card">
<div class="hero-section"> <div class="hero-section">
<div class="hero-deco"></div> <div class="hero-deco"></div>
@ -124,3 +125,4 @@
</div> </div>
</section> </section>
{{/if}} {{/if}}
{{/if}}