4 Commits

Author SHA1 Message Date
bbb3b0a987 Update src/app/page.tsx 2026-02-23 20:43:42 +00:00
e31905d12e Update src/app/layout.tsx 2026-02-23 20:43:41 +00:00
f07ca3bc7f Merge version_4 into main
Merge version_4 into main
2026-02-23 20:42:42 +00:00
7d3bf16d47 Bob AI: Align the buttons with the text in the about section by adju 2026-02-23 20:40:12 +00:00
3 changed files with 66 additions and 38 deletions

View File

@@ -3,19 +3,15 @@ import { Nunito } from "next/font/google";
import "./globals.css";
import { ServiceWrapper } from "@/components/ServiceWrapper";
import Tag from "@/tag/Tag";
import { Cormorant_Garamond } from "next/font/google";
const nunito = Nunito({
variable: "--font-nunito", subsets: ["latin"],
});
export const metadata: Metadata = {
title: "Luxury Skincare Milan | Premium Beauty Rituals", description: "Discover exquisite luxury skincare from Milan's finest brand. Experience premium rituals with pure ingredients, personalized plans, and elegant packaging for discerning beauty enthusiasts.", keywords: ["luxury skincare", "Milan skincare", "premium beauty", "skincare rituals", "exclusive skincare"]
};
const cormorantGaramond = Cormorant_Garamond({
variable: "--font-cormorant-garamond",
subsets: ["latin"],
weight: ["300", "400", "500", "600", "700"],
});
export default function RootLayout({
children,
}: Readonly<{
@@ -24,7 +20,9 @@ export default function RootLayout({
return (
<html lang="en" suppressHydrationWarning>
<ServiceWrapper>
<body className={`${cormorantGaramond.variable} antialiased`}>
<body
className={`${nunito.variable} antialiased`}
>
<Tag />
{children}
@@ -269,7 +267,9 @@ export default function RootLayout({
const getElementInfo = (element, assignId = false) => {
const rect = element.getBoundingClientRect();
const tagName = element.tagName.toLowerCase();
const selector = getUniqueSelector(element, assignId);
const sectionId = getSectionId(element);
let className = undefined;
try {
if (element.className) {
@@ -297,7 +297,8 @@ export default function RootLayout({
};
if (tagName === 'img') {
info.imageData = {
const originalSrc = extractOriginalUrl(element.src);
info.imageData = {
src: originalSrc,
alt: element.alt || undefined,
naturalWidth: element.naturalWidth,
@@ -308,7 +309,8 @@ export default function RootLayout({
if (tagName === 'video') {
const rawSrc = element.src || element.currentSrc || (element.querySelector('source') && element.querySelector('source').src) || '';
info.imageData = {
const resolvedSrc = extractOriginalUrl(rawSrc);
info.imageData = {
src: resolvedSrc,
alt: element.getAttribute('aria-label') || undefined,
isBackground: false,
@@ -321,7 +323,8 @@ export default function RootLayout({
if (backgroundImage && backgroundImage !== 'none') {
const urlMatch = backgroundImage.match(/url(['"]?([^'")]+)['"]?)/);
if (urlMatch) {
if (tagName !== 'img') {
const originalBgSrc = extractOriginalUrl(urlMatch[1]);
if (tagName !== 'img') {
info.imageData = {
src: originalBgSrc,
isBackground: true
@@ -333,7 +336,8 @@ export default function RootLayout({
}
}
info.elementType = elementType;
const elementType = getElementType(element);
info.elementType = elementType;
if (elementType === 'Button') {
const buttonText = element.textContent?.trim() || element.value || element.getAttribute('aria-label') || '';
@@ -426,11 +430,13 @@ export default function RootLayout({
};
const isTextElement = (element) => {
return elementType === 'Text';
const elementType = getElementType(element);
return elementType === 'Text';
};
const isButtonElement = (element) => {
return elementType === 'Button';
const elementType = getElementType(element);
return elementType === 'Button';
};
const updateButtonText = (element, newText) => {
@@ -505,7 +511,8 @@ export default function RootLayout({
};
const handleInput = () => {
let currentText = element.textContent;
const elementInfo = getElementInfo(element);
let currentText = element.textContent;
// Ensure there's always at least a space to keep the element editable
if (currentText === '' || currentText === null || currentText.length === 0) {
@@ -618,7 +625,8 @@ export default function RootLayout({
}, '*');
if (save && originalContent !== element.textContent) {
let finalText = element.textContent;
const elementInfo = getElementInfo(element);
let finalText = element.textContent;
// Trim the final text and convert space-only to empty string for saving
if (finalText === ' ' || finalText.trim() === '') {
@@ -747,7 +755,7 @@ export default function RootLayout({
lastMouseX = e.clientX;
lastMouseY = e.clientY;
|| e.target;
const target = getMostSpecificElement(e.clientX, e.clientY) || e.target;
if (!isValidElement(target) || target === hoveredElement || target === selectedElement) {
return;
@@ -779,7 +787,8 @@ export default function RootLayout({
hoverOverlay = createHoverOverlay(target);
}
showElementTypeLabel(target, elementType);
const elementType = getElementType(target);
showElementTypeLabel(target, elementType);
window.parent.postMessage({
type: 'webild-element-hover',
@@ -821,7 +830,7 @@ export default function RootLayout({
e.preventDefault();
e.stopPropagation();
|| e.target;
const target = getMostSpecificElement(e.clientX, e.clientY) || e.target;
if (!isValidElement(target)) return;
if (selectedElement && selectedElement !== target) {
@@ -866,7 +875,8 @@ export default function RootLayout({
hoveredElement = null;
}
selectedElement.dataset.webildSelector = elementInfo.selector;
const elementInfo = getElementInfo(target, true);
selectedElement.dataset.webildSelector = elementInfo.selector;
showElementTypeLabel(target, elementInfo.elementType);
window.parent.postMessage({
@@ -949,7 +959,8 @@ export default function RootLayout({
isScrolling = false;
if (lastMouseX > 0 && lastMouseY > 0) {
if (target && isValidElement(target) && target !== selectedElement) {
const target = getMostSpecificElement(lastMouseX, lastMouseY);
if (target && isValidElement(target) && target !== selectedElement) {
hoveredElement = target;
const computedStyle = window.getComputedStyle(target);
@@ -963,7 +974,8 @@ export default function RootLayout({
hoveredElement.classList.add(hoverClass);
hoverOverlay = createHoverOverlay(target);
showElementTypeLabel(target, elementType);
const elementType = getElementType(target);
showElementTypeLabel(target, elementType);
window.parent.postMessage({
type: 'webild-element-hover',
@@ -986,7 +998,8 @@ export default function RootLayout({
const saveChangeToStorage = (change) => {
try {
const existingChanges = JSON.parse(localStorage.getItem(storageKey) || '[]');
const storageKey = getStorageKey();
const existingChanges = JSON.parse(localStorage.getItem(storageKey) || '[]');
const filteredChanges = existingChanges.filter(c => {
return !(c.oldValue === change.oldValue && c.sectionId === change.sectionId);
@@ -1006,7 +1019,8 @@ export default function RootLayout({
const clearLocalChanges = () => {
try {
localStorage.removeItem(storageKey);
const storageKey = getStorageKey();
localStorage.removeItem(storageKey);
window.parent.postMessage({
type: 'webild-local-changes-cleared',
data: {}
@@ -1055,7 +1069,8 @@ export default function RootLayout({
if (e.data.type === 'webild-cancel-changes') {
try {
const savedChanges = localStorage.getItem(storageKey);
const storageKey = getStorageKey();
const savedChanges = localStorage.getItem(storageKey);
if (savedChanges) {
const changes = JSON.parse(savedChanges);
changes.forEach(change => {
@@ -1077,7 +1092,8 @@ export default function RootLayout({
if (isBackground) {
element.style.backgroundImage = change.oldValue ? 'url(' + change.oldValue + ')' : '';
} else {
if (revertTag === 'video' && oldMediaType === 'image') {
const oldMediaType = getMediaTypeFromUrl(change.oldValue);
if (revertTag === 'video' && oldMediaType === 'image') {
swapMediaElement(element, 'img', change.oldValue);
} else if (revertTag === 'img' && oldMediaType === 'video') {
swapMediaElement(element, 'video', change.oldValue);
@@ -1125,7 +1141,8 @@ export default function RootLayout({
const el = textElements[i];
if (isTextElement(el) && el.textContent.trim() === (oldValue || '').trim()) {
element = el;
if (newSelector) {
const newSelector = getUniqueSelector(element, true);
if (newSelector) {
element.dataset.webildSelector = newSelector;
}
break;
@@ -1216,8 +1233,10 @@ export default function RootLayout({
replaced = true;
} else if (element.tagName.toLowerCase() === 'img') {
oldValue = element.src;
if (newMediaType === 'video' && allowMediaTypeSwap) {
if (selectedElement === element) selectedElement = swapped;
const newMediaType = getMediaTypeFromUrl(newSrc);
if (newMediaType === 'video' && allowMediaTypeSwap) {
const swapped = swapMediaElement(element, 'video', newSrc);
if (selectedElement === element) selectedElement = swapped;
element = swapped;
} else {
element.src = newSrc;
@@ -1225,9 +1244,11 @@ export default function RootLayout({
replaced = true;
} else if (element.tagName.toLowerCase() === 'video') {
oldValue = element.src || element.currentSrc || '';
const sources = element.querySelectorAll('source');
const newMediaType = getMediaTypeFromUrl(newSrc);
const sources = element.querySelectorAll('source');
if (newMediaType === 'image' && allowMediaTypeSwap) {
if (selectedElement === element) selectedElement = swapped;
const swapped = swapMediaElement(element, 'img', newSrc);
if (selectedElement === element) selectedElement = swapped;
element = swapped;
} else {
if (sources.length > 0) {
@@ -1249,7 +1270,8 @@ export default function RootLayout({
}
if (replaced) {
const elementInfo = getElementInfo(element);
let cleanOldValue = oldValue;
if (oldValue.includes('url(')) {
const urlMatch = oldValue.match(/url(['"]?([^'")]+)['"]?)/);
@@ -1320,7 +1342,13 @@ export default function RootLayout({
}
}, true);
const urlCheckInterval = setInterval(() => {
if (lastPathname !== window.location.pathname) {
lastPathname = window.location.pathname;
notifyPageChange();
}
}, 500);
notifyPageChange();
window.webildCleanup = () => {

View File

@@ -57,9 +57,9 @@ export default function LandingPage() {
imageAlt="Luxurious skincare products arranged elegantly on a marble surface"
mediaAnimation="slide-up"
marqueeItems={[
{ type: "text", text: "100% Natural Ingredients", icon: CheckCircle },
{ type: "text", text: "Cruelty-Free Certified", icon: CheckCircle },
{ type: "text", text: "Made in Italy", icon: CheckCircle }
{ type: "text", text: "100% Natural Ingredients" },
{ type: "text", text: "Cruelty-Free Certified" },
{ type: "text", text: "Made in Italy" }
]}
showMarqueeCard={true}
ariaLabel="Luxury skincare hero section showcasing premium products"

View File

@@ -72,7 +72,7 @@ const TextSplitAbout = ({
))}
{buttons && buttons.length > 0 && (
<div ref={buttonContainerRef} className={cls("flex flex-wrap gap-4 max-md:justify-center", buttonContainerClassName)}>
<div ref={buttonContainerRef} className={cls("flex flex-wrap gap-4 md:justify-start max-md:justify-center pt-2", buttonContainerClassName)}>
{buttons.slice(0, 2).map((button, index) => (
<Button key={index} {...getButtonProps(button, index, theme.defaultButtonVariant, cls("px-8", buttonClassName), cls("text-base", buttonTextClassName))} />
))}