@@ -90,20 +90,6 @@ export const MISSING_KIT_B_PARTS = [
9090 "DuPont cables as placeable parts" ,
9191] ;
9292
93- const KIT_DEFAULT_PROPERTIES : Record < string , Record < string , unknown > > = {
94- "led-red" : { color : "red" } ,
95- "led-yellow" : { color : "yellow" } ,
96- "led-blue" : { color : "blue" } ,
97- "led-green" : { color : "green" } ,
98- thermistor : { temperature : 25 } ,
99- lm35dz : { temperature : 25 } ,
100- dht11 : { temperature : 25 , humidity : 50 } ,
101- "water-level-sensor" : { level : 0 } ,
102- "microphone-module" : { soundLevel : 512 } ,
103- "obstacle-avoidance-module" : { distance : 100 } ,
104- "74hc595" : { values : [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] } ,
105- } ;
106-
10793export function normalizeKitType ( kitType ?: string | null ) : KitType {
10894 return kitType === "esp32" ? "esp32" : "arduino" ;
10995}
@@ -165,36 +151,10 @@ export function countKitBoards(boards: { boardKind?: BoardKind }[]) {
165151 return counts ;
166152}
167153
168- function createKitComponent ( metadataId : string , index : number , x : number , y : number ) {
169- return {
170- id : `${ metadataId . replace ( / - / g, "_" ) } _kit_${ index } ` ,
171- metadataId,
172- x,
173- y,
174- properties : { ...( KIT_DEFAULT_PROPERTIES [ metadataId ] ?? { } ) } ,
175- } ;
176- }
177-
178154export function createInitialKitPayload ( kitType ?: string | null ) {
179155 const kit = normalizeKitType ( kitType ) ;
180156 const boardKind : BoardKind = kit === "esp32" ? "esp32" : "arduino-uno" ;
181157 const boardId = boardKind ;
182- const components = [ ] ;
183- let slot = 0 ;
184-
185- for ( const [ metadataId , quantity ] of Object . entries ( KIT_COMPONENT_LIMITS [ kit ] ) ) {
186- for ( let i = 0 ; i < quantity ; i += 1 ) {
187- if ( metadataId === "breadboard-full" ) {
188- components . push ( createKitComponent ( metadataId , i + 1 , 520 , 80 ) ) ;
189- continue ;
190- }
191-
192- const col = slot % 8 ;
193- const row = Math . floor ( slot / 8 ) ;
194- components . push ( createKitComponent ( metadataId , i + 1 , 80 + col * 170 , 620 + row * 150 ) ) ;
195- slot += 1 ;
196- }
197- }
198158
199159 return {
200160 boards : [
@@ -215,7 +175,7 @@ export function createInitialKitPayload(kitType?: string | null) {
215175 fileGroups : {
216176 [ `group-${ boardId } ` ] : [ { name : "sketch.ino" , content : "" } ] ,
217177 } ,
218- components,
178+ components : [ ] ,
219179 wires : [ ] ,
220180 activeBoardId : boardId ,
221181 } ;
0 commit comments