From c4fb41e321e9921457e35d38421891540c89897a Mon Sep 17 00:00:00 2001 From: "Masaharu.Kato" Date: Thu, 19 Jun 2025 14:43:33 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=AC=E3=82=B7=E3=83=94=E4=B8=80=E8=A6=A7?= =?UTF-8?q?=E3=83=BB=E7=B7=A8=E9=9B=86=E7=94=BB=E9=9D=A2=E3=81=AE=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/AddByRecipeDialog.tsx | 4 +- frontend/src/pages/AddRecipe.tsx | 51 +--------------- frontend/src/pages/RecipeList.tsx | 61 +++++++++++-------- 3 files changed, 38 insertions(+), 78 deletions(-) diff --git a/frontend/src/components/AddByRecipeDialog.tsx b/frontend/src/components/AddByRecipeDialog.tsx index 86c9c6f..a9ec83b 100644 --- a/frontend/src/components/AddByRecipeDialog.tsx +++ b/frontend/src/components/AddByRecipeDialog.tsx @@ -41,7 +41,7 @@ const AddByRecipeDialog = async ({
レシピ名: {recipe.recipeName}
-
+ {/*
({recipe.maxservings})
@@ -53,7 +53,7 @@ const AddByRecipeDialog = async ({ ))} -
+
*/} {/* レシピを追加する人数分を入力 */} diff --git a/frontend/src/pages/AddRecipe.tsx b/frontend/src/pages/AddRecipe.tsx index 47e0a6a..c1ca170 100644 --- a/frontend/src/pages/AddRecipe.tsx +++ b/frontend/src/pages/AddRecipe.tsx @@ -282,8 +282,6 @@ const AddRecipe: React.FC = () => { ))})} - -
材料を追加 @@ -296,11 +294,7 @@ const AddRecipe: React.FC = () => {
-
@@ -344,49 +338,6 @@ const AddRecipe: React.FC = () => { setOpenAmountDialog(false); }} /> - {/* 人数入力ダイアログ */} - setOpenNumOfPeapleDialog(false)} disableScrollLock={true} - style={{ width : '100%', position : 'fixed', left: '50%', transform: 'translateX(-50%)' }} - > - - 買うものリストへ追加 - - -
- {/* 人数入力フィールド */} - { - const value = e.target.value; - const parsedValue = parseInt(value, 10); // 数値に変換 - if (/*!isNaN(parsedValue) && */ isNaN(parsedValue) || parsedValue >= 1) { //負数除外 - setNumOfPeaple(parsedValue); // number型で保存 - } - }} - sx={{ minWidth: "8px", width: "100%" }} - type="number" - inputProps={{ inputMode: "numeric", pattern: "[0-9]*" }} // ここで整数のみ許可 - - /> -
- setChecked(e.target.checked)} />} - label={足りない食材のみ登録} - /> -
- - - - -
} diff --git a/frontend/src/pages/RecipeList.tsx b/frontend/src/pages/RecipeList.tsx index 24d7039..3b1f090 100644 --- a/frontend/src/pages/RecipeList.tsx +++ b/frontend/src/pages/RecipeList.tsx @@ -62,12 +62,12 @@ const RecipeList: React.FC = () => { const fetchAllRecipes = async () => { try { const recipes = await recipeApi.getAllRecipes(); + console.log('All recipes:'); + console.log(recipes); setAllRecipes(recipes); - console.log("マックス"); - console.log(allRecipes.map(recipe => recipe.maxServings)) } catch (error) { + console.error(`${RECIPE_ERRORS.FETCH_FAILED}:`, error); showErrorMessage(RECIPE_ERRORS.FETCH_FAILED); - // console.error(`${TASK_ERRORS.FETCH_FAILED}:`, error); } }; @@ -105,33 +105,42 @@ const RecipeList: React.FC = () => { } } > - {recipe.recipeName} - {recipe.maxServings === 0 ? - - - : - - + + + + + {recipe.maxServings ? + {recipe.maxServings}人分 - - + + : <>} - - { - navigate('/addRecipe/' + recipe.recipeId); - }} - > - + {recipe.maxServings === 0 ? + + + + + : + + + - - } + } + + + { + navigate('/addRecipe/' + recipe.recipeId); + }} + > + + + + + ))}