diff --git a/frontend/public/components-metadata.json b/frontend/public/components-metadata.json index c0ff32d9..57880aca 100644 --- a/frontend/public/components-metadata.json +++ b/frontend/public/components-metadata.json @@ -3371,7 +3371,8 @@ "tagName": "velxio-breadboard", "name": "Breadboard (full)", "category": "passive", - "description": "830-point solderless breadboard: 63 columns x two 5-hole banks (a-e / f-j) plus four full-length power rails. Holes in the same column strip or rail are electrically connected." + "description": "830-point solderless breadboard: 63 columns x two 5-hole banks (a-e / f-j) plus four full-length power rails. Holes in the same column strip or rail are electrically connected.", + "featured": true }, { "thumbnail": "", @@ -3390,7 +3391,8 @@ "tagName": "velxio-breadboard-mini", "name": "Breadboard Mini", "category": "passive", - "description": "170-point mini solderless breadboard: 17 columns x two 5-hole banks (a-e / f-j), no power rails. Holes in the same column strip are electrically connected." + "description": "170-point mini solderless breadboard: 17 columns x two 5-hole banks (a-e / f-j), no power rails. Holes in the same column strip are electrically connected.", + "featured": true }, { "thumbnail": "\n \n \n \n 1 nF", diff --git a/frontend/src/services/ComponentRegistry.ts b/frontend/src/services/ComponentRegistry.ts index 9701029b..3a65e544 100644 --- a/frontend/src/services/ComponentRegistry.ts +++ b/frontend/src/services/ComponentRegistry.ts @@ -230,12 +230,18 @@ export class ComponentRegistry { * Process and index metadata */ private processMetadata(components: ComponentMetadata[]): void { - this.allComponents = components; + // Featured (everyday) parts — e.g. breadboards — surface first in the + // picker. Array.prototype.sort is stable, so the metadata-file order is + // preserved within the featured and non-featured groups. + this.allComponents = [...components].sort( + (a, b) => Number(!!b.featured) - Number(!!a.featured), + ); this.metadata.clear(); this.categories.clear(); - // Index by ID - components.forEach((component) => { + // Index by ID. Iterate the sorted list so the per-category groups keep + // featured components first too. + this.allComponents.forEach((component) => { this.metadata.set(component.id, component); // Group by category diff --git a/frontend/src/types/component-metadata.ts b/frontend/src/types/component-metadata.ts index 0dc5428b..5fc808f4 100644 --- a/frontend/src/types/component-metadata.ts +++ b/frontend/src/types/component-metadata.ts @@ -47,6 +47,10 @@ export interface ComponentMetadata { // delegate the click on a pro_only component to a window-level gate // (see ComponentPickerModal) which the overlay implements. pro_only?: boolean; + // Everyday parts (e.g. breadboards) surface at the top of the picker: + // ComponentRegistry sorts featured components first after loading the + // metadata, keeping the original order within each group. + featured?: boolean; } export interface ComponentMetadataCollection { diff --git a/scripts/component-overrides.json b/scripts/component-overrides.json index 3c0bc741..05f69de5 100644 --- a/scripts/component-overrides.json +++ b/scripts/component-overrides.json @@ -2502,7 +2502,8 @@ "thumbnail": "", "properties": [], "defaultValues": {}, - "description": "830-point solderless breadboard: 63 columns x two 5-hole banks (a-e / f-j) plus four full-length power rails. Holes in the same column strip or rail are electrically connected." + "description": "830-point solderless breadboard: 63 columns x two 5-hole banks (a-e / f-j) plus four full-length power rails. Holes in the same column strip or rail are electrically connected.", + "featured": true }, { "$comment": "Velxio-native passive: 170-point mini breadboard (17x2 banks, no rails). Same wokwi-compatible naming as the full breadboard.", @@ -2521,7 +2522,8 @@ "thumbnail": "", "properties": [], "defaultValues": {}, - "description": "170-point mini solderless breadboard: 17 columns x two 5-hole banks (a-e / f-j), no power rails. Holes in the same column strip are electrically connected." + "description": "170-point mini solderless breadboard: 17 columns x two 5-hole banks (a-e / f-j), no power rails. Holes in the same column strip are electrically connected.", + "featured": true } ], "led": {