diff --git a/frontend/src/components/BuyDialog.tsx b/frontend/src/components/BuyDialog.tsx index 6acfdd3..27485fe 100644 --- a/frontend/src/components/BuyDialog.tsx +++ b/frontend/src/components/BuyDialog.tsx @@ -26,12 +26,14 @@ const formatDateLocal = (date: Date) => { const BuyDialog = ({ openDialog, setOpenDialog, + stuffName, newStock, setNewStock, onSubmit, }: { openDialog: boolean, setOpenDialog: (open: boolean) => void, + stuffName: string, newStock: NewStock, setNewStock: (tobuy: NewStock) => void, onSubmit: () => void, @@ -40,11 +42,21 @@ const BuyDialog = ({ return ( - setOpenDialog(false)} disableScrollLock={true} PaperProps={{ sx: { minHeight: '500px', maxHeight: '80vh' } }} + setOpenDialog(false)} disableScrollLock={true} PaperProps={{ sx: { minHeight: '600px', maxHeight: '80vh' } }} > 在庫登録 + {/* 材料名表示 */} + + {/* 価格入力フィールド */} {/* 購入日・消費期限を横並びに */} diff --git a/frontend/src/components/Layout.tsx b/frontend/src/components/Layout.tsx index 01b985e..75a6d10 100644 --- a/frontend/src/components/Layout.tsx +++ b/frontend/src/components/Layout.tsx @@ -17,7 +17,10 @@ import { ListItemButton, Divider, IconButton, - AlertColor + AlertColor, + BottomNavigation, + BottomNavigationAction, + Paper } from '@mui/material'; import { Menu as MenuIcon, @@ -25,6 +28,7 @@ import { Inventory as InventoryIcon, // テストページ用のアイコン Science as ScienceIcon, // 鈴木 SoupKitchen as SoupKitchenIcon, + ShoppingCart as ShoppingCartIcon } from '@mui/icons-material'; import { useNavigate, Outlet, useLocation } from 'react-router-dom'; import { MessageContext } from './MessageContext'; @@ -34,6 +38,7 @@ const Layout: React.FC = () => { const navigate = useNavigate(); const location = useLocation(); const [drawerOpen, setDrawerOpen] = useState(false); + const [bottomNavi, setBottomNavi] = useState(1); /** * ログアウト処理を行うハンドラー関数 @@ -44,19 +49,9 @@ const Layout: React.FC = () => { navigate('/login'); }; - /** - * 画面遷移処理を行うハンドラー関数 - * 指定されたパスに遷移し、サイドメニューを閉じる - */ - const handleNavigate = (path: string) => { - navigate(path); - setDrawerOpen(false); - }; + - // 現在のパスに基づいてメニュー項目が選択状態かどうかを判定 - const isSelected = (path: string): boolean => { - return location.pathname === path; - }; + // メニューを開閉するハンドラー const toggleDrawer = () => { @@ -96,21 +91,27 @@ const Layout: React.FC = () => { sessionStorage.removeItem('globalMessage'); }; + const handleBottomNavigation = (event: React.SyntheticEvent, newValue: any) => { + setBottomNavi(newValue); + switch(newValue) { + case 0: + navigate('stock'); + break; + case 1: + navigate('tasks'); + break; + case 2: + navigate('recipeList'); + break; + } + // ここでルーティング処理などを行う + } return ( {/* ヘッダー部分 - アプリ名とログアウトボタンを表示 */} - - - shopchop @@ -120,52 +121,31 @@ const Layout: React.FC = () => { - {/* サイドメニュー */} - setDrawerOpen(false)} - > - + { + setBottomNavi(newValue); + switch(newValue) { + case 0: + navigate('stock'); + break; + case 1: + navigate('tasks'); + break; + case 2: + navigate('recipeList'); + break; + } + // ここでルーティング処理などを行う + }} > - - handleNavigate('/tasks')} - selected={isSelected('/tasks')} - > - - - - {/* テストページへのリンクを追加 */} - - {/* 在庫リストへのリンクを追加 */} - handleNavigate('/addRecipe')} - selected={isSelected('/addRecipe')} - > - - - - handleNavigate('/recipeList')} - selected={isSelected('/recipeList')} - > - - - - handleNavigate('/stock')} - selected={isSelected('/stock')} - > - - - - - - - + } /> + } /> + } /> + + {/* メインコンテンツ領域 - 子ルートのコンポーネントがここに表示される */} diff --git a/frontend/src/pages/StockPage.tsx b/frontend/src/pages/StockPage.tsx index 7688049..47603c9 100644 --- a/frontend/src/pages/StockPage.tsx +++ b/frontend/src/pages/StockPage.tsx @@ -149,7 +149,7 @@ const StockPage: React.FC = () => { }; /** - * カテゴリー選択?? + * カテゴリー選択 */ const onChangeCategory = async (category: string) => { setNewStock({ ...newStock, category }) @@ -273,8 +273,6 @@ const StockPage: React.FC = () => { 食材名 数量 - 購入価格 - 購入日 消費・賞味期限 @@ -293,8 +291,6 @@ const StockPage: React.FC = () => { > {stock.stuffName} {stock.amount} - {stock.price} - {formatDate(stock.buyDate)} @@ -333,6 +329,54 @@ const StockPage: React.FC = () => { value={editStock.price} onChange={handleChange} /> + {/* 購入日・消費期限を横並びに */} + + {/* 購入日 */} + { + if (editStock) { + setEditStock({ + ...editStock, + buyDate: date ? formatDateLocal(date) : '', + }); + } + }} + dateFormat="yyyy/MM/dd" + customInput={ + + } + isClearable + /> + {/* 消費・賞味期限 */} + { + if (editStock) { + setEditStock({ + ...editStock, + expDate: date ? formatDateLocal(date) : '', + }); + } + }} + dateFormat="yyyy/MM/dd" + customInput={ + + } + isClearable + /> + + {/* 以前の書き方 { name="expDate" value={editStock.expDate} onChange={handleChange} - /> - - - - + /> */} + + + + )} @@ -378,13 +419,26 @@ const StockPage: React.FC = () => { <> 【{selectedRow.stuffName}】を削除します。 ⚠️ 注意: 削除すると復元できません。 - - + + + + + )} @@ -401,6 +455,7 @@ const StockPage: React.FC = () => { + {/* */} {/* 在庫の食材追加ボタン */} {/* 在庫の食材編集ボタン(全テーブル共通) */} - {/* 在庫の食材削除ボタン (全テーブル共通) */} diff --git a/frontend/src/pages/TaskListPage.tsx b/frontend/src/pages/TaskListPage.tsx index 0a20838..fd2335f 100644 --- a/frontend/src/pages/TaskListPage.tsx +++ b/frontend/src/pages/TaskListPage.tsx @@ -252,6 +252,7 @@ const TaskListPage: React.FC = () => { { setOpenInfoDialog(true) + setEditingItem(tobuy) setSelectedToBuyId(tobuy.tobuyId) // handleDeleteTask(tobuy.tobuyId) }}> @@ -295,28 +296,28 @@ const TaskListPage: React.FC = () => { {/* 新規材料作成ボタン - 画面下部に固定表示 */} - + 材料のみ追加 setOpenAddToBuyDialog(true)} > {/*新規料理追加ボタン - 画面下部に固定表示 */} - + 料理から追加 { // setOpenAddToBuyDialog(true); navigate('/RecipeList'); @@ -331,7 +332,7 @@ const TaskListPage: React.FC = () => { {/* 購入処理(在庫登録)のための数値入力ダイアログ */} - + {/* 数量変更ダイアログ */}