Skip to content

Commit a6c03ff

Browse files
Merge pull request #2506 from FarmBot/staging
v15.21.1
2 parents 1a4e2af + fb39705 commit a6c03ff

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

frontend/promo/__tests__/plants_test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ describe("calculatePlantPositions()", () => {
1818
icon: CROPS.beet.icon,
1919
key: "beet",
2020
label: "Beet",
21+
id: expect.any(Number),
2122
seed: expect.any(Number),
2223
size: 150,
2324
spread: 175,

frontend/promo/plants.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export const calculatePlantPositions = (config: Config): ThreeDGardenPlant[] =>
1010
const startX = 350;
1111
let nextX = startX;
1212
let index = 0;
13+
let nextId = 1;
1314
while (nextX <= config.bedLengthOuter - 100) {
1415
const plantKey = gardenPlants[index];
1516
const plant = PLANTS[plantKey];
@@ -22,6 +23,7 @@ export const calculatePlantPositions = (config: Config): ThreeDGardenPlant[] =>
2223
y: config.bedWidthOuter / 2,
2324
key: plantKey,
2425
seed: Math.random(),
26+
id: nextId++,
2527
});
2628
const plantsPerHalfRow =
2729
Math.ceil((config.bedWidthOuter - plant.spread) / 2 / plant.spread);
@@ -33,6 +35,7 @@ export const calculatePlantPositions = (config: Config): ThreeDGardenPlant[] =>
3335
y: config.bedWidthOuter / 2 + plant.spread * i,
3436
key: plantKey,
3537
seed: Math.random(),
38+
id: nextId++,
3639
});
3740
positions.push({
3841
...plant,
@@ -41,6 +44,7 @@ export const calculatePlantPositions = (config: Config): ThreeDGardenPlant[] =>
4144
y: config.bedWidthOuter / 2 - plant.spread * i,
4245
key: plantKey,
4346
seed: Math.random(),
47+
id: nextId++,
4448
});
4549
}
4650
if (index + 1 < gardenPlants.length) {

0 commit comments

Comments
 (0)