diff --git a/frontend/src/pages/AddRecipe.tsx b/frontend/src/pages/AddRecipe.tsx index 2618fda..ee570bd 100644 --- a/frontend/src/pages/AddRecipe.tsx +++ b/frontend/src/pages/AddRecipe.tsx @@ -58,6 +58,8 @@ const AddRecipe: React.FC = () => { // 編集しているアイテム const [editingItem, setEditingItem] = useState(emptyItem); const [editingItemIdx, setEditingItemIdx] = useState(0); + //削除確認ダイアログの表示状態 + const [openDeleteDialog, setOpenDeleteDialog] = useState(false); const loadRecipe = async () => { if (recipeId && !recipeName) { @@ -138,7 +140,7 @@ const AddRecipe: React.FC = () => { value={recipeSummary} onChange={(e) => setRecipeSummary(e.target.value)} /> -

+

材料リスト

{/* すべての材料情報を表示 */} @@ -179,7 +181,11 @@ const AddRecipe: React.FC = () => { tooltip: { sx: { backgroundColor: "white", color: "red", fontSize: "0.8rem", padding: "6px", borderRadius: "6px" } }, }}> setItems([...items.slice(0, index), ...items.slice(index + 1)])}> + onClick={() => { + setOpenDeleteDialog(true) + setEditingItem(item) + setEditingItemIdx(index) + }}> @@ -219,6 +225,29 @@ const AddRecipe: React.FC = () => { setOpenAddDialog(false); }} /> + {/* 削除ダイアログ */} + setOpenDeleteDialog(false)} disableScrollLock={true} + fullWidth + maxWidth="sm" + sx={{ overflow: "hidden" }} + > + 食材の削除 + + {editingItem && ( + <> + {editingItem.stuffName}を削除します。 + ⚠️ 注意: 削除すると復元できません。 + + + + )} + + + {/* 数量変更ダイアログ */}