From 24eec9a86725babb2ff3178124cb2593e561ce29 Mon Sep 17 00:00:00 2001 From: Tomas Dvorak Date: Thu, 29 May 2025 11:30:13 +0200 Subject: [PATCH] rrr --- admin-dashboard.html | 115 +++++++++++++++++++++++++------------------ 1 file changed, 66 insertions(+), 49 deletions(-) diff --git a/admin-dashboard.html b/admin-dashboard.html index b289846..90b51f7 100644 --- a/admin-dashboard.html +++ b/admin-dashboard.html @@ -1133,10 +1133,14 @@ document.addEventListener('DOMContentLoaded', () => { const bannerImagePreview = document.getElementById('bannerImagePreview'); const uploadPrompt = document.getElementById('uploadPrompt'); const imagePreview = document.getElementById('imagePreview'); + const imagePreviewContainer = document.getElementById('imagePreviewContainer'); if (bannerImagePreview) { bannerImagePreview.src = currentImage; bannerImagePreview.style.display = 'block'; + bannerImagePreview.style.maxWidth = '100%'; + bannerImagePreview.style.maxHeight = '200px'; + bannerImagePreview.style.objectFit = 'contain'; } if (uploadPrompt) { @@ -1147,6 +1151,11 @@ document.addEventListener('DOMContentLoaded', () => { imagePreview.style.display = 'block'; } + if (imagePreviewContainer) { + imagePreviewContainer.style.display = 'block'; + } + + // Initialize or update the banner preview updateBannerPreview(); } catch (error) { console.error('Error handling image preview:', error); @@ -1899,47 +1908,49 @@ function updateBannerPreview() { const imageHeight = parseInt(document.getElementById('bannerImageHeight')?.value || '200'); const imagePosition = document.getElementById('bannerImagePosition')?.value || 'right'; - // Create image element with template styles and dynamic dimensions - const imgStyle = ` - max-width: 100%; - height: auto; - width: ${imageWidth}px; - max-height: ${imageHeight}px; - object-fit: contain; - border-radius: ${template?.BorderRadius || '8'}px; - ${imagePosition === 'left' ? 'float: left; margin-right: 20px;' : ''} - ${imagePosition === 'right' ? 'float: right; margin-left: 20px;' : ''} - ${imagePosition === 'center' ? 'display: block; margin: 0 auto;' : ''} - `; - // Create image container with proper styling and positioning - const maxWidth = imagePosition === 'left' || imagePosition === 'right' ? '30%' : '100%'; - const maxHeight = '200px'; + const isSideBySide = imagePosition === 'left' || imagePosition === 'right'; + const maxWidth = isSideBySide ? '40%' : '100%'; + const maxHeight = isSideBySide ? '300px' : '200px'; + // Create flex container for better layout control let imgContainer = ` `; // Wrap image with link if URL is provided @@ -2010,29 +2021,35 @@ function updateBannerPreview() { : `background-color: ${styles.backgroundColor};`; // Create container with proper layout + const isVerticalLayout = imagePosition === 'top' || imagePosition === 'bottom'; bannerContent = `