Ingredients
-
Add everything someone needs to make your recipe.
+
Add each ingredient with its name, amount, and unit.
@@ -574,31 +802,66 @@ function RecipeCreatePage() {
: ''
}`}
key={`ingredient-${index}`}
- draggable
- onDragStart={() =>
- setDraggingRow({ type: 'ingredient', index })
- }
- onDragOver={(event) => event.preventDefault()}
- onDrop={(event) => handleIngredientDrop(event, index)}
- onDragEnd={handleRowDragEnd}
+ data-recipe-row-type="ingredient"
+ data-recipe-row-index={index}
>
+ handleRowPointerDown('ingredient', index, event)
+ }
>
-
- updateIngredient(index, event.target.value)
- }
- placeholder="e.g. 200g spaghetti"
- />
+
+
+ updateIngredient(index, 'name', event.target.value)
+ }
+ placeholder="e.g. spaghetti"
+ />
+
+ updateIngredient(index, 'amount', event.target.value)
+ }
+ placeholder="e.g. 200"
+ />
+
+
- setDraggingRow({ type: 'instruction', index })
- }
- onDragOver={(event) => event.preventDefault()}
- onDrop={(event) => handleInstructionDrop(event, index)}
- onDragEnd={handleRowDragEnd}
+ data-recipe-row-type="instruction"
+ data-recipe-row-index={index}
>
+ handleRowPointerDown('instruction', index, event)
+ }
>
diff --git a/compose.dev.yaml b/compose.dev.yaml
new file mode 100644
index 0000000..1cc1a14
--- /dev/null
+++ b/compose.dev.yaml
@@ -0,0 +1,54 @@
+name: t31-project2-dev
+
+services:
+ db:
+ image: postgres:16
+
+ environment:
+ POSTGRES_USER: t31_dev
+ POSTGRES_PASSWORD: change-me
+ POSTGRES_DB: t31_project2
+
+ volumes:
+ - postgres_data:/var/lib/postgresql/data
+
+ healthcheck:
+ test: ['CMD-SHELL', 'pg_isready -U t31_dev -d t31_project2']
+ interval: 5s
+ timeout: 5s
+ retries: 10
+
+ app:
+ build:
+ context: .
+ dockerfile: Dockerfile.dev
+
+ depends_on:
+ db:
+ condition: service_healthy
+
+ environment:
+ # "db" is the Docker Compose service name.
+ # Do NOT use 127.0.0.1 here.
+ DATABASE_URL: postgresql://t31_dev:change-me@db:5432/t31_project2
+
+ # The API must listen outside the container's loopback interface.
+ API_HOST: 0.0.0.0
+ API_PORT: 3001
+
+ ports:
+ - '5173:5173'
+ - '3001:3001'
+
+ volumes:
+ # Mount your source code so Vite/tsx hot reload still works.
+ - .:/app
+
+ # Keep container node_modules separate from the host.
+ - node_modules:/app/node_modules
+
+ init: true
+
+volumes:
+ postgres_data:
+ node_modules:
diff --git a/package-lock.json b/package-lock.json
index d2459a8..048f85a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -60,6 +60,7 @@
"dependencies": {
"react": "19.2.0",
"react-dom": "19.2.0",
+ "react-easy-crop": "6.2.4",
"react-router-dom": "7.9.6",
"zustand": "5.0.8"
},
@@ -7987,6 +7988,12 @@
"node": ">=18"
}
},
+ "node_modules/normalize-wheel": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/normalize-wheel/-/normalize-wheel-1.0.1.tgz",
+ "integrity": "sha512-1OnlAPZ3zgrk8B91HyRj+eVv+kS5u+Z0SCsak6Xil/kmgEia50ga7zfkumayonZrImffAxPU/5WcyGhzetHNPA==",
+ "license": "BSD-3-Clause"
+ },
"node_modules/object-inspect": {
"version": "1.13.4",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
@@ -8545,6 +8552,19 @@
"react": "^19.2.0"
}
},
+ "node_modules/react-easy-crop": {
+ "version": "6.2.4",
+ "resolved": "https://registry.npmjs.org/react-easy-crop/-/react-easy-crop-6.2.4.tgz",
+ "integrity": "sha512-OWdnFYctzUNlekjob+bQfloG9wyhIBkkmeISnM5XVE4Byqn0jmVxDF7oz85ovUF+EIPQyj0yAHbBEFtnxwGv4g==",
+ "license": "MIT",
+ "dependencies": {
+ "normalize-wheel": "^1.0.1"
+ },
+ "peerDependencies": {
+ "react": ">=16.4.0",
+ "react-dom": ">=16.4.0"
+ }
+ },
"node_modules/react-is": {
"version": "17.0.2",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",