diff --git a/frontend/src/components/AddByRecipeDialog.tsx b/frontend/src/components/AddByRecipeDialog.tsx
index 266f1d7..f268942 100644
--- a/frontend/src/components/AddByRecipeDialog.tsx
+++ b/frontend/src/components/AddByRecipeDialog.tsx
@@ -76,7 +76,7 @@ const AddByRecipeDialog = ({
/>
-
+
{recipe.recipeName}
@@ -108,13 +108,20 @@ const AddByRecipeDialog = ({
type="number"
margin="dense"
label="何人前"
- className="numberField"
+ fullWidth
defaultValue={1}
value={numOfPeople}
onChange={(e) => {
- // const num = parseInt(e.target.value, 10);
- // setNumOfPeaple(!isNaN(num) ? num : '');
- setNumOfPeaple(e.target.value);
+ const value = e.target.value;
+ const parsedValue = parseInt(value, 10); // 数値に変換
+ if (/*!isNaN(parsedValue) && */ isNaN(parsedValue) || parsedValue >= 1) { //負数除外
+ setNumOfPeaple(value);
+ }
+ }}
+ onKeyDown={(e) => {
+ if (e.key === '-' || e.key === 'e' || e.key === 'E') {
+ e.preventDefault();
+ }
}}
inputProps={{ inputMode: "numeric", min: 1, pattern: "[0-9]*" }} // ここで整数のみ許可
@@ -132,7 +139,7 @@ const AddByRecipeDialog = ({
color="primary"
onClick={async () => {
const num = parseInt(numOfPeople, 10);
- if (!num || isNaN(num)) {
+ if (!num || isNaN(num) || num <= 0) {
showErrorMessage('人数が正しく入力されていません。');
return;
}
diff --git a/frontend/src/components/AddStuffAmountDialog.tsx b/frontend/src/components/AddStuffAmountDialog.tsx
index 3be6a05..4fe7d37 100644
--- a/frontend/src/components/AddStuffAmountDialog.tsx
+++ b/frontend/src/components/AddStuffAmountDialog.tsx
@@ -136,6 +136,11 @@ const AddStuffAmountDialog = ({
setNewItem({ ...newItem, amount: parsedValue }); // number型で保存
}
}}
+ onKeyDown={(e) => {
+ if (e.key === '-' || e.key === 'e' || e.key === 'E') {
+ e.preventDefault();
+ }
+ }}
className="numberField"
type="number"
inputProps={{ inputMode: "numeric", pattern: "[0-9]*" }} // ここで整数のみ許可
diff --git a/frontend/src/components/DeleteStuffDialog.tsx b/frontend/src/components/DeleteStuffDialog.tsx
index ec6b878..fe948b0 100644
--- a/frontend/src/components/DeleteStuffDialog.tsx
+++ b/frontend/src/components/DeleteStuffDialog.tsx
@@ -4,6 +4,7 @@ import {
DialogContent,
Button,
Typography,
+ DialogActions,
} from '@mui/material';
const DeleteStuffDialog = ({
@@ -18,24 +19,25 @@ const DeleteStuffDialog = ({
onSubmit: () => void,
}) => {
-{/* 削除ダイアログ */}
- return
+ {/* 削除ダイアログ */ }
+ return
}
diff --git a/frontend/src/pages/RecipeList.tsx b/frontend/src/pages/RecipeList.tsx
index b015cd9..53bd410 100644
--- a/frontend/src/pages/RecipeList.tsx
+++ b/frontend/src/pages/RecipeList.tsx
@@ -120,20 +120,20 @@ const RecipeList: React.FC = () => {
: <>>}
{recipe.maxServings === 0 ?
-
-
+
+
:
-
-
+
+
}
-
-
+ {
navigate('/addRecipe/' + recipe.recipeId);
}}
diff --git a/frontend/src/pages/StockPage.tsx b/frontend/src/pages/StockPage.tsx
index f99288e..e63799d 100644
--- a/frontend/src/pages/StockPage.tsx
+++ b/frontend/src/pages/StockPage.tsx
@@ -453,6 +453,7 @@ const StockPage: React.FC = () => {
margin="normal"
name="amount"
type="number"
+ fullWidth
className="numberField"
value={editStock.amount}
onChange={handleChange}
@@ -470,7 +471,7 @@ const StockPage: React.FC = () => {
margin="normal"
name="buyAmount"
type="number"
- className="numberField"
+ fullWidth
value={editStock.buyAmount}
onChange={handleChange}
inputProps={{ min: 0 }}
@@ -484,10 +485,10 @@ const StockPage: React.FC = () => {
{/* 購入価格フィールド */}
{
{/* 購入日・賞味期限入力 */}
setEditStock({ ...editStock, buyDate, expDate })} />
-
-
+ >
+ )}
+
+
-
{/* 削除ダイアログ */}
@@ -613,10 +613,10 @@ const StockPage: React.FC = () => {
{!openCategory[category] ? : }
{category}
- {!stocks
+ {openCategory[category] && (!stocks
? 読み込み中...
: StockTable(stocks, [category])
- }
+ )}
)
})}
diff --git a/frontend/src/pages/TaskListPage.tsx b/frontend/src/pages/TaskListPage.tsx
index 6003d6a..bed98ea 100644
--- a/frontend/src/pages/TaskListPage.tsx
+++ b/frontend/src/pages/TaskListPage.tsx
@@ -290,7 +290,7 @@ const TaskListPage: React.FC = () => {
{/* 買い物リスト:数量変更ボタン */}
- {
setOpenAmountDialog(true)
setEditingItem(tobuy)
@@ -301,7 +301,7 @@ const TaskListPage: React.FC = () => {
{/* 買い物リスト:食材情報記入ボタン */}
- {
setOpenInfoDialog(true)
setEditingItem(tobuy)