← back to Dw War Room

src/showroom/index.ts

51 lines

// src/showroom/index.ts — Showroom standalone entry point
import { Showroom } from './Showroom';
import { SearchOverlay } from './SearchOverlay';
import type { SceneConfig } from './types';

// Default showroom config (used when no Figma data available)
const DEFAULT_CONFIG: SceneConfig = {
  corridor: { width: 40, depth: 20, height: 12, wallMaterial: 'brick', floorMaterial: 'polished-concrete' },
  wings: Array.from({ length: 6 }, (_, i) => ({
    index: i,
    vendor: ['Thibaut', 'Schumacher', 'Arte', 'Scalamandre', 'Elitis', 'Phillip Jeffries'][i],
    position: [-12 + i * 5, 0, -8] as [number, number, number],
    rotation: 0,
    panelCount: 12,
    accentColor: ['#1a4b8c', '#c41e3a', '#d4a574', '#2d4a3e', '#e67e22', '#8b4513'][i],
  })),
  walls: [
    { position: [-18, 4, 0], dimensions: [4, 8], material: 'brick', hasBookshelf: true, hasSamplePanels: false, sampleCount: 0 },
    { position: [18, 4, 0], dimensions: [4, 8], material: 'brick', hasBookshelf: false, hasSamplePanels: true, sampleCount: 3 },
  ],
  lights: Array.from({ length: 8 }, (_, i) => ({
    type: 'spot' as const,
    position: [-14 + i * 4, 11, 0] as [number, number, number],
    target: [-14 + i * 4, 0, 0] as [number, number, number],
    color: '#f5e6d0',
    intensity: 1.2,
    angle: Math.PI / 5,
    penumbra: 0.4,
  })),
  furniture: [
    { type: 'display-table' as const, position: [0, 0.45, 0] as [number, number, number], dimensions: [3, 0.9, 1.5] as [number, number, number] },
  ],
  entry: { position: [0, 0, 10], signText: 'DESIGNER WALLCOVERINGS' },
};

// Boot
const container = document.getElementById('showroom-container');
if (container) {
  const showroom = new Showroom(container);
  showroom.loadFromConfig(DEFAULT_CONFIG);
  showroom.start();

  // Live search overlay — searches DW Shopify products
  const search = new SearchOverlay(container);
  search.setShowroom(showroom);

  // Expose for MCP/debug
  (window as any).__showroom = showroom;
  (window as any).__search = search;
}