From 8fceebb5a902e8d8d4229cd30a5c1453cea88109 Mon Sep 17 00:00:00 2001 From: "masato.fujita" Date: Tue, 17 Jun 2025 10:22:42 +0900 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E6=95=B0=E5=88=86=E3=81=AE=E9=A3=9F?= =?UTF-8?q?=E6=9D=90=E3=82=92=E8=B2=B7=E3=81=84=E7=89=A9=E3=83=AA=E3=82=B9?= =?UTF-8?q?=E3=83=88=E3=81=AB=E7=99=BB=E9=8C=B2=E3=81=A7=E3=81=8D=E3=82=8B?= =?UTF-8?q?=E6=A9=9F=E8=83=BD=E3=82=92=E5=AE=9F=E8=A3=85=E3=80=81UI?= =?UTF-8?q?=E3=81=AE=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/AddRecipe.tsx | 37 ++++++++++++++++---------------- frontend/src/pages/StockPage.tsx | 7 ------ 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/frontend/src/pages/AddRecipe.tsx b/frontend/src/pages/AddRecipe.tsx index 2bb15fc..a4f52ab 100644 --- a/frontend/src/pages/AddRecipe.tsx +++ b/frontend/src/pages/AddRecipe.tsx @@ -86,17 +86,17 @@ const AddRecipe: React.FC = () => { const handleSaveRecipe = async () => { - // if (!recipeName) { - // showErrorMessage('レシピ名が入力されていません!') - // console.log("yes1"); - // return false; - // } - - // if (!items.length) { - // showErrorMessage('材料が追加されていません!') - // console.log("yes2"); - // return false; - // } + if (!recipeName) { + showErrorMessage('レシピ名が入力されていません!') + console.log("yes1"); + return false; + } + + if (!items.length) { + showErrorMessage('材料が追加されていません!') + console.log("yes2"); + return false; + } try { if (!recipeId) { @@ -127,13 +127,13 @@ const AddRecipe: React.FC = () => { const checkRecipeAndItems = async () => { if (!recipeName) { - alert('レシピ名が入力されていません!') + showErrorMessage('レシピ名が入力されていません!') console.log("yes1"); return false; } if (!items.length) { - alert('材料が追加されていません!') + showErrorMessage('材料が追加されていません!') console.log("yes2"); return false; } @@ -154,7 +154,7 @@ const AddRecipe: React.FC = () => { console.log("before"); if (!recipeId) return false; console.log("ds"); - await toBuyApi.addByRecipe(recipeId); + await toBuyApi.addByRecipe(recipeId, numOfPeaple); showSuccessMessage('レシピが保存されて買うものリストに追加されました!'); navigate('/tasks'); } @@ -312,12 +312,13 @@ const AddRecipe: React.FC = () => { setOpenAmountDialog(false); }} /> + {/* 人数入力ダイアログ */} setOpenNumOfPeapleDialog(false)} disableScrollLock={true} style={{ width : '100%', position : 'fixed', left: '50%', transform: 'translateX(-50%)' }} > - 何人前かを入力 + 買うものリストへ追加
@@ -343,10 +344,10 @@ const AddRecipe: React.FC = () => { -
diff --git a/frontend/src/pages/StockPage.tsx b/frontend/src/pages/StockPage.tsx index b359f94..981464f 100644 --- a/frontend/src/pages/StockPage.tsx +++ b/frontend/src/pages/StockPage.tsx @@ -39,13 +39,6 @@ const formatDateLocal = (date: Date) => { return `${year}-${month}-${day}`; }; -// 日付をyyyy-MM-dd形式で返す関数 -const formatDateLocal = (date: Date) => { - const year = date.getFullYear(); - const month = (date.getMonth() + 1).toString().padStart(2, '0'); - const day = date.getDate().toString().padStart(2, '0'); - return `${year}-${month}-${day}`; -}; // 新規在庫の初期状態 const EMPTY_STOCK: Omit & { stuffId: number | null } & { newAddition: boolean } = {