diff --git a/src/app/blog/page.tsx b/src/app/blog/page.tsx index b0d534b..7b7cb26 100644 --- a/src/app/blog/page.tsx +++ b/src/app/blog/page.tsx @@ -30,12 +30,14 @@ export default function BlogPage() { brandName="Bakteria" navItems={[ { name: "Home", id: "/" }, - { name: "About", id: "about" }, - { name: "Menu", id: "menu" }, - { name: "Brew Process", id: "process" }, - { name: "Contact", id: "contact" } + { name: "About", id: "/#about" }, + { name: "Menu", id: "/#menu" }, + { name: "Brew Process", id: "/#process" }, + { name: "Blog", id: "/blog" }, + { name: "Shop", id: "/shop" }, + { name: "Contact", id: "/#contact" } ]} - button={{ text: "Order Now", href: "contact" }} + button={{ text: "Order Now", href: "/#contact" }} /> diff --git a/src/app/layout.tsx b/src/app/layout.tsx index e994931..7a009fc 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -190,7 +190,7 @@ export default function RootLayout({ const buttonClasses = ['btn', 'button', 'cta', 'action-button']; const hasButtonClass = buttonClasses.some(cls => - element.classList.contains(cls) || element.classList.contains(\`btn-\${cls}\`) + element.classList.contains(cls) || element.classList.contains(`btn-${cls}`) ); if (hasButtonClass && element.textContent && element.textContent.trim().length > 0) { @@ -613,7 +613,7 @@ export default function RootLayout({ isEditing = false; if (element.dataset.webildOriginalWhiteSpace) { - element.style.whiteSpace = element.dataset.webildOriginalWhiteSpace === 'normal' ? '' : element.dataset.webildOriginalWhiteSpace; + element.style.whiteSpace = element.dataset.webildOriginalWhiteSpace === 'none' ? '' : element.dataset.webildOriginalWhiteSpace; delete element.dataset.webildOriginalWhiteSpace; } if (element.dataset.webildOriginalWordWrap) { @@ -682,7 +682,7 @@ export default function RootLayout({ const rect = element.getBoundingClientRect(); const overlay = document.createElement('div'); overlay.className = 'webild-hover-overlay'; - overlay.style.cssText = \` + overlay.style.cssText = ` position: fixed !important; top: \${rect.top - 2}px !important; left: \${rect.left - 2}px !important; @@ -692,7 +692,7 @@ export default function RootLayout({ pointer-events: none !important; z-index: 999998 !important; transition: all 0.15s ease !important; - \`; + `; document.body.appendChild(overlay); return overlay; }; @@ -751,15 +751,16 @@ export default function RootLayout({ } if (isLabelOnTop) { elementTypeLabel.classList.add('label-top'); - } else { + } + else { elementTypeLabel.classList.add('label-bottom'); } - elementTypeLabel.style.cssText = \` + elementTypeLabel.style.cssText = ` left: \${labelLeft}px !important; top: \${labelTop}px !important; transform: none !important; - \`; + `; }; const removeElementTypeLabel = () => { @@ -1013,7 +1014,7 @@ export default function RootLayout({ const getStorageKey = () => { const url = new URL(window.location.href); const pathParts = url.pathname.split('/').filter(Boolean); - return \`webild-changes-\${pathParts.join('-')}\`; + return `webild-changes-\${pathParts.join('-')}`; }; const saveChangeToStorage = (change) => { @@ -1249,7 +1250,7 @@ export default function RootLayout({ if (isBackground) { oldValue = window.getComputedStyle(element).backgroundImage; - element.style.backgroundImage = \`url('\${newSrc}')\`; + element.style.backgroundImage = `url('\${newSrc}')`; replaced = true; } else if (element.tagName.toLowerCase() === 'img') { oldValue = element.src; @@ -1284,1374 +1285,7 @@ export default function RootLayout({ const hasBackgroundImage = window.getComputedStyle(element).backgroundImage !== 'none'; if (hasBackgroundImage) { oldValue = window.getComputedStyle(element).backgroundImage; - element.style.backgroundImage = \`url('\${newSrc}')\`; - replaced = true; - } - } - - if (replaced) { - const elementInfo = getElementInfo(element); - - let cleanOldValue = oldValue; - if (oldValue.includes('url(')) { - const urlMatch = oldValue.match(/url(['"]?([^'")]+)['"]?)/); - if (urlMatch) { - cleanOldValue = urlMatch[1]; - } - } - - cleanOldValue = extractOriginalUrl(cleanOldValue); - - const change = { - type: 'replaceImage', - selector: selector, - oldValue: cleanOldValue, - newValue: newSrc, - elementType: elementInfo.elementType, - sectionId: elementInfo.sectionId, - timestamp: Date.now() - }; - - saveChangeToStorage(change); - - window.parent.postMessage({ - type: 'webild-element-changed', - data: change - }, '*'); - - window.parent.postMessage({ - type: 'webild-image-replaced', - data: { selector, newSrc, success: true } - }, '*'); - } else { - window.parent.postMessage({ - type: 'webild-image-replacement-error', - data: { selector, message: 'Could not determine how to replace image', success: false } - }, '*'); - } - } catch (error) { - window.parent.postMessage({ - type: 'webild-image-replacement-error', - data: { selector, message: error.message || 'Failed to replace image', success: false } - }, '*'); - } - } - }; - - document.addEventListener('mouseover', handleMouseOver, true); - document.addEventListener('mouseout', handleMouseOut, true); - document.addEventListener('click', handleClick, true); - document.addEventListener('keydown', handleKeyDown, true); - document.addEventListener('blur', handleBlur, true); - window.addEventListener('scroll', handleScroll, true); - window.addEventListener('message', handleMessage, true); - - let lastPathname = window.location.pathname; - - const notifyPageChange = () => { - window.parent.postMessage({ - type: 'webild-page-changed', - data: { pathname: window.location.pathname } - }, '*'); - }; - - window.addEventListener('popstate', () => { - if (lastPathname !== window.location.pathname) { - lastPathname = window.location.pathname; - notifyPageChange(); - } - }, true); - - const urlCheckInterval = setInterval(() => { - if (lastPathname !== window.location.pathname) { - lastPathname = window.location.pathname; - notifyPageChange(); - } - }, 500); - - notifyPageChange(); - - window.webildCleanup = () => { - isActive = false; - - if (selectedElement) { - makeUneditable(selectedElement, false); - } - - removeHoverOverlay(); - removeElementTypeLabel(); - - if (urlCheckInterval) { - clearInterval(urlCheckInterval); - } - - document.removeEventListener('mouseover', handleMouseOver, true); - document.removeEventListener('mouseout', handleMouseOut, true); - document.removeEventListener('click', handleClick, true); - document.removeEventListener('keydown', handleKeyDown, true); - document.removeEventListener('blur', handleBlur, true); - window.removeEventListener('scroll', handleScroll, true); - window.removeEventListener('message', handleMessage, true); - - document.querySelectorAll('.' + hoverClass).forEach(el => { - el.classList.remove(hoverClass); - }); - document.querySelectorAll('.' + selectedClass).forEach(el => { - el.classList.remove(selectedClass); - }); - - const styleEl = document.getElementById('webild-inspector-styles'); - if (styleEl) styleEl.remove(); - - hoveredElement = null; - selectedElement = null; - }; - - window.parent.postMessage({ type: 'webild-editor-ready' }, '*'); -})(); -` - }} - /> - -