[object Object]

← back to Reidwitlin Landing

auto-save: 2026-07-02T07:46:12 (2 files) — scripts/build-rwltd-data.js server.js

2baaa116c23c39339942f8db14324794fb8532d1 · 2026-07-02 07:46:13 -0700 · Steve Abrams

Files touched

Diff

commit 2baaa116c23c39339942f8db14324794fb8532d1
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Thu Jul 2 07:46:13 2026 -0700

    auto-save: 2026-07-02T07:46:12 (2 files) — scripts/build-rwltd-data.js server.js
---
 scripts/build-rwltd-data.js | 2 +-
 server.js                   | 9 ++++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/scripts/build-rwltd-data.js b/scripts/build-rwltd-data.js
index abf4341..a2e6dfa 100644
--- a/scripts/build-rwltd-data.js
+++ b/scripts/build-rwltd-data.js
@@ -106,7 +106,7 @@ function main() {
       hue: bucket ? BUCKET_HUE[bucket] : null,
       hex: r.color_hex || r.dominant_color_hex || (aiColors[0] && aiColors[0].hex) || null,
       sat: null, val: bucket === 'white' ? 1 : bucket === 'black' ? 0 : 0.5,
-      width: clean(r.spec_actual_width || r.spec_width || r.width || (r.width_inches ? `${r.width_inches}"` : null)) || null,
+      width: clean(r.spec_width || r.width || (r.width_inches ? `${r.width_inches}"` : null)) || null,
       length: null,
       repeat: clean(r.pattern_repeat || r.spec_repeat) || null,
       material: null,
diff --git a/server.js b/server.js
index b4de666..acc4879 100644
--- a/server.js
+++ b/server.js
@@ -7,7 +7,8 @@ const fs = require('fs');
 const path = require('path');
 
 const PORT = process.env.PORT || 0; // 0 = OS-assigned free port
-const DATA = path.join(__dirname, 'data', 'products.json');
+const DATA      = path.join(__dirname, 'data', 'products.json');
+const INQUIRIES = path.join(__dirname, 'data', 'inquiries.jsonl');
 
 const app = express();
 
@@ -72,11 +73,13 @@ app.get('/api/product/:handle', (req, res) => {
   res.json(p);
 });
 
+// Pure helper — circular hue distance in degrees (0–180). Null hue → neutral 180.
+const hueDist = (a, b) => { if (a == null || b == null) return 180; const d = Math.abs(a - b) % 360; return d > 180 ? 360 - d : d; };
+
 // "Pairs well with" — same/adjacent color family, different pattern (contrast of scale). Up to 6.
 app.get('/api/pairs/:handle', (req, res) => {
   const p = SNAP.products.find(x => x.handle === req.params.handle);
   if (!p) return res.status(404).json({ error: 'not found' });
-  const hueDist = (a, b) => { if (a == null || b == null) return 180; const d = Math.abs(a - b) % 360; return d > 180 ? 360 - d : d; };
   const scored = SNAP.products.filter(x => x.handle !== p.handle && x.series !== p.series).map(x => {
     let s = 0;
     if (x.color_bucket && x.color_bucket === p.color_bucket) s += 40;
@@ -97,7 +100,7 @@ app.post('/api/inquiry', (req, res) => {
   if (!sku || !email) return res.status(400).json({ ok: false, error: 'sku and email required' });
   const rec = { at: new Date().toISOString(), sku, name: name || '', email, note: note || '', ip: req.ip };
   try {
-    fs.appendFileSync(path.join(__dirname, 'data', 'inquiries.jsonl'), JSON.stringify(rec) + '\n');
+    fs.appendFileSync(INQUIRIES, JSON.stringify(rec) + '\n');
   } catch (e) { return res.status(500).json({ ok: false, error: 'log failed' }); }
   res.json({ ok: true, message: 'Memo-sample request received. A Designer Wallcoverings specialist will follow up.' });
 });

← 86b29a3 deploy: pin reidwitlin to free port 9952  ·  back to Reidwitlin Landing  ·  chore: v0.1.1 (session close — lint clean, refactor auto-sav f181757 →