Skip to content

Commit 1a97591

Browse files
committed
lint
1 parent 7a0196c commit 1a97591

File tree

5 files changed

+53
-45
lines changed

5 files changed

+53
-45
lines changed

frontend/three_d_garden/garden.tsx

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,23 @@ export const GardenModel = (props: GardenModelProps) => {
111111
const gridZ = zero.z - config.soilHeight + 5;
112112
const extents = extentsFunc(config);
113113

114+
let groundTexture;
115+
let groundColor;
116+
let lowDetailGroundColor;
117+
if (config.scene === "Greenhouse") {
118+
groundTexture = brickTexture;
119+
groundColor = "#999";
120+
lowDetailGroundColor = "firebrick";
121+
} else if (config.scene === "Lab") {
122+
groundTexture = labFloorTexture;
123+
groundColor = "#aaa";
124+
lowDetailGroundColor = "gray";
125+
} else {
126+
groundTexture = grassTexture;
127+
groundColor = "#ddd";
128+
lowDetailGroundColor = "darkgreen";
129+
}
130+
114131
// eslint-disable-next-line no-null/no-null
115132
return <Group dispose={null}
116133
onPointerMove={config.eventDebug
@@ -150,25 +167,13 @@ export const GardenModel = (props: GardenModelProps) => {
150167
<Detailed distances={detailLevels(config)}>
151168
<Ground>
152169
<MeshPhongMaterial
153-
map={
154-
config.scene === "Greenhouse"
155-
? brickTexture
156-
: config.scene === "Lab"
157-
? labFloorTexture
158-
: grassTexture
159-
}
160-
color={
161-
config.scene === "Greenhouse"
162-
? "#999"
163-
: config.scene === "Lab"
164-
? "#aaa"
165-
: "#ddd"
166-
}
170+
map={groundTexture}
171+
color={groundColor}
167172
shininess={0} />
168173
</Ground>
169174
<Ground>
170175
<MeshPhongMaterial
171-
color={config.scene == "Outdoor" ? "darkgreen" : "gray"}
176+
color={lowDetailGroundColor}
172177
shininess={0} />
173178
</Ground>
174179
</Detailed>

frontend/three_d_garden/greenhouse.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { threeSpace } from "./helpers";
66
import { Config } from "./config";
77
import { Group, MeshPhongMaterial } from "./components";
88
import { StarterTray } from "./starter_tray";
9-
import PottedPlant from "./potted_plant";
9+
import { PottedPlant } from "./potted_plant";
1010
import { GreenhouseWall } from "./greenhouse_wall";
1111

1212
export interface GreenhouseProps {
@@ -116,7 +116,7 @@ export const Greenhouse = (props: GreenhouseProps) => {
116116
position={[
117117
threeSpace(-1750, config.bedLengthOuter),
118118
threeSpace(850, -config.bedWidthOuter),
119-
groundZ
119+
groundZ,
120120
]}>
121121
<PottedPlant />
122122
</Group>

frontend/three_d_garden/greenhouse_wall.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const GreenhouseWall = () => {
2727
{Array.from({ length: numWallRows }).map((_, row) =>
2828
Array.from({ length: numWallCols }).map((_, col) => {
2929
const isOpen = openPanels.some(
30-
(panel) => panel.row === row && panel.col === col
30+
(panel) => panel.row === row && panel.col === col,
3131
);
3232
return (
3333
<Box
@@ -38,13 +38,18 @@ export const GreenhouseWall = () => {
3838
position={[
3939
wallGap + paneWidth / 2 + col * (paneWidth + wallGap),
4040
0,
41-
wallGap + paneHeight / 2 + row * (paneHeight + wallGap)
41+
wallGap + paneHeight / 2 + row * (paneHeight + wallGap),
4242
]}
4343
rotation={isOpen ? [-Math.PI / 3, 0, 0] : [0, 0, 0]}>
44-
<MeshPhongMaterial color={"#ccffff"} side={DoubleSide} transparent={true} opacity={0.25} />
44+
<MeshPhongMaterial
45+
color={"#ccffff"}
46+
side={DoubleSide}
47+
transparent={true}
48+
opacity={0.25}
49+
/>
4550
</Box>
4651
);
47-
})
52+
}),
4853
)}
4954
{Array.from({ length: numWallCols + 1 }).map((_, col) => (
5055
<Box
@@ -54,7 +59,7 @@ export const GreenhouseWall = () => {
5459
position={[
5560
col * (paneWidth + wallGap) + wallGap / 2,
5661
0,
57-
wallHeight / 2
62+
wallHeight / 2,
5863
]}>
5964
<MeshPhongMaterial
6065
color={"#999"}
Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
import React, { useMemo } from 'react'
2-
import { Billboard, Circle, Image } from '@react-three/drei'
3-
import * as THREE from 'three'
4-
import { Group, MeshPhongMaterial, Mesh } from './components'
1+
import React, { useMemo } from "react";
2+
import { Billboard, Circle, Image } from "@react-three/drei";
3+
import * as THREE from "three";
4+
import { Group, MeshPhongMaterial, Mesh } from "./components";
55

6-
const potHeight = 400
7-
const plantHeight = 500
6+
const potHeight = 400;
7+
const plantHeight = 500;
88

9-
const PottedPlant = () => {
9+
export const PottedPlant = () => {
1010
const points = useMemo(() => [
11-
new THREE.Vector2(0, 0), // Bottom center
12-
new THREE.Vector2(0.3, 0), // Base width
13-
new THREE.Vector2(0.35, 0.1), // Slight flare at the bottom
14-
new THREE.Vector2(0.25, 0.6), // Narrowing midsection
15-
new THREE.Vector2(0.3, 0.8), // Widening towards the top
16-
new THREE.Vector2(0.4, 1), // Outer lip
17-
new THREE.Vector2(0.35, 1), // Inner lip
18-
new THREE.Vector2(0.2, 0.6), // Depth
19-
new THREE.Vector2(0, 0.6) // Close the profile
20-
], [])
11+
new THREE.Vector2(0, 0),
12+
new THREE.Vector2(0.3, 0),
13+
new THREE.Vector2(0.35, 0.1),
14+
new THREE.Vector2(0.25, 0.6),
15+
new THREE.Vector2(0.3, 0.8),
16+
new THREE.Vector2(0.4, 1),
17+
new THREE.Vector2(0.35, 1),
18+
new THREE.Vector2(0.2, 0.6),
19+
new THREE.Vector2(0, 0.6),
20+
], []);
2121

22-
const geometry = useMemo(() => new THREE.LatheGeometry(points, 32, 0, Math.PI * 2), [points])
22+
const geometry = useMemo(() => new THREE.LatheGeometry(points, 32, 0, Math.PI * 2), [points]);
2323

2424
return (
2525
<Group name="pot-with-plant">
@@ -43,7 +43,5 @@ const PottedPlant = () => {
4343
/>
4444
</Billboard>
4545
</Group>
46-
)
47-
}
48-
49-
export default PottedPlant
46+
);
47+
};

frontend/three_d_garden/starter_tray.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const StarterTray = () => {
3535
transparent={true} />
3636
</Billboard>
3737
);
38-
})
38+
}),
3939
)}
4040
</Group>
4141
);

0 commit comments

Comments
 (0)