Limit grids to 100 for now.
parent
55ed669de7
commit
47942fb9c8
|
@ -20,11 +20,11 @@ export const plantGridKeys: PlantGridKey[] =
|
|||
export const EMPTY_PLANT_GRID: Omit<PlantGridState, "gridId"> = {
|
||||
status: "clean",
|
||||
grid: {
|
||||
startX: 5,
|
||||
startY: 5,
|
||||
spacingH: 5,
|
||||
spacingV: 5,
|
||||
numPlantsH: 5,
|
||||
numPlantsV: 5,
|
||||
startX: 100,
|
||||
startY: 100,
|
||||
spacingH: 50,
|
||||
spacingV: 50,
|
||||
numPlantsH: 7,
|
||||
numPlantsV: 7,
|
||||
}
|
||||
};
|
||||
|
|
|
@ -11,6 +11,8 @@ import { initPlantGrid } from "./generate_grid";
|
|||
import { init } from "../../../api/crud";
|
||||
import { uuid } from "farmbot";
|
||||
import { saveGrid, stashGrid } from "./thunks";
|
||||
import { error } from "../../../toast/toast";
|
||||
import { t } from "../../../i18next_wrapper";
|
||||
|
||||
export class PlantGrid extends React.Component<PlantGridProps, PlantGridState> {
|
||||
state: PlantGridState = {
|
||||
|
@ -25,6 +27,13 @@ export class PlantGrid extends React.Component<PlantGridProps, PlantGridState> {
|
|||
});
|
||||
|
||||
performPreview = () => {
|
||||
const { numPlantsH, numPlantsV } = this.state.grid;
|
||||
const total = numPlantsH * numPlantsV;
|
||||
if (total > 100) {
|
||||
error(t("Please make a grid with less than 100 plants"));
|
||||
return;
|
||||
}
|
||||
|
||||
const plants = initPlantGrid({
|
||||
grid: this.state.grid,
|
||||
openfarm_slug: this.props.openfarm_slug,
|
||||
|
|
Loading…
Reference in New Issue