[object Object]

← back to Wallco Ai

wallco.ai homepage: pin newest 6 butterflies above Featured, sort Featured grid by created_at desc

da2aabc326a0cbc0249b0793906206cfad1d09af · 2026-05-13 11:53:25 -0700 · SteveStudio2

Files touched

Diff

commit da2aabc326a0cbc0249b0793906206cfad1d09af
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date:   Wed May 13 11:53:25 2026 -0700

    wallco.ai homepage: pin newest 6 butterflies above Featured, sort Featured grid by created_at desc
---
 server.js | 42 +++++++++++++++++++++++++++++++++++++-----
 1 file changed, 37 insertions(+), 5 deletions(-)

diff --git a/server.js b/server.js
index dbb0b21..39eac53 100644
--- a/server.js
+++ b/server.js
@@ -2486,7 +2486,22 @@ function heroDesigns() {
 // ── HOME PAGE
 app.get('/', (req, res) => {
   const heroes = heroDesigns();
-  const featured = [...DESIGNS].sort((a,b) => b.saturation - a.saturation).slice(0, 8);
+  // Newest-first Featured grid — was sat-sorted, but Steve wants newly
+  // generated work to be the first thing visitors see. created_at lex sort is
+  // safe because every row is ISO-8601 UTC.
+  const featured = [...DESIGNS].sort((a,b) => String(b.created_at||'').localeCompare(String(a.created_at||''))).slice(0, 8);
+  // Pinned "Just-generated · Butterflies" rail — surfaces the latest 6
+  // butterfly-flavored designs above the Featured grid. Matches on category
+  // OR motif so we catch butterfly-trellis as well as future butterfly-*
+  // categories. Empty array → rail renders nothing (no broken shelf).
+  const butterflyLatest = [...DESIGNS]
+    .filter(d => {
+      const cat = String(d.category || '').toLowerCase();
+      if (cat.includes('butterfly')) return true;
+      return (d.motifs || []).some(m => String(m).toLowerCase().includes('butterfly'));
+    })
+    .sort((a,b) => String(b.created_at||'').localeCompare(String(a.created_at||'')))
+    .slice(0, 6);
   const schema = JSON.stringify({
     "@context": "https://schema.org",
     "@graph": [
@@ -2540,7 +2555,7 @@ app.get('/', (req, res) => {
   }
   const homeCats = Object.entries(homeCatCounts).sort((a,b) => b[1] - a[1]).slice(0, 6).map(([k,n]) => ({ key: k, count: n }));
 
-  const featuredCards = featured.map(d => {
+  const renderCard = (d) => {
     const roomKey = (d.room_mockups || []).includes('living_room') ? 'living_room'
                   : (d.room_mockups || []).includes('bedroom')     ? 'bedroom'
                   : (d.room_mockups || []).includes('office')      ? 'office'
@@ -2559,7 +2574,23 @@ app.get('/', (req, res) => {
         <span class="color-dot" style="background:${d.dominant_hex}" aria-hidden="true"></span>
       </div>
     </a>`;
-  }).join('');
+  };
+  const featuredCards = featured.map(renderCard).join('');
+  const butterflyCards = butterflyLatest.map(renderCard).join('');
+  // Hide the whole rail if no butterflies exist — keeps the page clean if the
+  // generator goes through a non-butterfly streak.
+  const butterflySection = butterflyLatest.length ? `
+<!-- Just-generated · Butterflies — pinned above Featured -->
+<section class="featured-section">
+  <div class="section-header">
+    <h2>Just generated &middot; Butterflies</h2>
+    <a href="/designs?q=butterfly&amp;sort=newest" class="see-all">See all butterfly designs &rarr;</a>
+  </div>
+  <div class="design-grid featured-grid">
+    ${butterflyCards}
+  </div>
+</section>
+` : '';
 
   res.type('html').send(`${htmlHead({
     title: 'wallco.ai — AI-Original Wallpaper & Murals',
@@ -2586,11 +2617,12 @@ ${htmlHeader('/')}
   <p class="tagline">AI-original wallpaper &amp; murals &mdash; every pattern generated, never repeated.</p>
 </div>
 
+${butterflySection}
 <!-- Featured designs grid -->
 <section class="featured-section">
   <div class="section-header">
-    <h2>Featured Designs</h2>
-    <a href="/designs" class="see-all">See all ${DESIGNS.length} designs &rarr;</a>
+    <h2>Newest Designs</h2>
+    <a href="/designs?sort=newest" class="see-all">See all ${DESIGNS.length} designs &rarr;</a>
   </div>
   <div class="design-grid featured-grid" id="featured-grid">
     ${featuredCards}

← 769ab6c Design Coordinate on /design/:id — palette-mode call to pair  ·  back to Wallco Ai  ·  wallco.ai: /designs cards show DW SKU + color name + AI-Desi f582e12 →