← back to Brand Selector Viewer

index.html

487 lines

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Brand Selector — Figma Build Source</title>
<style>
  :root {
    --bg: #0b0b0d;
    --bg-2: #131318;
    --bg-3: #1a1a22;
    --line: #2a2a35;
    --text: #f4f4f5;
    --muted: #9c9caa;
    --accent: #d4af37;
    --accent-2: #c89b3d;
    --ok: #4ade80;
    --danger: #f87171;
    --radius: 14px;
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
  body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    padding-bottom: 120px;
  }
  header {
    padding: 36px 40px 20px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
  }
  header h1 {
    margin: 0;
    font-family: "Didot", "Bodoni 72", Georgia, serif;
    font-weight: 400;
    font-size: 32px;
    letter-spacing: 0.5px;
  }
  header p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
    letter-spacing: 0.4px;
  }
  .stats {
    display: flex;
    gap: 28px;
    align-items: center;
  }
  .stat {
    text-align: right;
  }
  .stat .num {
    font-family: "Didot", "Bodoni 72", Georgia, serif;
    font-size: 28px;
    color: var(--accent);
  }
  .stat .lbl {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
  }
  main { padding: 28px 40px; }
  section + section { margin-top: 44px; }
  section h2 {
    margin: 0 0 4px;
    font-family: "Didot", "Bodoni 72", Georgia, serif;
    font-weight: 400;
    font-size: 22px;
  }
  section .sub {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 18px;
  }
  .toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    flex-wrap: wrap;
  }
  .btn {
    background: var(--bg-2);
    border: 1px solid var(--line);
    color: var(--text);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 12px;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .btn:hover { border-color: var(--accent); color: var(--accent); }
  .btn.primary {
    background: var(--accent);
    color: #111;
    border-color: var(--accent);
  }
  .btn.primary:hover { background: var(--accent-2); color: #111; }
  .grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
  }
  .card {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 18px 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    overflow: hidden;
    min-height: 130px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  .card:hover {
    border-color: #4a4a5a;
    transform: translateY(-2px);
  }
  .card.selected {
    border-color: var(--accent);
    background: linear-gradient(135deg, rgba(212,175,55,0.08), var(--bg-3));
    box-shadow: 0 0 0 1px var(--accent) inset;
  }
  .card .check {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: transparent;
    transition: all 0.15s ease;
  }
  .card.selected .check {
    background: var(--accent);
    border-color: var(--accent);
    color: #111;
  }
  .card .name {
    font-family: "Didot", "Bodoni 72", Georgia, serif;
    font-size: 19px;
    line-height: 1.15;
    letter-spacing: 0.3px;
    padding-right: 30px;
  }
  .card .meta {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
  }
  .tag {
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--muted);
    border: 1px solid var(--line);
    padding: 3px 8px;
    border-radius: 999px;
  }
  .swatch-row {
    display: flex;
    gap: 4px;
    margin-top: 10px;
  }
  .swatch {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.08);
  }
  /* Footer dock */
  .dock {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(11,11,13,0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    padding: 14px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    z-index: 100;
  }
  .dock .summary {
    display: flex;
    gap: 18px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 13px;
  }
  .dock .pill {
    background: var(--bg-3);
    padding: 6px 12px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 12px;
  }
  .dock .pill strong { color: var(--accent); margin-right: 4px; font-family: "Didot", Georgia, serif; }
  .dock .actions { display: flex; gap: 8px; }
  /* Modal */
  .modal-bg {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 24px;
  }
  .modal-bg.show { display: flex; }
  .modal {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 760px;
    width: 100%;
    max-height: 80vh;
    overflow: auto;
  }
  .modal h3 {
    margin: 0 0 12px;
    font-family: "Didot", Georgia, serif;
    font-weight: 400;
    font-size: 22px;
  }
  pre {
    background: #07070a;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    overflow: auto;
    font-size: 12px;
    line-height: 1.5;
    color: #d4d4d8;
    max-height: 50vh;
  }
  .toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--ok);
    color: #06280f;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.25s ease;
    pointer-events: none;
    z-index: 300;
  }
  .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
</style>
</head>
<body>

<header>
  <div>
    <h1>Brand Selector</h1>
    <p>Pick the labels that will source the next Figma build · Top 20 fashion · Top 10 wallcovering</p>
  </div>
  <div class="stats">
    <div class="stat"><div class="num" id="stat-fashion">0</div><div class="lbl">Fashion</div></div>
    <div class="stat"><div class="num" id="stat-wall">0</div><div class="lbl">Wallcovering</div></div>
  </div>
</header>

<main>
  <section>
    <h2>Fashion</h2>
    <div class="sub">Top 20 — Luxury &amp; Iconic Houses</div>
    <div class="toolbar">
      <button class="btn" data-action="select-all" data-cat="fashion">Select all 20</button>
      <button class="btn" data-action="clear" data-cat="fashion">Clear</button>
      <button class="btn" data-action="top5" data-cat="fashion">Top 5 only</button>
    </div>
    <div class="grid" id="grid-fashion"></div>
  </section>

  <section>
    <h2>Wallcovering</h2>
    <div class="sub">Top 10 — Heritage &amp; Designer Houses</div>
    <div class="toolbar">
      <button class="btn" data-action="select-all" data-cat="wall">Select all 10</button>
      <button class="btn" data-action="clear" data-cat="wall">Clear</button>
    </div>
    <div class="grid" id="grid-wall"></div>
  </section>
</main>

<div class="dock">
  <div class="summary">
    <span class="pill"><strong id="dock-total">0</strong>selected</span>
    <span class="pill" id="dock-list" style="max-width:580px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">none</span>
  </div>
  <div class="actions">
    <button class="btn" id="btn-clear-all">Clear all</button>
    <button class="btn" id="btn-preview">Preview JSON</button>
    <button class="btn primary" id="btn-figma">Send to Figma Build →</button>
  </div>
</div>

<div class="modal-bg" id="modal">
  <div class="modal">
    <h3>Figma build payload</h3>
    <p style="color:var(--muted);font-size:12px;margin:0 0 12px;">Paste this into Paper / Figma plugin input, or feed it to the four-horsemen pipeline.</p>
    <pre id="modal-json"></pre>
    <div style="display:flex;gap:8px;margin-top:14px;justify-content:flex-end;">
      <button class="btn" id="btn-copy">Copy JSON</button>
      <button class="btn" id="btn-download">Download .json</button>
      <button class="btn primary" id="btn-close">Close</button>
    </div>
  </div>
</div>

<div class="toast" id="toast">Copied</div>

<script>
const FASHION = [
  { name: "Louis Vuitton", country: "FR", founded: 1854, palette: ["#5d3a22","#d4b886","#1a1a1a"] },
  { name: "Chanel",        country: "FR", founded: 1910, palette: ["#000000","#ffffff","#c9a96e"] },
  { name: "Hermès",        country: "FR", founded: 1837, palette: ["#f37021","#1a1a1a","#f4e7d3"] },
  { name: "Gucci",         country: "IT", founded: 1921, palette: ["#006341","#a01c1f","#d4af37"] },
  { name: "Prada",         country: "IT", founded: 1913, palette: ["#000000","#8b8680","#e8e4dc"] },
  { name: "Dior",          country: "FR", founded: 1946, palette: ["#1a1a1a","#c8a883","#ffffff"] },
  { name: "Versace",       country: "IT", founded: 1978, palette: ["#d4af37","#000000","#a01c1f"] },
  { name: "Burberry",      country: "UK", founded: 1856, palette: ["#a08661","#000000","#c1272d"] },
  { name: "Saint Laurent", country: "FR", founded: 1961, palette: ["#000000","#d4b886","#ffffff"] },
  { name: "Balenciaga",    country: "ES", founded: 1919, palette: ["#000000","#5a5a5a","#ffffff"] },
  { name: "Bottega Veneta",country: "IT", founded: 1966, palette: ["#3d5a2c","#c9b27a","#1a1a1a"] },
  { name: "Fendi",         country: "IT", founded: 1925, palette: ["#5d3a22","#f0e6d2","#000000"] },
  { name: "Givenchy",      country: "FR", founded: 1952, palette: ["#000000","#d4af37","#a01c1f"] },
  { name: "Valentino",     country: "IT", founded: 1960, palette: ["#a01c1f","#1a1a1a","#f0e6d2"] },
  { name: "Armani",        country: "IT", founded: 1975, palette: ["#1a1a2e","#8b8680","#000000"] },
  { name: "Ralph Lauren",  country: "US", founded: 1967, palette: ["#1a3a6c","#a01c1f","#f0e6d2"] },
  { name: "Tom Ford",      country: "US", founded: 2005, palette: ["#000000","#5d3a22","#d4af37"] },
  { name: "Celine",        country: "FR", founded: 1945, palette: ["#000000","#d4b886","#ffffff"] },
  { name: "Loewe",         country: "ES", founded: 1846, palette: ["#5d3a22","#d4b886","#1a1a1a"] },
  { name: "Alexander McQueen", country: "UK", founded: 1992, palette: ["#000000","#a01c1f","#8b8680"] }
];

const WALL = [
  { name: "Phillip Jeffries", country: "US", founded: 1976, palette: ["#d4b886","#5d3a22","#f0e6d2"] },
  { name: "Schumacher",       country: "US", founded: 1889, palette: ["#a01c1f","#3d5a2c","#d4af37"] },
  { name: "Cole & Son",       country: "UK", founded: 1875, palette: ["#1a3a6c","#c9a96e","#f0e6d2"] },
  { name: "Thibaut",          country: "US", founded: 1886, palette: ["#3d5a2c","#c9a96e","#1a1a1a"] },
  { name: "Zoffany",          country: "UK", founded: 1895, palette: ["#5d3a22","#d4b886","#3d5a2c"] },
  { name: "Farrow & Ball",    country: "UK", founded: 1946, palette: ["#1a3a3a","#e8e4dc","#5d3a22"] },
  { name: "Brunschwig & Fils",country: "US", founded: 1909, palette: ["#a01c1f","#1a3a6c","#d4b886"] },
  { name: "de Gournay",       country: "UK", founded: 1986, palette: ["#c9a96e","#5d3a22","#3d5a2c"] },
  { name: "Fromental",        country: "UK", founded: 2005, palette: ["#1a3a6c","#d4af37","#5d3a22"] },
  { name: "Pierre Frey",      country: "FR", founded: 1935, palette: ["#a01c1f","#d4b886","#1a3a6c"] }
];

const state = { fashion: new Set(), wall: new Set() };

function render() {
  const make = (cat, list) => list.map((b) => {
    const sel = state[cat].has(b.name) ? "selected" : "";
    const swatches = b.palette.map(c => `<span class="swatch" style="background:${c}"></span>`).join("");
    return `
      <div class="card ${sel}" data-cat="${cat}" data-name="${b.name}">
        <div class="check">✓</div>
        <div>
          <div class="name">${b.name}</div>
          <div class="meta">
            <span class="tag">${b.country}</span>
            <span class="tag">est. ${b.founded}</span>
          </div>
        </div>
        <div class="swatch-row">${swatches}</div>
      </div>
    `;
  }).join("");

  document.getElementById("grid-fashion").innerHTML = make("fashion", FASHION);
  document.getElementById("grid-wall").innerHTML = make("wall", WALL);

  document.getElementById("stat-fashion").textContent = state.fashion.size;
  document.getElementById("stat-wall").textContent = state.wall.size;

  const total = state.fashion.size + state.wall.size;
  document.getElementById("dock-total").textContent = total;
  const all = [...state.fashion, ...state.wall];
  document.getElementById("dock-list").textContent = all.length ? all.join(" · ") : "none";
}

document.body.addEventListener("click", (e) => {
  const card = e.target.closest(".card");
  if (card) {
    const cat = card.dataset.cat, name = card.dataset.name;
    if (state[cat].has(name)) state[cat].delete(name); else state[cat].add(name);
    render();
    return;
  }
  const tb = e.target.closest("[data-action]");
  if (tb) {
    const cat = tb.dataset.cat, action = tb.dataset.action;
    const list = cat === "fashion" ? FASHION : WALL;
    if (action === "select-all") list.forEach(b => state[cat].add(b.name));
    if (action === "clear") state[cat].clear();
    if (action === "top5") { state[cat].clear(); list.slice(0,5).forEach(b => state[cat].add(b.name)); }
    render();
  }
});

document.getElementById("btn-clear-all").onclick = () => {
  state.fashion.clear(); state.wall.clear(); render();
};

function buildPayload() {
  const get = (cat, list) => list.filter(b => state[cat].has(b.name));
  return {
    schema: "figma-build/brand-selection.v1",
    generated_at: new Date().toISOString(),
    counts: { fashion: state.fashion.size, wallcovering: state.wall.size, total: state.fashion.size + state.wall.size },
    fashion: get("fashion", FASHION),
    wallcovering: get("wall", WALL)
  };
}

document.getElementById("btn-preview").onclick = () => {
  document.getElementById("modal-json").textContent = JSON.stringify(buildPayload(), null, 2);
  document.getElementById("modal").classList.add("show");
};
document.getElementById("btn-figma").onclick = () => {
  const payload = buildPayload();
  if (payload.counts.total === 0) { toast("Select at least one brand", true); return; }
  document.getElementById("modal-json").textContent = JSON.stringify(payload, null, 2);
  document.getElementById("modal").classList.add("show");
};
document.getElementById("btn-close").onclick = () => document.getElementById("modal").classList.remove("show");
document.getElementById("btn-copy").onclick = async () => {
  await navigator.clipboard.writeText(document.getElementById("modal-json").textContent);
  toast("Copied to clipboard");
};
document.getElementById("btn-download").onclick = () => {
  const blob = new Blob([document.getElementById("modal-json").textContent], { type: "application/json" });
  const url = URL.createObjectURL(blob);
  const a = document.createElement("a");
  a.href = url;
  a.download = `brand-selection-${new Date().toISOString().slice(0,10)}.json`;
  a.click();
  URL.revokeObjectURL(url);
};

function toast(msg, isError) {
  const t = document.getElementById("toast");
  t.textContent = msg;
  t.style.background = isError ? "var(--danger)" : "var(--ok)";
  t.style.color = isError ? "#3a0d0d" : "#06280f";
  t.classList.add("show");
  setTimeout(() => t.classList.remove("show"), 1800);
}

render();
</script>
</body>
</html>