updateweb

This commit is contained in:
Local Server
2025-12-24 00:13:23 -06:00
parent e4b3de4a46
commit 017c6376fc
88 changed files with 17866 additions and 1191 deletions

View File

@@ -149,49 +149,229 @@
<div class="container">
<div class="about-layout">
<div class="about-main-content">
<div class="about-text">
<h2>Our Story</h2>
<p>
Sky Art Shop specializes in scrapbooking, journaling,
cardmaking, and collaging stationery. We are passionate about
helping people express their creativity and preserve their
memories.
</p>
<p>
Our mission is to promote mental health and wellness through
creative art activities. We believe that crafting is more than
just a hobby—it's a therapeutic journey that brings joy,
mindfulness, and self-expression.
</p>
<h2>What We Offer</h2>
<p>Our carefully curated collection includes:</p>
<ul>
<li>Washi tape in various designs and patterns</li>
<li>Unique stickers for journaling and scrapbooking</li>
<li>High-quality journals and notebooks</li>
<li>Card making supplies and kits</li>
<li>Collage materials and ephemera</li>
<li>Creative tools and accessories</li>
</ul>
<h2>Why Choose Us</h2>
<p>
We hand-select every item in our store to ensure the highest
quality and uniqueness. Whether you're a seasoned crafter or
just starting your creative journey, we have something special
for everyone.
</p>
<p>
Join our community of creative minds and let your imagination
soar!
</p>
<div class="about-text" id="aboutContent">
<div style="text-align: center; padding: 40px">
<div
class="loading-spinner"
style="
border: 4px solid #f3f3f3;
border-top: 4px solid #667eea;
border-radius: 50%;
width: 50px;
height: 50px;
animation: spin 1s linear infinite;
margin: 0 auto 20px;
"
></div>
<p>Loading content...</p>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Team Members Section -->
<section class="team-section" id="teamSection" style="display: none">
<div class="container">
<div class="team-header">
<h2 class="section-title">Meet Our Team</h2>
<p class="section-subtitle">
The talented people behind Sky Art Shop
</p>
</div>
<div class="team-grid" id="teamMembersGrid">
<div style="text-align: center; padding: 40px">
<div
class="loading-spinner"
style="
border: 4px solid #f3f3f3;
border-top: 4px solid #667eea;
border-radius: 50%;
width: 50px;
height: 50px;
animation: spin 1s linear infinite;
margin: 0 auto 20px;
"
></div>
<p>Loading team...</p>
</div>
</div>
</div>
</section>
<style>
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
/* Team Section Styles */
.team-section {
padding: 80px 0;
background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}
.team-header {
text-align: center;
margin-bottom: 60px;
}
.section-title {
font-size: 2.5rem;
font-weight: 700;
color: #2d3748;
margin-bottom: 15px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.section-subtitle {
font-size: 1.125rem;
color: #718096;
max-width: 600px;
margin: 0 auto;
}
.team-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 40px;
max-width: 1200px;
margin: 0 auto;
}
.team-card {
background: white;
border-radius: 20px;
padding: 40px 30px;
text-align: center;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
position: relative;
overflow: hidden;
}
.team-card::before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
height: 5px;
background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
transform: scaleX(0);
transition: transform 0.4s ease;
}
.team-card:hover {
transform: translateY(-10px);
box-shadow: 0 20px 40px rgba(102, 126, 234, 0.25);
}
.team-card:hover::before {
transform: scaleX(1);
}
.team-image-wrapper {
width: 150px;
height: 150px;
margin: 0 auto 25px;
position: relative;
}
.team-image {
width: 100%;
height: 100%;
border-radius: 50%;
object-fit: cover;
border: 5px solid #667eea;
transition: all 0.4s ease;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}
.team-card:hover .team-image {
transform: scale(1.1) rotate(5deg);
border-color: #764ba2;
}
.team-image img {
width: 100%;
height: 100%;
border-radius: 50%;
object-fit: cover;
}
.team-image i {
font-size: 4rem;
color: white;
}
.team-name {
font-size: 1.5rem;
font-weight: 700;
color: #2d3748;
margin-bottom: 8px;
transition: color 0.3s ease;
}
.team-card:hover .team-name {
color: #667eea;
}
.team-position {
font-size: 1.125rem;
color: #667eea;
font-weight: 600;
margin-bottom: 15px;
text-transform: uppercase;
letter-spacing: 0.5px;
font-size: 0.875rem;
}
.team-bio {
font-size: 1rem;
color: #718096;
line-height: 1.7;
margin-bottom: 0;
}
/* Responsive Design */
@media (max-width: 768px) {
.team-section {
padding: 60px 0;
}
.section-title {
font-size: 2rem;
}
.team-grid {
grid-template-columns: 1fr;
gap: 30px;
}
.team-card {
padding: 30px 20px;
}
.team-image-wrapper {
width: 120px;
height: 120px;
}
}
</style>
<footer class="footer">
<div class="container">
<div class="footer-grid">
@@ -245,8 +425,167 @@
</div>
</footer>
<script src="/assets/js/page-transitions.js"></script>
<script src="/assets/js/main.js"></script>
<script src="/assets/js/navigation.js"></script>
<script src="/assets/js/cart.js"></script>
<script src="/assets/js/shopping.js"></script>
<script>
// Load about page content from API
async function loadAboutContent() {
try {
const response = await fetch("/api/pages/about");
const data = await response.json();
if (data.success && data.page) {
const contentDiv = document.getElementById("aboutContent");
// Check if content is Quill Delta format (JSON)
if (data.page.content) {
try {
const delta = JSON.parse(data.page.content);
// Convert Delta to HTML
contentDiv.innerHTML = convertDeltaToHTML(delta);
} catch {
// If not JSON, treat as plain HTML
contentDiv.innerHTML = data.page.content;
}
} else {
contentDiv.innerHTML = "<p>Content not available.</p>";
}
// Update meta tags if available
if (data.page.metatitle) {
document.title = data.page.metatitle;
}
if (data.page.metadescription) {
const metaDesc = document.querySelector(
'meta[name="description"]'
);
if (metaDesc) {
metaDesc.content = data.page.metadescription;
}
}
} else {
document.getElementById("aboutContent").innerHTML =
"<p>Unable to load content.</p>";
}
} catch (error) {
console.error("Error loading about content:", error);
document.getElementById("aboutContent").innerHTML =
"<p>Error loading content.</p>";
}
}
// Convert Quill Delta to HTML
function convertDeltaToHTML(delta) {
if (!delta || !delta.ops) return "";
let html = "";
let currentBlock = "";
delta.ops.forEach((op) => {
if (typeof op.insert === "string") {
let text = op.insert;
// Apply text formatting
if (op.attributes) {
if (op.attributes.bold) text = `<strong>${text}</strong>`;
if (op.attributes.italic) text = `<em>${text}</em>`;
if (op.attributes.underline) text = `<u>${text}</u>`;
if (op.attributes.strike) text = `<s>${text}</s>`;
if (op.attributes.code) text = `<code>${text}</code>`;
if (op.attributes.link)
text = `<a href="${op.attributes.link}" target="_blank">${text}</a>`;
if (op.attributes.color)
text = `<span style="color: ${op.attributes.color}">${text}</span>`;
if (op.attributes.background)
text = `<span style="background-color: ${op.attributes.background}">${text}</span>`;
}
// Handle line breaks
const lines = text.split("\n");
lines.forEach((line, index) => {
currentBlock += line;
if (index < lines.length - 1) {
// New paragraph
if (currentBlock.trim()) {
html += `<p>${currentBlock}</p>`;
}
currentBlock = "";
}
});
}
});
// Add remaining content
if (currentBlock.trim()) {
html += `<p>${currentBlock}</p>`;
}
return html || "<p>Content not available.</p>";
}
// Load team members
async function loadTeamMembers() {
try {
const response = await fetch("/api/team-members");
const data = await response.json();
if (data.success && data.teamMembers && data.teamMembers.length > 0) {
displayTeamMembers(data.teamMembers);
document.getElementById("teamSection").style.display = "block";
}
} catch (error) {
console.error("Error loading team members:", error);
}
}
// Display team members
function displayTeamMembers(members) {
const grid = document.getElementById("teamMembersGrid");
grid.innerHTML = members
.map(
(member) => `
<div class="team-card">
<div class="team-image-wrapper">
<div class="team-image">
${
member.image_url
? `<img src="${member.image_url}" alt="${escapeHtml(
member.name
)}" />`
: `<i class="bi bi-person-circle"></i>`
}
</div>
</div>
<h3 class="team-name">${escapeHtml(member.name)}</h3>
<div class="team-position">${escapeHtml(member.position)}</div>
${
member.bio
? `<p class="team-bio">${escapeHtml(member.bio)}</p>`
: ""
}
</div>
`
)
.join("");
}
// Escape HTML to prevent XSS
function escapeHtml(text) {
if (!text) return "";
const div = document.createElement("div");
div.textContent = text;
return div.innerHTML;
}
// Load content when page loads
document.addEventListener("DOMContentLoaded", function () {
loadAboutContent();
loadTeamMembers();
});
</script>
</body>
</html>

View File

@@ -227,7 +227,9 @@
</div>
</footer>
<script src="/assets/js/page-transitions.js"></script>
<script src="/assets/js/main.js"></script>
<script src="/assets/js/navigation.js"></script>
<script src="/assets/js/cart.js"></script>
<script src="/assets/js/shopping.js"></script>
<script>

View File

@@ -174,246 +174,46 @@
</section>
<!-- Business Contact Information -->
<section style="padding: 60px 0 40px; background: white">
<section
style="padding: 60px 0 40px; background: white"
id="contactInfoSection"
>
<div class="container" style="max-width: 1000px">
<div style="text-align: center; margin-bottom: 48px">
<h2
style="
font-size: 2rem;
font-weight: 700;
color: #2d3436;
margin-bottom: 12px;
"
>
Our Contact Information
</h2>
<p style="font-size: 1rem; color: #636e72">
Reach out to us through any of these channels
</p>
</div>
<div
style="
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 32px;
"
>
<!-- Phone -->
<div style="text-align: center; padding: 40px">
<div
class="loading-spinner"
style="
background: #f8f9fa;
padding: 32px 24px;
border-radius: 12px;
text-align: center;
border: 2px solid #e1e8ed;
transition: all 0.3s;
border: 4px solid #f3f3f3;
border-top: 4px solid #667eea;
border-radius: 50%;
width: 50px;
height: 50px;
animation: spin 1s linear infinite;
margin: 0 auto 20px;
"
onmouseover="this.style.borderColor='#667eea'; this.style.transform='translateY(-4px)';"
onmouseout="this.style.borderColor='#e1e8ed'; this.style.transform='translateY(0)';"
>
<div
style="
width: 64px;
height: 64px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto 20px;
"
>
<i
class="bi bi-telephone"
style="font-size: 28px; color: white"
></i>
</div>
<h3
style="
font-size: 18px;
font-weight: 600;
margin-bottom: 12px;
color: #2d3436;
"
>
Phone
</h3>
<p style="color: #636e72; margin: 0 0 8px 0; font-size: 15px">
Give us a call
</p>
<a
href="tel:+1234567890"
style="
color: #667eea;
font-weight: 600;
text-decoration: none;
font-size: 16px;
"
>+1 (234) 567-8900</a
>
</div>
<!-- Email -->
<div
style="
background: #f8f9fa;
padding: 32px 24px;
border-radius: 12px;
text-align: center;
border: 2px solid #e1e8ed;
transition: all 0.3s;
"
onmouseover="this.style.borderColor='#667eea'; this.style.transform='translateY(-4px)';"
onmouseout="this.style.borderColor='#e1e8ed'; this.style.transform='translateY(0)';"
>
<div
style="
width: 64px;
height: 64px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto 20px;
"
>
<i
class="bi bi-envelope"
style="font-size: 28px; color: white"
></i>
</div>
<h3
style="
font-size: 18px;
font-weight: 600;
margin-bottom: 12px;
color: #2d3436;
"
>
Email
</h3>
<p style="color: #636e72; margin: 0 0 8px 0; font-size: 15px">
Send us an email
</p>
<a
href="mailto:support@skyartshop.com"
style="
color: #667eea;
font-weight: 600;
text-decoration: none;
font-size: 16px;
"
>support@skyartshop.com</a
>
</div>
<!-- Location -->
<div
style="
background: #f8f9fa;
padding: 32px 24px;
border-radius: 12px;
text-align: center;
border: 2px solid #e1e8ed;
transition: all 0.3s;
"
onmouseover="this.style.borderColor='#667eea'; this.style.transform='translateY(-4px)';"
onmouseout="this.style.borderColor='#e1e8ed'; this.style.transform='translateY(0)';"
>
<div
style="
width: 64px;
height: 64px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto 20px;
"
>
<i
class="bi bi-geo-alt"
style="font-size: 28px; color: white"
></i>
</div>
<h3
style="
font-size: 18px;
font-weight: 600;
margin-bottom: 12px;
color: #2d3436;
"
>
Location
</h3>
<p style="color: #636e72; margin: 0 0 8px 0; font-size: 15px">
Visit our shop
</p>
<p
style="
color: #667eea;
font-weight: 600;
margin: 0;
font-size: 16px;
line-height: 1.6;
"
>
123 Creative Street<br />Art District, CA 90210
</p>
</div>
</div>
<!-- Business Hours -->
<div
style="
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-radius: 12px;
padding: 32px;
margin-top: 40px;
text-align: center;
color: white;
"
>
<h3 style="font-size: 20px; font-weight: 600; margin-bottom: 16px">
Business Hours
</h3>
<div
style="
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 16px;
max-width: 600px;
margin: 0 auto;
"
>
<div>
<p style="margin: 0; font-weight: 500; opacity: 0.9">
Monday - Friday
</p>
<p style="margin: 4px 0 0 0; font-size: 18px; font-weight: 600">
9:00 AM - 6:00 PM
</p>
</div>
<div>
<p style="margin: 0; font-weight: 500; opacity: 0.9">Saturday</p>
<p style="margin: 4px 0 0 0; font-size: 18px; font-weight: 600">
10:00 AM - 4:00 PM
</p>
</div>
<div>
<p style="margin: 0; font-weight: 500; opacity: 0.9">Sunday</p>
<p style="margin: 4px 0 0 0; font-size: 18px; font-weight: 600">
Closed
</p>
</div>
</div>
></div>
<p>Loading contact information...</p>
</div>
</div>
</section>
<style>
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
/* Contact card hover effects */
#contactInfoSection [style*="border: 2px solid"]:hover {
border-color: #667eea !important;
transform: translateY(-4px);
box-shadow: 0 8px 16px rgba(102, 126, 234, 0.2);
}
</style>
<!-- Contact Form Section -->
<section
class="contact-section"
@@ -725,7 +525,9 @@
</div>
</footer>
<script src="/assets/js/page-transitions.js"></script>
<script src="/assets/js/main.js"></script>
<script src="/assets/js/navigation.js"></script>
<script src="/assets/js/cart.js"></script>
<script src="/assets/js/shopping.js"></script>
<script>
@@ -792,6 +594,47 @@
}, 5000);
}
});
// Load contact information from API
async function loadContactInfo() {
try {
const response = await fetch("/api/pages/contact");
const data = await response.json();
if (data.success && data.page) {
const section = document.getElementById("contactInfoSection");
section.innerHTML = `
<div class="container" style="max-width: 1000px">
${data.page.content}
</div>
`;
// Update meta tags
if (data.page.metatitle) {
document.title = data.page.metatitle;
}
if (data.page.metadescription) {
const metaDesc = document.querySelector(
'meta[name="description"]'
);
if (metaDesc) {
metaDesc.content = data.page.metadescription;
}
}
}
} catch (error) {
console.error("Error loading contact info:", error);
document.getElementById("contactInfoSection").innerHTML =
'<div class="container"><p style="text-align:center;">Error loading contact information.</p></div>';
}
}
// Load content when page loads
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", loadContactInfo);
} else {
loadContactInfo();
}
</script>
</body>
</html>

View File

@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<rect width="100" height="100" fill="#7c3aed"/>
<text x="50" y="70" font-size="60" font-family="Arial, sans-serif" font-weight="bold" text-anchor="middle" fill="white">S</text>
</svg>

After

Width:  |  Height:  |  Size: 251 B

View File

@@ -145,20 +145,24 @@
</nav>
<!-- Hero Section -->
<section class="hero">
<div class="hero-content">
<h2>Welcome to Sky Art Shop</h2>
<p>Your destination for creative stationery and supplies</p>
<div class="hero-description">
<section class="hero" id="heroSection">
<div class="hero-content" id="heroContent">
<h2 id="heroHeadline">Welcome to Sky Art Shop</h2>
<p id="heroSubheading">
Your destination for creative stationery and supplies
</p>
<div class="hero-description" id="heroDescription">
<p>
Discover our curated collection of scrapbooking, journaling,
cardmaking, and collaging supplies. Express your creativity and
bring your artistic vision to life.
</p>
</div>
<a href="/shop.html" class="btn btn-primary">Shop Now</a>
<a href="/shop.html" class="btn btn-primary" id="heroCtaBtn"
>Shop Now</a
>
</div>
<div class="hero-image">
<div class="hero-image" id="heroImageContainer">
<img
src="/assets/images/hero-image.jpg"
alt="Sky Art Shop"
@@ -168,12 +172,12 @@
</div>
</section>
<!-- Inspiration Section -->
<section class="inspiration">
<!-- Promotion/Inspiration Section -->
<section class="inspiration" id="promotionSection">
<div class="container">
<h2>Get Inspired</h2>
<div class="inspiration-content">
<div class="inspiration-text">
<h2 id="promotionTitle">Get Inspired</h2>
<div class="inspiration-content" id="promotionContent">
<div class="inspiration-text" id="promotionText">
<p>
At Sky Art Shop, we believe in the power of creativity to
transform and inspire. Whether you're an experienced crafter or
@@ -186,7 +190,7 @@
beautiful and meaningful.
</p>
</div>
<div class="inspiration-image">
<div class="inspiration-image" id="promotionImage">
<img
src="/assets/images/inspiration.jpg"
alt="Creative Inspiration"
@@ -199,11 +203,13 @@
</div>
</section>
<!-- Featured Products Section -->
<section class="collection">
<!-- Featured Products / Portfolio Section -->
<section class="collection" id="portfolioSection">
<div class="container">
<h2>Featured Products</h2>
<p class="section-subtitle">Discover our most popular items</p>
<h2 id="portfolioTitle">Featured Products</h2>
<p class="section-subtitle" id="portfolioDescription">
Discover our most popular items
</p>
<div class="products-grid" id="featuredProducts">
<div class="product-card">
<div class="product-image">
@@ -274,9 +280,150 @@
</div>
</footer>
<script src="/assets/js/page-transitions.js"></script>
<script src="/assets/js/main.js"></script>
<script src="/assets/js/cart.js"></script>
<script>
// Load homepage settings
async function loadHomepageSettings() {
try {
const response = await fetch("/api/public/homepage/settings");
if (response.ok) {
const data = await response.json();
if (data.success && data.settings) {
applyHomepageSettings(data.settings);
}
}
} catch (error) {
console.log("Using default homepage settings");
}
}
function applyHomepageSettings(settings) {
// Apply Hero Section
if (settings.hero) {
const heroSection = document.getElementById("heroSection");
const heroContent = document.getElementById("heroContent");
if (!settings.hero.enabled) {
heroSection.style.display = "none";
return;
}
if (settings.hero.headline) {
document.getElementById("heroHeadline").textContent =
settings.hero.headline;
}
if (settings.hero.subheading) {
document.getElementById("heroSubheading").textContent =
settings.hero.subheading;
}
if (settings.hero.description) {
document.getElementById("heroDescription").innerHTML =
settings.hero.description;
}
if (settings.hero.ctaText && settings.hero.ctaLink) {
const ctaBtn = document.getElementById("heroCtaBtn");
ctaBtn.textContent = settings.hero.ctaText;
ctaBtn.href = settings.hero.ctaLink;
}
if (settings.hero.backgroundUrl) {
const isVideo =
settings.hero.backgroundUrl.match(/\.(mp4|webm|ogg)$/i);
const heroImageContainer =
document.getElementById("heroImageContainer");
if (isVideo) {
heroImageContainer.innerHTML = `
<video autoplay muted loop playsinline style="width: 100%; height: 100%; object-fit: cover;">
<source src="${settings.hero.backgroundUrl}" type="video/mp4">
</video>
`;
} else {
heroImageContainer.innerHTML = `<img src="${settings.hero.backgroundUrl}" alt="Hero Background" loading="lazy" />`;
}
}
// Apply layout
if (settings.hero.layout) {
heroContent.style.textAlign = settings.hero.layout.replace(
"text-",
""
);
}
}
// Apply Promotion Section
if (settings.promotion) {
const promotionSection = document.getElementById("promotionSection");
if (!settings.promotion.enabled) {
promotionSection.style.display = "none";
} else {
if (settings.promotion.title) {
document.getElementById("promotionTitle").textContent =
settings.promotion.title;
}
if (settings.promotion.description) {
document.getElementById("promotionText").innerHTML =
settings.promotion.description;
}
if (settings.promotion.imageUrl) {
const promotionImage = document.getElementById("promotionImage");
promotionImage.innerHTML = `<img src="${
settings.promotion.imageUrl
}" alt="${
settings.promotion.title || "Promotion"
}" loading="lazy" />`;
}
// Apply text alignment
if (settings.promotion.textAlignment) {
document.getElementById("promotionText").style.textAlign =
settings.promotion.textAlignment;
}
// Apply image position (you can customize CSS classes for this)
const promotionContent =
document.getElementById("promotionContent");
if (settings.promotion.imagePosition === "right") {
promotionContent.style.flexDirection = "row-reverse";
} else if (settings.promotion.imagePosition === "center") {
promotionContent.style.flexDirection = "column";
}
}
}
// Apply Portfolio Section
if (settings.portfolio) {
const portfolioSection = document.getElementById("portfolioSection");
if (!settings.portfolio.enabled) {
portfolioSection.style.display = "none";
} else {
if (settings.portfolio.title) {
document.getElementById("portfolioTitle").textContent =
settings.portfolio.title;
}
if (settings.portfolio.description) {
const descEl = document.getElementById("portfolioDescription");
if (descEl) {
descEl.innerHTML = settings.portfolio.description;
}
}
// Portfolio count is handled by existing featured products logic
}
}
}
// Load site settings
async function loadSiteSettings() {
try {
@@ -355,8 +502,10 @@
// Initialize
loadSiteSettings();
loadHomepageSettings();
loadFeaturedProducts();
</script>
<script src="/assets/js/navigation.js"></script>
<script src="/assets/js/shopping.js"></script>
</body>
</html>

323
website/public/page.html Normal file
View File

@@ -0,0 +1,323 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title id="pageTitle">Loading... - Sky Art Shop</title>
<meta name="description" id="pageDescription" content="Sky Art Shop" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;600;700&display=swap"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css"
/>
<link rel="stylesheet" href="/assets/css/main.css" />
<link rel="stylesheet" href="/assets/css/navbar.css" />
<style>
.page-container {
max-width: 1200px;
margin: 0 auto;
padding: 40px 20px;
}
.page-header {
text-align: center;
margin-bottom: 40px;
padding-bottom: 20px;
border-bottom: 2px solid #e0e0e0;
}
.page-header h1 {
font-size: 2.5rem;
font-weight: 700;
color: #333;
margin-bottom: 10px;
}
.page-content {
background: white;
padding: 40px;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
line-height: 1.8;
font-size: 1.1rem;
}
.page-content h1,
.page-content h2,
.page-content h3,
.page-content h4,
.page-content h5,
.page-content h6 {
margin-top: 1.5em;
margin-bottom: 0.5em;
font-weight: 600;
color: #333;
}
.page-content h1 {
font-size: 2rem;
border-bottom: 2px solid #e0e0e0;
padding-bottom: 10px;
}
.page-content h2 {
font-size: 1.75rem;
}
.page-content h3 {
font-size: 1.5rem;
}
.page-content p {
margin-bottom: 1.2em;
color: #555;
}
.page-content ul,
.page-content ol {
margin-bottom: 1.5em;
padding-left: 30px;
}
.page-content li {
margin-bottom: 0.5em;
}
.page-content img {
max-width: 100%;
height: auto;
border-radius: 8px;
margin: 20px 0;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.page-content blockquote {
border-left: 4px solid #667eea;
padding-left: 20px;
margin: 20px 0;
font-style: italic;
color: #666;
background: #f8f9fa;
padding: 15px 20px;
border-radius: 4px;
}
.page-content a {
color: #667eea;
text-decoration: none;
transition: color 0.3s;
}
.page-content a:hover {
color: #5568d3;
text-decoration: underline;
}
.page-content code {
background: #f4f4f4;
padding: 2px 6px;
border-radius: 3px;
font-family: monospace;
font-size: 0.9em;
}
.page-content pre {
background: #2d2d2d;
color: #f8f8f2;
padding: 20px;
border-radius: 8px;
overflow-x: auto;
margin: 20px 0;
}
.page-content pre code {
background: none;
padding: 0;
color: inherit;
}
.loading-container {
text-align: center;
padding: 100px 20px;
}
.loading-spinner {
border: 4px solid #f3f3f3;
border-top: 4px solid #667eea;
border-radius: 50%;
width: 50px;
height: 50px;
animation: spin 1s linear infinite;
margin: 0 auto 20px;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.error-container {
text-align: center;
padding: 100px 20px;
}
.error-container i {
font-size: 4rem;
color: #e74c3c;
margin-bottom: 20px;
}
.error-container h2 {
color: #333;
margin-bottom: 10px;
}
.error-container p {
color: #666;
margin-bottom: 30px;
}
</style>
</head>
<body>
<!-- Modern Navigation -->
<nav class="modern-navbar">
<div class="navbar-wrapper">
<div class="navbar-brand">
<a href="/home.html" class="brand-link">
<img
src="/uploads/images/8ba675b9-c4e6-41e6-8f14-382b9ee1d019.jpg"
alt="Sky Art Shop Logo"
class="brand-logo"
/>
<span class="brand-name">Sky Art Shop</span>
</a>
</div>
<div class="navbar-menu">
<ul class="nav-menu-list">
<li class="nav-item">
<a href="/home.html" class="nav-link">Home</a>
</li>
<li class="nav-item">
<a href="/shop.html" class="nav-link">Shop</a>
</li>
<li class="nav-item">
<a href="/portfolio.html" class="nav-link">Portfolio</a>
</li>
<li class="nav-item">
<a href="/about.html" class="nav-link">About</a>
</li>
<li class="nav-item">
<a href="/contact.html" class="nav-link">Contact</a>
</li>
</ul>
</div>
<div class="navbar-actions">
<a href="/shop.html" class="btn-cart">
<i class="bi bi-cart3"></i>
<span class="cart-count">0</span>
</a>
</div>
</div>
</nav>
<div class="page-container" id="pageContainer">
<div class="loading-container">
<div class="loading-spinner"></div>
<p>Loading page...</p>
</div>
</div>
<!-- Footer -->
<footer class="site-footer">
<div class="footer-content">
<div class="footer-section">
<h4>Sky Art Shop</h4>
<p>
Quality scrapbooking, journaling, and crafting supplies for creative
minds.
</p>
</div>
<div class="footer-section">
<h4>Quick Links</h4>
<ul>
<li><a href="/home.html">Home</a></li>
<li><a href="/shop.html">Shop</a></li>
<li><a href="/portfolio.html">Portfolio</a></li>
<li><a href="/about.html">About</a></li>
<li><a href="/contact.html">Contact</a></li>
</ul>
</div>
<div class="footer-section">
<h4>Follow Us</h4>
<div class="social-links">
<a href="#"><i class="bi bi-facebook"></i></a>
<a href="#"><i class="bi bi-instagram"></i></a>
<a href="#"><i class="bi bi-pinterest"></i></a>
</div>
</div>
</div>
<div class="footer-bottom">
<p>&copy; 2025 Sky Art Shop. All rights reserved.</p>
</div>
</footer>
<script>
// Get slug from URL parameter
const urlParams = new URLSearchParams(window.location.search);
const pageSlug = urlParams.get("slug");
if (!pageSlug) {
showError("No page specified");
} else {
loadPage(pageSlug);
}
async function loadPage(slug) {
try {
const response = await fetch(`/api/pages/${slug}`);
const data = await response.json();
if (data.success && data.page) {
displayPage(data.page);
} else {
showError("Page not found");
}
} catch (error) {
console.error("Failed to load page:", error);
showError("Failed to load page");
}
}
function displayPage(page) {
// Update page title and meta
document.getElementById("pageTitle").textContent =
page.metatitle || page.title + " - Sky Art Shop";
document.getElementById("pageDescription").content =
page.metadescription || page.title;
// Display page content
const container = document.getElementById("pageContainer");
container.innerHTML = `
<div class="page-header">
<h1>${escapeHtml(page.title)}</h1>
</div>
<div class="page-content">
${page.content || "<p>No content available.</p>"}
</div>
`;
}
function showError(message) {
const container = document.getElementById("pageContainer");
container.innerHTML = `
<div class="error-container">
<i class="bi bi-exclamation-triangle"></i>
<h2>Oops! Something went wrong</h2>
<p>${escapeHtml(message)}</p>
<a href="/home.html" class="btn btn-primary">
<i class="bi bi-house"></i> Back to Home
</a>
</div>
`;
}
function escapeHtml(text) {
const map = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#039;",
};
return text.replace(/[&<>"']/g, (m) => map[m]);
}
</script>
</body>
</html>

View File

@@ -233,55 +233,190 @@
</div>
</footer>
<!-- Project Modal -->
<div
id="projectModal"
style="
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.85);
z-index: 9999;
overflow: hidden;
padding: 0;
"
>
<div
style="
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 90%;
max-width: 900px;
max-height: 90vh;
background: white;
border-radius: 20px;
overflow: hidden;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
display: flex;
flex-direction: column;
"
>
<button
onclick="closeProjectModal()"
style="
position: absolute;
top: 20px;
right: 20px;
background: white;
border: none;
width: 44px;
height: 44px;
border-radius: 50%;
cursor: pointer;
font-size: 20px;
display: flex;
align-items: center;
justify-content: center;
z-index: 10;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
transition: all 0.2s;
"
onmouseover="this.style.transform='scale(1.1)'; this.style.background='#f8f9fa';"
onmouseout="this.style.transform='scale(1)'; this.style.background='white';"
>
<i class="bi bi-x-lg"></i>
</button>
<div
id="modalContent"
style="
overflow-y: auto;
overflow-x: hidden;
flex: 1;
scroll-behavior: smooth;
"
></div>
</div>
</div>
<script src="/assets/js/page-transitions.js"></script>
<script src="/assets/js/main.js"></script>
<script src="/assets/js/navigation.js"></script>
<script src="/assets/js/cart.js"></script>
<script src="/assets/js/shopping.js"></script>
<script>
let portfolioProjects = [];
// Open project modal
function openProjectModal(projectId) {
const project = portfolioProjects.find((p) => p.id === projectId);
if (!project) return;
const modal = document.getElementById("projectModal");
const modalContent = document.getElementById("modalContent");
modalContent.innerHTML = `
<div class="project-image" style="width: 100%; height: 450px; overflow: hidden; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); flex-shrink: 0;">
<img src="${project.imageurl || "/assets/images/placeholder.jpg"}"
alt="${project.title}"
style="width: 100%; height: 100%; object-fit: cover;" />
</div>
<div style="padding: 40px; background: white;">
${
project.category
? `<span style="display: inline-block; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 8px 18px; border-radius: 24px; font-size: 13px; font-weight: 600; margin-bottom: 24px; letter-spacing: 0.5px; text-transform: uppercase;">${project.category}</span>`
: ""
}
<h2 style="font-size: 36px; font-weight: 700; margin: 0 0 24px 0; color: #1a1a1a; line-height: 1.2;">${
project.title
}</h2>
<div style="color: #555; font-size: 17px; line-height: 1.9; margin-bottom: 32px; font-weight: 400;">
${project.description || "No description available."}
</div>
<div style="padding-top: 24px; border-top: 2px solid #f0f0f0; color: #888; font-size: 15px; display: flex; align-items: center; gap: 8px;">
<i class="bi bi-calendar3" style="font-size: 18px;"></i>
<span style="font-weight: 500;">Created on ${new Date(
project.createdat
).toLocaleDateString("en-US", {
year: "numeric",
month: "long",
day: "numeric",
})}</span>
</div>
</div>
`;
modal.style.display = "block";
modalContent.scrollTop = 0;
document.body.style.overflow = "hidden";
}
// Close project modal
function closeProjectModal() {
document.getElementById("projectModal").style.display = "none";
document.body.style.overflow = "auto";
}
// Close modal on outside click
document.addEventListener("click", (e) => {
const modal = document.getElementById("projectModal");
if (e.target === modal) {
closeProjectModal();
}
});
// Close modal on Escape key
document.addEventListener("keydown", (e) => {
if (e.key === "Escape") {
closeProjectModal();
}
});
// Load portfolio projects from API
async function loadPortfolio() {
try {
const response = await fetch("/api/portfolio/projects");
if (response.ok) {
const data = await response.json();
const projects = data.projects || [];
portfolioProjects = data.projects || [];
document.getElementById("loadingMessage").style.display = "none";
if (projects.length === 0) {
if (portfolioProjects.length === 0) {
document.getElementById("noProjects").style.display = "block";
return;
}
const grid = document.getElementById("portfolioGrid");
grid.innerHTML = projects
grid.innerHTML = portfolioProjects
.map(
(project) => `
<div class="product-card" style="background: white; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); transition: transform 0.3s;">
<div class="product-card" onclick="openProjectModal('${
project.id
}')" style="background: white; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); transition: all 0.3s; cursor: pointer;">
<div class="product-image" style="position: relative; padding-top: 100%; overflow: hidden; background: #f5f5f5;">
<img src="${
project.imageurl || "/assets/images/placeholder.jpg"
}"
alt="${project.title}"
style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover;"
loading="lazy" />
style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s;"
loading="lazy"
onmouseover="this.style.transform='scale(1.05)'"
onmouseout="this.style.transform='scale(1)'" />
${
project.category
? `<span style="position: absolute; top: 10px; right: 10px; background: rgba(102, 126, 234, 0.9); color: white; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 500;">${project.category}</span>`
: ""
}
</div>
<div style="padding: 20px;">
<h3 style="font-size: 18px; font-weight: 600; margin-bottom: 10px; color: #333;">${
<div style="padding: 20px; text-align: center;">
<h3 style="font-size: 18px; font-weight: 600; margin: 0; color: #333;">${
project.title
}</h3>
<p style="color: #666; font-size: 14px; line-height: 1.6; margin: 0;">${
project.description || ""
}</p>
<div style="margin-top: 15px; padding-top: 15px; border-top: 1px solid #eee; color: #999; font-size: 12px;">
<i class="bi bi-calendar"></i> ${new Date(
project.createdat
).toLocaleDateString()}
</div>
</div>
</div>
`

334
website/public/privacy.html Normal file
View File

@@ -0,0 +1,334 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Privacy Policy - Sky Art Shop</title>
<meta name="description" content="Sky Art Shop Privacy Policy" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;600;700&display=swap"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css"
/>
<link rel="stylesheet" href="/assets/css/main.css" />
<link rel="stylesheet" href="/assets/css/navbar.css" />
<link rel="stylesheet" href="/assets/css/shopping.css" />
<style>
.privacy-hero {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
padding: 80px 0 60px;
color: white;
text-align: center;
}
.privacy-hero h1 {
font-size: 2.5rem;
margin-bottom: 16px;
font-weight: 700;
}
.privacy-hero p {
font-size: 1.1rem;
color: rgba(255, 255, 255, 0.9);
max-width: 600px;
margin: 0 auto;
}
.privacy-content {
padding: 60px 0;
background: white;
}
.privacy-text {
max-width: 900px;
margin: 0 auto;
background: #fff;
padding: 40px;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
line-height: 1.8;
}
.privacy-text h2 {
color: #333;
margin-top: 30px;
margin-bottom: 15px;
font-weight: 600;
}
.privacy-text h3 {
color: #555;
margin-top: 25px;
margin-bottom: 12px;
font-weight: 600;
}
.privacy-text p {
color: #666;
margin-bottom: 15px;
}
.privacy-text ul {
margin-bottom: 20px;
padding-left: 30px;
}
.privacy-text li {
margin-bottom: 8px;
color: #666;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<!-- Modern Navigation -->
<nav class="modern-navbar">
<div class="navbar-wrapper">
<div class="navbar-brand">
<a href="/home.html" class="brand-link">
<img
src="/uploads/images/8ba675b9-c4e6-41e6-8f14-382b9ee1d019.jpg"
alt="Sky Art Shop Logo"
class="brand-logo"
/>
<span class="brand-name">Sky Art Shop</span>
</a>
</div>
<div class="navbar-menu">
<ul class="nav-menu-list">
<li class="nav-item">
<a href="/home.html" class="nav-link">Home</a>
</li>
<li class="nav-item">
<a href="/shop.html" class="nav-link">Shop</a>
</li>
<li class="nav-item">
<a href="/portfolio.html" class="nav-link">Portfolio</a>
</li>
<li class="nav-item">
<a href="/about.html" class="nav-link">About</a>
</li>
<li class="nav-item">
<a href="/blog.html" class="nav-link">Blog</a>
</li>
<li class="nav-item">
<a href="/contact.html" class="nav-link">Contact</a>
</li>
</ul>
</div>
<div class="navbar-actions">
<div class="action-item wishlist-dropdown-wrapper">
<button
class="action-btn"
id="wishlistToggle"
aria-label="Wishlist"
>
<i class="bi bi-heart"></i>
<span class="action-badge" id="wishlistCount">0</span>
</button>
<div class="action-dropdown wishlist-dropdown" id="wishlistPanel">
<div class="dropdown-head">
<h3>My Wishlist</h3>
<button class="dropdown-close" id="wishlistClose">
<i class="bi bi-x-lg"></i>
</button>
</div>
<div class="dropdown-body" id="wishlistContent">
<p class="empty-state">Your wishlist is empty</p>
</div>
<div class="dropdown-foot">
<a href="/shop.html" class="btn-outline">Continue Shopping</a>
</div>
</div>
</div>
<div class="action-item cart-dropdown-wrapper">
<button
class="action-btn"
id="cartToggle"
aria-label="Shopping Cart"
>
<i class="bi bi-cart3"></i>
<span class="action-badge" id="cartCount">0</span>
</button>
<div class="action-dropdown cart-dropdown" id="cartPanel">
<div class="dropdown-head">
<h3>Shopping Cart</h3>
<button class="dropdown-close" id="cartClose">
<i class="bi bi-x-lg"></i>
</button>
</div>
<div class="dropdown-body" id="cartContent">
<p class="empty-state">Your cart is empty</p>
</div>
<div class="dropdown-foot">
<div class="cart-summary">
<span class="summary-label">Subtotal:</span>
<span class="summary-value" id="cartSubtotal">$0.00</span>
</div>
<a href="/checkout.html" class="btn-primary-full"
>Proceed to Checkout</a
>
<a href="/shop.html" class="btn-text">Continue Shopping</a>
</div>
</div>
</div>
<button class="mobile-toggle" id="mobileMenuToggle" aria-label="Menu">
<span class="toggle-line"></span>
<span class="toggle-line"></span>
<span class="toggle-line"></span>
</button>
</div>
</div>
<div class="mobile-menu" id="mobileMenu">
<div class="mobile-menu-header">
<span class="mobile-brand">Sky Art Shop</span>
<button class="mobile-close" id="mobileMenuClose">
<i class="bi bi-x-lg"></i>
</button>
</div>
<ul class="mobile-menu-list">
<li><a href="/home.html" class="mobile-link">Home</a></li>
<li><a href="/shop.html" class="mobile-link">Shop</a></li>
<li><a href="/portfolio.html" class="mobile-link">Portfolio</a></li>
<li><a href="/about.html" class="mobile-link">About</a></li>
<li><a href="/blog.html" class="mobile-link">Blog</a></li>
<li><a href="/contact.html" class="mobile-link">Contact</a></li>
</ul>
</div>
</nav>
<section class="privacy-hero">
<div class="container">
<h1>Privacy Policy</h1>
<p>Your privacy is important to us</p>
</div>
</section>
<section class="privacy-content">
<div class="container">
<div class="privacy-text" id="privacyContent">
<div style="text-align: center; padding: 40px">
<div
class="loading-spinner"
style="
border: 4px solid #f3f3f3;
border-top: 4px solid #667eea;
border-radius: 50%;
width: 50px;
height: 50px;
animation: spin 1s linear infinite;
margin: 0 auto 20px;
"
></div>
<p>Loading privacy policy...</p>
</div>
</div>
</div>
</section>
<footer class="footer">
<div class="container">
<div class="footer-grid">
<div class="footer-col">
<h3 class="footer-title">Sky Art Shop</h3>
<p class="footer-text">
Your destination for unique art pieces and creative supplies.
</p>
<div class="social-links">
<a href="#" class="social-link"><i class="bi bi-facebook"></i></a>
<a href="#" class="social-link"
><i class="bi bi-instagram"></i
></a>
<a href="#" class="social-link"><i class="bi bi-twitter"></i></a>
<a href="#" class="social-link"
><i class="bi bi-pinterest"></i
></a>
</div>
</div>
<div class="footer-col">
<h4 class="footer-heading">Shop</h4>
<ul class="footer-links">
<li><a href="/shop.html">All Products</a></li>
<li><a href="/shop.html?category=paintings">Paintings</a></li>
<li><a href="/shop.html?category=prints">Prints</a></li>
<li><a href="/shop.html?category=supplies">Art Supplies</a></li>
</ul>
</div>
<div class="footer-col">
<h4 class="footer-heading">About</h4>
<ul class="footer-links">
<li><a href="/about.html">Our Story</a></li>
<li><a href="/portfolio.html">Portfolio</a></li>
<li><a href="/blog.html">Blog</a></li>
<li><a href="/contact.html">Contact</a></li>
</ul>
</div>
<div class="footer-col">
<h4 class="footer-heading">Customer Service</h4>
<ul class="footer-links">
<li><a href="#">Shipping Info</a></li>
<li><a href="#">Returns</a></li>
<li><a href="#">FAQ</a></li>
<li><a href="/privacy.html">Privacy Policy</a></li>
</ul>
</div>
</div>
<div class="footer-bottom">
<p>&copy; 2025 Sky Art Shop. All rights reserved.</p>
</div>
</div>
</footer>
<script src="/assets/js/page-transitions.js"></script>
<script src="/assets/js/main.js"></script>
<script src="/assets/js/navigation.js"></script>
<script src="/assets/js/cart.js"></script>
<script src="/assets/js/shopping.js"></script>
<script>
// Load privacy policy content from API
async function loadPrivacyContent() {
try {
const response = await fetch("/api/pages/privacy");
const data = await response.json();
if (data.success && data.page) {
const contentDiv = document.getElementById("privacyContent");
contentDiv.innerHTML =
data.page.content || "<p>Content not available.</p>";
// Update meta tags if available
if (data.page.metatitle) {
document.title = data.page.metatitle;
}
if (data.page.metadescription) {
const metaDesc = document.querySelector(
'meta[name="description"]'
);
if (metaDesc) {
metaDesc.content = data.page.metadescription;
}
}
} else {
document.getElementById("privacyContent").innerHTML =
"<p>Unable to load content.</p>";
}
} catch (error) {
console.error("Error loading privacy content:", error);
document.getElementById("privacyContent").innerHTML =
"<p>Error loading content.</p>";
}
}
// Load content when page loads
document.addEventListener("DOMContentLoaded", loadPrivacyContent);
</script>
</body>
</html>

View File

@@ -1,50 +1,78 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Product Details - Sky Art Shop</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" />
<link rel="stylesheet" href="/assets/css/main.css" />
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Product Details - Sky Art Shop</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;600;700&display=swap"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css"
/>
<link rel="stylesheet" href="/assets/css/main.css" />
<link rel="stylesheet" href="/assets/css/navbar.css" />
<link rel="stylesheet" href="/assets/css/shopping.css" />
<link rel="stylesheet" href="/assets/css/shopping.css" />
</head>
<link rel="stylesheet" href="/assets/css/shopping.css" />
</head>
<body>
<!-- Modern Navigation -->
<nav class="modern-navbar">
<div class="navbar-wrapper">
<div class="navbar-brand">
<a href="/home.html" class="brand-link">
<img src="/uploads/images/8ba675b9-c4e6-41e6-8f14-382b9ee1d019.jpg" alt="Sky Art Shop Logo" class="brand-logo" />
<img
src="/uploads/images/8ba675b9-c4e6-41e6-8f14-382b9ee1d019.jpg"
alt="Sky Art Shop Logo"
class="brand-logo"
/>
<span class="brand-name">Sky Art Shop</span>
</a>
</div>
<div class="navbar-menu">
<ul class="nav-menu-list">
<li class="nav-item"><a href="/home.html" class="nav-link">Home</a></li>
<li class="nav-item"><a href="/shop.html" class="nav-link">Shop</a></li>
<li class="nav-item"><a href="/portfolio.html" class="nav-link">Portfolio</a></li>
<li class="nav-item"><a href="/about.html" class="nav-link">About</a></li>
<li class="nav-item"><a href="/blog.html" class="nav-link">Blog</a></li>
<li class="nav-item"><a href="/contact.html" class="nav-link">Contact</a></li>
<li class="nav-item">
<a href="/home.html" class="nav-link">Home</a>
</li>
<li class="nav-item">
<a href="/shop.html" class="nav-link">Shop</a>
</li>
<li class="nav-item">
<a href="/portfolio.html" class="nav-link">Portfolio</a>
</li>
<li class="nav-item">
<a href="/about.html" class="nav-link">About</a>
</li>
<li class="nav-item">
<a href="/blog.html" class="nav-link">Blog</a>
</li>
<li class="nav-item">
<a href="/contact.html" class="nav-link">Contact</a>
</li>
</ul>
</div>
<div class="navbar-actions">
<div class="action-item wishlist-dropdown-wrapper">
<button class="action-btn" id="wishlistToggle" aria-label="Wishlist">
<button
class="action-btn"
id="wishlistToggle"
aria-label="Wishlist"
>
<i class="bi bi-heart"></i>
<span class="action-badge" id="wishlistCount">0</span>
</button>
<div class="action-dropdown wishlist-dropdown" id="wishlistPanel">
<div class="dropdown-head">
<h3>My Wishlist</h3>
<button class="dropdown-close" id="wishlistClose"><i class="bi bi-x-lg"></i></button>
<button class="dropdown-close" id="wishlistClose">
<i class="bi bi-x-lg"></i>
</button>
</div>
<div class="dropdown-body" id="wishlistContent">
<p class="empty-state">Your wishlist is empty</p>
@@ -54,16 +82,22 @@
</div>
</div>
</div>
<div class="action-item cart-dropdown-wrapper">
<button class="action-btn" id="cartToggle" aria-label="Shopping Cart">
<button
class="action-btn"
id="cartToggle"
aria-label="Shopping Cart"
>
<i class="bi bi-cart3"></i>
<span class="action-badge" id="cartCount">0</span>
</button>
<div class="action-dropdown cart-dropdown" id="cartPanel">
<div class="dropdown-head">
<h3>Shopping Cart</h3>
<button class="dropdown-close" id="cartClose"><i class="bi bi-x-lg"></i></button>
<button class="dropdown-close" id="cartClose">
<i class="bi bi-x-lg"></i>
</button>
</div>
<div class="dropdown-body" id="cartContent">
<p class="empty-state">Your cart is empty</p>
@@ -73,12 +107,14 @@
<span class="summary-label">Subtotal:</span>
<span class="summary-value" id="cartSubtotal">$0.00</span>
</div>
<a href="/checkout.html" class="btn-primary-full">Proceed to Checkout</a>
<a href="/checkout.html" class="btn-primary-full"
>Proceed to Checkout</a
>
<a href="/shop.html" class="btn-text">Continue Shopping</a>
</div>
</div>
</div>
<button class="mobile-toggle" id="mobileMenuToggle" aria-label="Menu">
<span class="toggle-line"></span>
<span class="toggle-line"></span>
@@ -86,11 +122,13 @@
</button>
</div>
</div>
<div class="mobile-menu" id="mobileMenu">
<div class="mobile-menu-header">
<span class="mobile-brand">Sky Art Shop</span>
<button class="mobile-close" id="mobileMenuClose"><i class="bi bi-x-lg"></i></button>
<button class="mobile-close" id="mobileMenuClose">
<i class="bi bi-x-lg"></i>
</button>
</div>
<ul class="mobile-menu-list">
<li><a href="/home.html" class="mobile-link">Home</a></li>
@@ -102,36 +140,193 @@
</ul>
</div>
</nav>
<div id="loading" style="text-align: center; padding: 100px 20px; font-size: 18px; color: #6b7280;">
<i class="bi bi-hourglass-split" style="font-size: 48px; display: block; margin-bottom: 20px;"></i>
Loading product...
</div>
<div id="productDetail" style="display: none;"></div>
<script src="/assets/js/shopping.js"></script>
<script>
async function loadProduct() {
const params = new URLSearchParams(window.location.search);
const productId = params.get('id');
if (!productId) {
document.getElementById('loading').innerHTML = '<p>Product not found</p><a href="/shop.html">Back to Shop</a>';
return;
}
try {
const response = await fetch(`/api/products/${productId}`);
const data = await response.json();
if (!data.success || !data.product) {
throw new Error('Product not found');
<div
id="loading"
style="
text-align: center;
padding: 100px 20px;
font-size: 18px;
color: #6b7280;
"
>
<i
class="bi bi-hourglass-split"
style="font-size: 48px; display: block; margin-bottom: 20px"
></i>
Loading product...
</div>
<div id="productDetail" style="display: none"></div>
<script src="/assets/js/page-transitions.js"></script>
<script src="/assets/js/main.js"></script>
<script src="/assets/js/navigation.js"></script>
<script src="/assets/js/cart.js"></script>
<script src="/assets/js/shopping.js"></script>
<script>
// Function to change primary image
function changePrimaryImage(imageUrl) {
const primaryImg = document.getElementById("primaryImage");
if (primaryImg) {
primaryImg.src = imageUrl;
}
const product = data.product;
document.title = `${product.name} - Sky Art Shop`;
document.getElementById('productDetail').innerHTML = `
// Update gallery thumbnails border
const galleryImages = document.querySelectorAll(
'[onclick^="changePrimaryImage"]'
);
galleryImages.forEach((img) => {
if (img.src.includes(imageUrl)) {
img.style.border = "3px solid #6b46c1";
} else {
img.style.border = "1px solid #e5e7eb";
}
});
}
async function loadProduct() {
const params = new URLSearchParams(window.location.search);
const productId = params.get("id");
if (!productId) {
document.getElementById("loading").innerHTML =
'<p>Product not found</p><a href="/shop.html">Back to Shop</a>';
return;
}
try {
const response = await fetch(`/api/products/${productId}`);
const data = await response.json();
if (!data.success || !data.product) {
throw new Error("Product not found");
}
const product = data.product;
document.title = `${product.name} - Sky Art Shop`;
// Get primary image or first image from images array
let primaryImage = "/assets/images/placeholder.jpg";
let imageGallery = [];
if (
product.images &&
Array.isArray(product.images) &&
product.images.length > 0
) {
// Find primary image
const primary = product.images.find((img) => img.is_primary);
if (primary) {
primaryImage = primary.image_url;
} else {
primaryImage = product.images[0].image_url;
}
imageGallery = product.images;
}
// Build image gallery HTML
let galleryHTML = "";
if (imageGallery.length > 0) {
galleryHTML = `
<div style="display: flex; gap: 12px; margin-top: 16px; overflow-x: auto; padding: 8px 0;">
${imageGallery
.map(
(img, idx) => `
<img src="${img.image_url}"
alt="${img.alt_text || product.name}"
onclick="changePrimaryImage('${img.image_url}')"
style="width: 80px; height: 80px; object-fit: cover; border-radius: 8px; cursor: pointer; border: ${
img.image_url === primaryImage
? "3px solid #6b46c1"
: "1px solid #e5e7eb"
};"
onerror="this.src='/assets/images/placeholder.jpg'" />
`
)
.join("")}
</div>
`;
}
// Build product details HTML
let detailsHTML = "";
if (
product.sku ||
product.weight ||
product.dimensions ||
product.material
) {
detailsHTML = `
<div style="margin-bottom: 24px; padding: 20px; background: #f9fafb; border-radius: 8px;">
<h3 style="font-size: 16px; font-weight: 600; color: #1a1a1a; margin-bottom: 16px;">Product Details</h3>
${
product.sku
? `
<p style="margin-bottom: 8px; color: #6b7280;">
<span style="font-weight: 500;">SKU:</span> ${product.sku}
</p>
`
: ""
}
${
product.weight
? `
<p style="margin-bottom: 8px; color: #6b7280;">
<span style="font-weight: 500;">Weight:</span> ${product.weight}
</p>
`
: ""
}
${
product.dimensions
? `
<p style="margin-bottom: 8px; color: #6b7280;">
<span style="font-weight: 500;">Dimensions:</span> ${product.dimensions}
</p>
`
: ""
}
${
product.material
? `
<p style="margin-bottom: 8px; color: #6b7280;">
<span style="font-weight: 500;">Material:</span> ${product.material}
</p>
`
: ""
}
</div>
`;
}
// Build badges HTML
let badgesHTML = "";
if (product.isfeatured || product.isbestseller) {
badgesHTML = `
<div style="display: flex; gap: 8px; margin-bottom: 16px;">
${
product.isfeatured
? `
<span style="display: inline-block; padding: 6px 12px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border-radius: 6px; font-size: 12px; font-weight: 600;">
<i class="bi bi-star-fill"></i> Featured
</span>
`
: ""
}
${
product.isbestseller
? `
<span style="display: inline-block; padding: 6px 12px; background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); color: white; border-radius: 6px; font-size: 12px; font-weight: 600;">
<i class="bi bi-trophy-fill"></i> Best Seller
</span>
`
: ""
}
</div>
`;
}
document.getElementById("productDetail").innerHTML = `
<div style="font-family: 'Roboto', sans-serif;">
<nav style="background: white; padding: 16px 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.1);">
<div style="max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 20px;">
@@ -147,56 +342,106 @@
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 60px; margin-bottom: 60px;">
<div>
<div style="background: white; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 6px rgba(0,0,0,0.1);">
<img src="${product.imageurl || '/assets/images/placeholder.jpg'}"
<img id="primaryImage"
src="${primaryImage}"
alt="${product.name}"
style="width: 100%; height: auto; display: block;"
onerror="this.src='/assets/images/placeholder.jpg'" />
</div>
${galleryHTML}
${
imageGallery.length > 0 &&
imageGallery.some((img) => img.color_variant)
? `
<div style="margin-top: 16px;">
<p style="font-size: 14px; font-weight: 500; color: #6b7280; margin-bottom: 8px;">Available Colors:</p>
<div style="display: flex; gap: 8px; flex-wrap: wrap;">
${imageGallery
.filter((img) => img.color_variant)
.map(
(img) => `
<span style="display: inline-block; padding: 6px 12px; background: #f3f4f6; border-radius: 6px; font-size: 13px; color: #1a1a1a;">
${img.color_variant}
</span>
`
)
.join("")}
</div>
</div>
`
: ""
}
</div>
<div style="padding: 20px 0;">
<h1 style="font-size: 36px; font-weight: 700; color: #1a1a1a; margin: 0 0 16px 0; line-height: 1.2;">${product.name}</h1>
${badgesHTML}
<h1 style="font-size: 36px; font-weight: 700; color: #1a1a1a; margin: 0 0 16px 0; line-height: 1.2;">${
product.name
}</h1>
<div style="display: flex; align-items: baseline; gap: 16px; margin-bottom: 24px;">
<p style="font-size: 36px; font-weight: 700; color: #6b46c1; margin: 0;">$${parseFloat(product.price).toFixed(2)}</p>
${product.stockquantity > 0 ?
`<span style="color: #10b981; font-weight: 500;">In Stock (${product.stockquantity} available)</span>` :
`<span style="color: #ef4444; font-weight: 500;">Out of Stock</span>`
<p style="font-size: 36px; font-weight: 700; color: #6b46c1; margin: 0;">$${parseFloat(
product.price
).toFixed(2)}</p>
${
product.stockquantity > 0
? `<span style="color: #10b981; font-weight: 500;">In Stock (${product.stockquantity} available)</span>`
: `<span style="color: #ef4444; font-weight: 500;">Out of Stock</span>`
}
</div>
${product.shortdescription ? `
${
product.shortdescription
? `
<p style="font-size: 18px; color: #4b5563; line-height: 1.6; margin-bottom: 24px;">${product.shortdescription}</p>
` : ''}
`
: ""
}
${product.description ? `
<div style="margin-bottom: 32px;">
${
product.description
? `
<div style="margin-bottom: 24px;">
<h3 style="font-size: 18px; font-weight: 600; color: #1a1a1a; margin-bottom: 12px;">Description</h3>
<p style="color: #6b7280; line-height: 1.7;">${product.description}</p>
<div style="color: #6b7280; line-height: 1.7;">${product.description}</div>
</div>
` : ''}
`
: ""
}
${product.category ? `
${
product.category
? `
<p style="margin-bottom: 16px;">
<span style="font-weight: 500; color: #6b7280;">Category:</span>
<span style="display: inline-block; margin-left: 8px; padding: 4px 12px; background: #f3f4f6; border-radius: 6px; font-size: 14px;">${product.category}</span>
</p>
` : ''}
`
: ""
}
${product.color ? `
<p style="margin-bottom: 24px;">
<span style="font-weight: 500; color: #6b7280;">Color:</span>
<span style="margin-left: 8px;">${product.color}</span>
</p>
` : ''}
${detailsHTML}
<div style="display: flex; gap: 12px; margin-top: 32px;">
<button onclick="addToCart()"
style="flex: 1; padding: 16px 32px; background: #6b46c1; color: white; border: none; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer; transition: background 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px;"
onmouseover="this.style.background='#5936a3'"
onmouseout="this.style.background='#6b46c1'">
${product.stockquantity <= 0 ? "disabled" : ""}
style="flex: 1; padding: 16px 32px; background: ${
product.stockquantity <= 0 ? "#9ca3af" : "#6b46c1"
}; color: white; border: none; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: ${
product.stockquantity <= 0 ? "not-allowed" : "pointer"
}; transition: background 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px;"
onmouseover="if(${
product.stockquantity > 0
}) this.style.background='#5936a3'"
onmouseout="if(${
product.stockquantity > 0
}) this.style.background='#6b46c1'">
<i class="bi bi-cart-plus" style="font-size: 20px;"></i>
Add to Cart
${
product.stockquantity <= 0
? "Out of Stock"
: "Add to Cart"
}
</button>
<button onclick="addToWishlist()"
style="width: 56px; padding: 16px; background: transparent; color: #6b46c1; border: 2px solid #6b46c1; border-radius: 8px; font-size: 20px; cursor: pointer; transition: all 0.2s;"
@@ -214,32 +459,32 @@
</div>
</div>
`;
document.getElementById('loading').style.display = 'none';
document.getElementById('productDetail').style.display = 'block';
// Store product data
window.currentProduct = product;
} catch (error) {
console.error('Error loading product:', error);
document.getElementById('loading').innerHTML = '<p style="color: #ef4444;">Error loading product</p><a href="/shop.html" style="color: #6b46c1; text-decoration: none; font-weight: 500;">Back to Shop</a>';
document.getElementById("loading").style.display = "none";
document.getElementById("productDetail").style.display = "block";
// Store product data
window.currentProduct = product;
} catch (error) {
console.error("Error loading product:", error);
document.getElementById("loading").innerHTML =
'<p style="color: #ef4444;">Error loading product</p><a href="/shop.html" style="color: #6b46c1; text-decoration: none; font-weight: 500;">Back to Shop</a>';
}
}
}
function addToCart() {
if (window.currentProduct && window.shoppingManager) {
shoppingManager.addToCart(window.currentProduct, 1);
function addToCart() {
if (window.currentProduct && window.shoppingManager) {
shoppingManager.addToCart(window.currentProduct, 1);
}
}
}
function addToWishlist() {
if (window.currentProduct && window.shoppingManager) {
shoppingManager.addToWishlist(window.currentProduct);
function addToWishlist() {
if (window.currentProduct && window.shoppingManager) {
shoppingManager.addToWishlist(window.currentProduct);
}
}
}
loadProduct();
</script>
</body>
loadProduct();
</script>
</body>
</html>

View File

@@ -216,6 +216,7 @@
border-radius: 12px;
overflow: hidden;
transition: all 0.3s;
position: relative;
}
.product-card:hover {
@@ -223,6 +224,42 @@
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}
.product-badges {
position: absolute;
top: 12px;
left: 12px;
z-index: 10;
display: flex;
flex-direction: column;
gap: 6px;
}
.badge-featured {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 6px 10px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border-radius: 6px;
font-size: 11px;
font-weight: 600;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.badge-bestseller {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 6px 10px;
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
color: white;
border-radius: 6px;
font-size: 11px;
font-weight: 600;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.product-link {
display: block;
text-decoration: none;
@@ -636,7 +673,9 @@
</div>
</footer>
<script src="/assets/js/page-transitions.js"></script>
<script src="/assets/js/main.js"></script>
<script src="/assets/js/navigation.js"></script>
<script src="/assets/js/cart.js"></script>
<script>
// Mobile Menu Toggle (Same as other pages)
@@ -693,58 +732,90 @@
noProducts.style.display = "none";
grid.innerHTML = products
.map(
(product) => `
.map((product) => {
// Get the primary image from images array
let productImage = "/assets/images/placeholder.jpg";
if (
product.images &&
Array.isArray(product.images) &&
product.images.length > 0
) {
// Find primary image or use first one
const primaryImg = product.images.find((img) => img.is_primary);
productImage = primaryImg
? primaryImg.image_url
: product.images[0].image_url;
} else if (product.imageurl) {
// Fallback to old imageurl field
productImage = product.imageurl;
}
// Build badges HTML
let badges = "";
if (product.isfeatured) {
badges +=
'<span class="badge-featured"><i class="bi bi-star-fill"></i> Featured</span>';
}
if (product.isbestseller) {
badges +=
'<span class="badge-bestseller"><i class="bi bi-trophy-fill"></i> Best Seller</span>';
}
return `
<div class="product-card">
<a href="/product.html?id=${
product.productid || product.id
}" class="product-link">
${badges ? `<div class="product-badges">${badges}</div>` : ""}
<a href="/product.html?id=${product.id}" class="product-link">
<div class="product-image">
<img src="${
product.imageurl || "/assets/images/placeholder.jpg"
}" alt="${
<img src="${productImage}" alt="${
product.name
}" loading="lazy" onerror="this.src='/assets/images/placeholder.jpg'" />
</div>
<h3>${product.name}</h3>
${
product.color
? `<span class="product-color-badge">${product.color}</span>`
: ""
}
${
product.shortdescription || product.description
? `<div class="product-description">${
product.shortdescription ||
product.description.substring(0, 100) + "..."
(product.description
? product.description.substring(0, 100) + "..."
: "")
}</div>`
: ""
}
<p class="price">$${parseFloat(product.price).toFixed(2)}</p>
${
product.stockquantity <= 0
? '<p style="color: #ef4444; font-size: 12px; margin: 8px 16px;">Out of Stock</p>'
: ""
}
</a>
<div style="display: flex; gap: 0.5rem; margin-top: 0.5rem;">
<div style="display: flex; gap: 0.5rem; margin: 0 16px 16px; padding-top: 8px;">
<button class="btn btn-small btn-icon"
onclick="addToWishlist('${
product.productid || product.id
onclick="event.stopPropagation(); addToWishlist('${
product.id
}', '${product.name.replace(/'/g, "\\'")}', ${
product.price
}, '${product.imageurl}')"
}, '${productImage.replace(/'/g, "\\'")}')"
aria-label="Add to wishlist">
<i class="bi bi-heart"></i>
</button>
<button class="btn btn-small btn-icon"
onclick="addToCart('${
product.productid || product.id
onclick="event.stopPropagation(); addToCart('${
product.id
}', '${product.name.replace(/'/g, "\\'")}', ${
product.price
}, '${product.imageurl}')"
aria-label="Add to cart">
}, '${productImage.replace(/'/g, "\\'")}')"
aria-label="Add to cart"
${
product.stockquantity <= 0
? 'disabled style="opacity: 0.5; cursor: not-allowed;"'
: ""
}>
<i class="bi bi-cart-plus"></i>
</button>
</div>
</div>
`
)
`;
})
.join("");
}

View File

@@ -0,0 +1,269 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Custom Pages Test - Sky Art Shop</title>
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css"
/>
<style>
body {
padding: 40px;
background: #f8f9fa;
}
.test-card {
background: white;
border-radius: 8px;
padding: 30px;
margin-bottom: 20px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.test-result {
padding: 15px;
border-radius: 6px;
margin-top: 15px;
font-family: monospace;
}
.success {
background: #d4edda;
color: #155724;
border: 1px solid #c3e6cb;
}
.error {
background: #f8d7da;
color: #721c24;
border: 1px solid #f5c6cb;
}
.page-list {
list-style: none;
padding: 0;
}
.page-list li {
padding: 10px;
border-bottom: 1px solid #eee;
display: flex;
justify-content: space-between;
align-items: center;
}
.page-list li:last-child {
border-bottom: none;
}
</style>
</head>
<body>
<div class="container">
<h1 class="mb-4">
<i class="bi bi-clipboard-check"></i> Custom Pages System Test
</h1>
<div class="test-card">
<h3><i class="bi bi-list-ul"></i> Available Custom Pages</h3>
<p class="text-muted">
These pages are published and visible on the frontend:
</p>
<ul class="page-list" id="pagesList">
<li class="text-center"><em>Loading...</em></li>
</ul>
</div>
<div class="test-card">
<h3><i class="bi bi-link-45deg"></i> Quick Links</h3>
<div class="d-grid gap-2">
<a href="/admin/pages.html" class="btn btn-primary" target="_blank">
<i class="bi bi-gear"></i> Open Admin Pages Manager
</a>
<button class="btn btn-success" onclick="createTestPage()">
<i class="bi bi-plus-circle"></i> Create Test Page
</button>
<button class="btn btn-info" onclick="loadPages()">
<i class="bi bi-arrow-clockwise"></i> Refresh Page List
</button>
</div>
</div>
<div class="test-card">
<h3><i class="bi bi-terminal"></i> API Response</h3>
<div
id="apiResponse"
class="test-result success"
style="display: none"
></div>
</div>
</div>
<script>
let pagesData = [];
document.addEventListener("DOMContentLoaded", function () {
loadPages();
});
async function loadPages() {
try {
const response = await fetch("/api/pages");
const data = await response.json();
if (data.success && data.pages) {
pagesData = data.pages;
displayPages(data.pages);
showResult(
"API Response: " + JSON.stringify(data, null, 2),
"success"
);
} else {
showResult(
"Failed to load pages: " + JSON.stringify(data),
"error"
);
}
} catch (error) {
showResult("Error loading pages: " + error.message, "error");
}
}
function displayPages(pages) {
const list = document.getElementById("pagesList");
if (pages.length === 0) {
list.innerHTML =
'<li class="text-center text-muted"><em>No published pages found</em></li>';
return;
}
list.innerHTML = pages
.map(
(page) => `
<li>
<div>
<strong>${escapeHtml(page.title)}</strong>
<br>
<small class="text-muted">Slug: ${escapeHtml(
page.slug
)} | Created: ${new Date(
page.createdat
).toLocaleDateString()}</small>
</div>
<div>
<a href="/page.html?slug=${encodeURIComponent(
page.slug
)}" class="btn btn-sm btn-outline-primary" target="_blank">
<i class="bi bi-eye"></i> View
</a>
</div>
</li>
`
)
.join("");
}
async function createTestPage() {
const title = "Test Page " + Date.now();
const slug = "test-page-" + Date.now();
const testContent = {
ops: [
{ insert: "Welcome to the Test Page", attributes: { header: 1 } },
{ insert: "\n\nThis is a test page created automatically. " },
{
insert: "It contains formatted text",
attributes: { bold: true },
},
{ insert: " with " },
{ insert: "different styles", attributes: { italic: true } },
{ insert: ".\n\n" },
{ insert: "Key Features:", attributes: { header: 2 } },
{ insert: "\n" },
{
insert: "Rich text editing with Quill",
attributes: { list: "bullet" },
},
{ insert: "\n" },
{ insert: "Create and edit pages", attributes: { list: "bullet" } },
{ insert: "\n" },
{ insert: "Delete pages", attributes: { list: "bullet" } },
{ insert: "\n" },
{ insert: "Display on frontend", attributes: { list: "bullet" } },
{ insert: "\n" },
],
};
const testHTML = `
<h1>Welcome to the Test Page</h1>
<p>This is a test page created automatically. <strong>It contains formatted text</strong> with <em>different styles</em>.</p>
<h2>Key Features:</h2>
<ul>
<li>Rich text editing with Quill</li>
<li>Create and edit pages</li>
<li>Delete pages</li>
<li>Display on frontend</li>
</ul>
`;
try {
// Note: This will fail without authentication
const response = await fetch("/api/admin/pages", {
method: "POST",
headers: { "Content-Type": "application/json" },
credentials: "include",
body: JSON.stringify({
title: title,
slug: slug,
content: JSON.stringify(testContent),
contenthtml: testHTML,
metatitle: title,
metadescription: "This is a test page",
ispublished: true,
}),
});
const data = await response.json();
if (data.success) {
showResult(
"Test page created successfully! ID: " + data.page.id,
"success"
);
loadPages();
} else {
showResult(
"Failed to create test page. You may need to be logged in as admin. Error: " +
(data.message || "Unknown error"),
"error"
);
}
} catch (error) {
showResult(
"Error creating test page: " +
error.message +
". Make sure you are logged in as admin.",
"error"
);
}
}
function showResult(message, type) {
const result = document.getElementById("apiResponse");
result.textContent = message;
result.className = "test-result " + type;
result.style.display = "block";
}
function escapeHtml(text) {
const map = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#039;",
};
return text.replace(/[&<>"']/g, (m) => map[m]);
}
</script>
</body>
</html>

View File

@@ -0,0 +1,249 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Backend-Frontend Data Sync Test</title>
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css"
/>
<style>
body {
padding: 40px;
background: #f8f9fa;
}
.test-card {
background: white;
border-radius: 8px;
padding: 30px;
margin-bottom: 20px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.status-badge {
display: inline-block;
padding: 8px 16px;
border-radius: 20px;
font-weight: 600;
font-size: 14px;
}
.status-success {
background: #d4edda;
color: #155724;
}
.status-info {
background: #d1ecf1;
color: #0c5460;
}
.preview-box {
background: #f8f9fa;
border: 2px solid #dee2e6;
border-radius: 8px;
padding: 20px;
margin-top: 15px;
max-height: 400px;
overflow-y: auto;
}
.step {
padding: 15px;
margin: 10px 0;
border-left: 4px solid #667eea;
background: #f8f9fa;
}
</style>
</head>
<body>
<div class="container">
<h1 class="mb-4">
<i class="bi bi-arrow-repeat"></i> Backend-Frontend Sync Test
</h1>
<div class="test-card">
<h3>
<i class="bi bi-check-circle-fill text-success"></i>
Data Communication Status
</h3>
<p class="text-muted mb-3">
Testing the connection between admin panel edits and frontend display
</p>
<div class="step">
<strong>Step 1:</strong> Open Admin Panel →
<a
href="/admin/pages.html"
target="_blank"
class="btn btn-sm btn-primary"
>
<i class="bi bi-gear"></i> Open Pages Admin
</a>
</div>
<div class="step">
<strong>Step 2:</strong> Click Edit on any page (About, Contact, or
Privacy)
</div>
<div class="step">
<strong>Step 3:</strong> Make a small change (e.g., update phone
number, add text)
</div>
<div class="step">
<strong>Step 4:</strong> Click "Save Page" in the admin modal
</div>
<div class="step">
<strong>Step 5:</strong> Return to this test page and click the
buttons below to verify
</div>
</div>
<div class="test-card">
<h3><i class="bi bi-eye"></i> Live Page Previews</h3>
<p class="text-muted">
View current content from database (click to refresh)
</p>
<div class="row g-3">
<div class="col-md-4">
<button
class="btn btn-outline-primary w-100"
onclick="testPage('about')"
>
<i class="bi bi-file-text"></i> Test About Page
</button>
<a href="/about.html" target="_blank" class="btn btn-link w-100"
>View Live →</a
>
</div>
<div class="col-md-4">
<button
class="btn btn-outline-primary w-100"
onclick="testPage('contact')"
>
<i class="bi bi-envelope"></i> Test Contact Page
</button>
<a href="/contact.html" target="_blank" class="btn btn-link w-100"
>View Live →</a
>
</div>
<div class="col-md-4">
<button
class="btn btn-outline-primary w-100"
onclick="testPage('privacy')"
>
<i class="bi bi-shield-check"></i> Test Privacy Page
</button>
<a href="/privacy.html" target="_blank" class="btn btn-link w-100"
>View Live →</a
>
</div>
</div>
<div id="previewContainer" style="display: none">
<hr class="my-4" />
<h4 id="previewTitle">Content Preview</h4>
<span class="status-badge status-success mb-3">
<i class="bi bi-check-circle"></i> Loaded from Database
</span>
<div class="preview-box" id="previewContent"></div>
</div>
</div>
<div class="test-card">
<h3><i class="bi bi-clipboard-data"></i> Test Results</h3>
<div id="testResults">
<p class="text-muted">
<i class="bi bi-info-circle"></i>
Click a test button above to check if data is syncing correctly
</p>
</div>
</div>
<div class="test-card">
<h3><i class="bi bi-lightbulb"></i> What Should Happen</h3>
<ul>
<li>
<strong>Edit in Admin</strong>: Changes saved to database
immediately
</li>
<li>
<strong>View on Frontend</strong>: Refresh page shows updated
content
</li>
<li>
<strong>No Cache Issues</strong>: Changes appear within seconds
</li>
<li>
<strong>All Sections Updated</strong>: Headers, paragraphs, lists
all reflect edits
</li>
</ul>
<div class="alert alert-info mt-3">
<i class="bi bi-info-circle-fill"></i>
<strong>Pro Tip:</strong> Keep this test page and the frontend page
open side-by-side. Edit in admin, save, then refresh the frontend page
to see changes instantly.
</div>
</div>
</div>
<script>
async function testPage(slug) {
const previewContainer = document.getElementById("previewContainer");
const previewTitle = document.getElementById("previewTitle");
const previewContent = document.getElementById("previewContent");
const testResults = document.getElementById("testResults");
previewContainer.style.display = "block";
previewTitle.textContent = `Loading ${slug} page...`;
previewContent.innerHTML =
'<div class="text-center"><div class="spinner-border" role="status"></div></div>';
try {
const response = await fetch(`/api/pages/${slug}`);
const data = await response.json();
if (data.success && data.page) {
previewTitle.textContent = `${data.page.title} - Content Preview`;
previewContent.innerHTML = data.page.content;
testResults.innerHTML = `
<div class="alert alert-success">
<h5><i class="bi bi-check-circle-fill"></i> ✓ Communication Working!</h5>
<p><strong>Page:</strong> ${data.page.title}</p>
<p><strong>Slug:</strong> ${data.page.slug}</p>
<p><strong>Content Length:</strong> ${data.page.content.length} characters</p>
<p class="mb-0"><strong>Status:</strong> Data successfully loaded from database</p>
<hr>
<small class="text-muted">
<i class="bi bi-info-circle"></i>
Any edits you make in the admin panel will be reflected here after saving and refreshing.
</small>
</div>
`;
} else {
throw new Error("Page not found");
}
} catch (error) {
previewContent.innerHTML = `
<div class="alert alert-danger">
<i class="bi bi-x-circle-fill"></i> Error loading content: ${error.message}
</div>
`;
testResults.innerHTML = `
<div class="alert alert-danger">
<h5><i class="bi bi-x-circle-fill"></i> ✗ Communication Error</h5>
<p>${error.message}</p>
</div>
`;
}
}
</script>
</body>
</html>

View File

@@ -0,0 +1,324 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Contact Page Structured Fields Test</title>
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css"
/>
<style>
body {
padding: 40px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
}
.test-container {
max-width: 1400px;
margin: 0 auto;
}
.test-card {
background: white;
border-radius: 16px;
padding: 30px;
margin-bottom: 20px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}
.success-badge {
display: inline-block;
background: #d4edda;
color: #155724;
padding: 8px 16px;
border-radius: 20px;
font-weight: 600;
margin: 5px;
}
.step {
background: #f8f9fa;
border-left: 4px solid #667eea;
padding: 15px;
margin: 10px 0;
border-radius: 4px;
}
.step strong {
color: #667eea;
}
.split-view {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
margin-top: 20px;
}
@media (max-width: 968px) {
.split-view {
grid-template-columns: 1fr;
}
}
.preview-frame {
border: 3px solid #667eea;
border-radius: 8px;
min-height: 600px;
background: white;
}
h1,
h2,
h3 {
color: #2d3436;
}
.instruction-badge {
background: #fff3cd;
color: #856404;
padding: 12px 20px;
border-radius: 8px;
border-left: 4px solid #ffc107;
margin: 15px 0;
}
</style>
</head>
<body>
<div class="test-container">
<div class="test-card text-center">
<h1 class="mb-3">
<i class="bi bi-check-circle-fill text-success"></i>
Contact Page Structured Fields
</h1>
<p class="lead">
Test the new structured editing system that prevents layout breaking
</p>
<div class="mt-3">
<span class="success-badge">✓ Layout Protected</span>
<span class="success-badge">✓ Data Separated</span>
<span class="success-badge">✓ User-Friendly</span>
<span class="success-badge">✓ No Errors</span>
</div>
</div>
<div class="test-card">
<h2><i class="bi bi-list-check"></i> Testing Steps</h2>
<p class="text-muted mb-4">
Follow these steps to see the structured fields in action
</p>
<div class="step">
<strong>Step 1:</strong> Open the admin panel in a new tab →
<a
href="/admin/pages.html"
target="_blank"
class="btn btn-sm btn-primary ms-2"
>
<i class="bi bi-box-arrow-up-right"></i> Open Admin Panel
</a>
</div>
<div class="step">
<strong>Step 2:</strong> Find the "Contact" page in the list and click
the <strong>Edit</strong> button (pencil icon)
</div>
<div class="step">
<strong>Step 3:</strong> Notice you DON'T see a Quill rich text
editor. Instead, you see:
<ul class="mt-2">
<li>
<strong>Header Section Card</strong> - Title and subtitle fields
</li>
<li>
<strong>Contact Information Card</strong> - Phone, email, address
fields
</li>
<li>
<strong>Business Hours Card</strong> - Multiple time slot fields
with add/remove buttons
</li>
</ul>
</div>
<div class="step">
<strong>Step 4:</strong> Make a change:
<ul class="mt-2">
<li>Change phone number to <code>+1 (555) 999-8888</code></li>
<li>
Or update the header title to <code>Contact Sky Art Shop</code>
</li>
<li>Or add a new business hour slot</li>
</ul>
</div>
<div class="step">
<strong>Step 5:</strong> Click <strong>"Save Page"</strong> button at
the bottom of the modal
</div>
<div class="step">
<strong>Step 6:</strong> Return to this page and click the button
below to refresh the preview:
<button
class="btn btn-sm btn-success mt-2"
onclick="refreshPreview()"
>
<i class="bi bi-arrow-clockwise"></i> Refresh Contact Page Preview
</button>
</div>
<div class="instruction-badge">
<i class="bi bi-lightbulb-fill"></i>
<strong>What to Expect:</strong> The contact page will show your
updated data but the beautiful gradient layout, icons, and styling
will remain perfectly intact!
</div>
</div>
<div class="test-card">
<h2><i class="bi bi-split"></i> Live Comparison</h2>
<p class="text-muted mb-3">
Compare admin interface with frontend result
</p>
<div class="split-view">
<div>
<h4 class="mb-3"><i class="bi bi-gear"></i> Admin Panel</h4>
<iframe
id="adminFrame"
src="/admin/pages.html"
class="preview-frame w-100"
title="Admin Panel"
>
</iframe>
</div>
<div>
<h4 class="mb-3">
<i class="bi bi-eye"></i> Frontend Contact Page
<button
class="btn btn-sm btn-outline-primary"
onclick="refreshPreview()"
>
<i class="bi bi-arrow-clockwise"></i>
</button>
</h4>
<iframe
id="contactFrame"
src="/contact.html"
class="preview-frame w-100"
title="Contact Page"
>
</iframe>
</div>
</div>
</div>
<div class="test-card">
<h2><i class="bi bi-shield-check"></i> What's Different?</h2>
<div class="row mt-4">
<div class="col-md-6">
<div class="alert alert-danger">
<h5><i class="bi bi-x-circle"></i> Before (Problem)</h5>
<ul>
<li>Single rich text editor for entire page</li>
<li>User could type anything (e.g., "5")</li>
<li>Would replace entire beautiful layout</li>
<li>Lost gradient cards, icons, styling</li>
<li>Required HTML knowledge to maintain</li>
</ul>
</div>
</div>
<div class="col-md-6">
<div class="alert alert-success">
<h5><i class="bi bi-check-circle"></i> After (Solution)</h5>
<ul>
<li>Structured input fields for each section</li>
<li>Can only enter data, not HTML</li>
<li>JavaScript generates formatted HTML</li>
<li>Layout template is protected</li>
<li>No HTML knowledge needed</li>
</ul>
</div>
</div>
</div>
</div>
<div class="test-card">
<h2><i class="bi bi-database"></i> Technical Details</h2>
<h4 class="mt-4">Database Structure</h4>
<pre class="bg-light p-3 rounded"><code>{
"header": {
"title": "Our Contact Information",
"subtitle": "Reach out to us..."
},
"contactInfo": {
"phone": "+1 (555) 123-4567",
"email": "contact@skyartshop.com",
"address": "123 Art Street..."
},
"businessHours": [
{ "days": "Monday - Friday", "hours": "9:00 AM - 6:00 PM" },
{ "days": "Saturday", "hours": "10:00 AM - 4:00 PM" }
]
}</code></pre>
<h4 class="mt-4">How It Works</h4>
<ol>
<li>
<strong>Admin edits fields</strong> → Structured data collected
</li>
<li>
<strong>JavaScript function</strong> → Generates formatted HTML from
template
</li>
<li>
<strong>Save to database</strong> → Stores both structured data
(JSON) and generated HTML
</li>
<li><strong>Frontend displays</strong> → Shows the generated HTML</li>
<li><strong>Result</strong> → Data changes, layout stays perfect!</li>
</ol>
<div class="alert alert-info mt-3">
<i class="bi bi-info-circle-fill"></i>
<strong>Note:</strong> Other pages (About, Privacy) still use the rich
text editor because they don't have a fixed layout requirement. The
system automatically detects which editor to show.
</div>
</div>
<div class="test-card text-center">
<h3 class="mb-3">Quick Links</h3>
<a href="/admin/pages.html" target="_blank" class="btn btn-primary m-2">
<i class="bi bi-gear"></i> Admin Panel
</a>
<a href="/contact.html" target="_blank" class="btn btn-success m-2">
<i class="bi bi-envelope"></i> Contact Page
</a>
<a href="/test-data-sync.html" target="_blank" class="btn btn-info m-2">
<i class="bi bi-arrow-repeat"></i> Data Sync Test
</a>
</div>
</div>
<script>
function refreshPreview() {
const contactFrame = document.getElementById("contactFrame");
contactFrame.src = contactFrame.src; // Reload iframe
// Show feedback
const btn = event.target.closest("button");
const originalHTML = btn.innerHTML;
btn.innerHTML = '<i class="bi bi-check-circle"></i> Refreshed!';
btn.classList.remove("btn-outline-primary", "btn-success");
btn.classList.add("btn-success");
setTimeout(() => {
btn.innerHTML = originalHTML;
btn.classList.remove("btn-success");
btn.classList.add("btn-outline-primary");
}, 2000);
}
</script>
</body>
</html>