Add IKEA furniture catalog with 41 items and tabbed browse UI
- Create data/ikea-catalog.json with 41 curated IKEA items across 23 series (KALLAX, BILLY, MALM, PAX, HEMNES, LACK, etc.) with verified dimensions - Add source tabs (All/Standard/IKEA) to catalog panel for filtering - Add IKEA series filter bar when viewing IKEA items - Add IKEA badge and series label on item cards - Add mergeCatalog() to renderer for loading additional catalog files - Add scripts/import-ikea-hf.js for importing from HuggingFace dataset
This commit is contained in:
@@ -120,6 +120,37 @@ export class HouseRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
async mergeCatalog(url) {
|
||||
try {
|
||||
const res = await fetch(url);
|
||||
if (!res.ok) throw new Error(`Failed to load catalog: ${res.status} ${res.statusText}`);
|
||||
const extra = await res.json();
|
||||
if (!this.catalogData) {
|
||||
return this.loadCatalog(url);
|
||||
}
|
||||
// Merge categories
|
||||
for (const cat of extra.categories || []) {
|
||||
if (!this.catalogData.categories.includes(cat)) {
|
||||
this.catalogData.categories.push(cat);
|
||||
}
|
||||
}
|
||||
// Merge items, avoiding duplicates by id
|
||||
for (const item of extra.items || []) {
|
||||
if (!this._catalogIndex.has(item.id)) {
|
||||
this.catalogData.items.push(item);
|
||||
this._catalogIndex.set(item.id, item);
|
||||
}
|
||||
}
|
||||
// Store extra catalog for tabbed access
|
||||
if (!this._extraCatalogs) this._extraCatalogs = [];
|
||||
this._extraCatalogs.push(extra);
|
||||
return extra;
|
||||
} catch (err) {
|
||||
this._emitError('mergeCatalog', err);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
async loadDesign(url) {
|
||||
try {
|
||||
const res = await fetch(url);
|
||||
|
||||
Reference in New Issue
Block a user