Доработка фронта

This commit is contained in:
Kayashov.SM
2025-04-21 16:22:36 +04:00
parent 704875d297
commit 23316b79f0
13 changed files with 211 additions and 85 deletions

View File

@@ -19,6 +19,7 @@ import {IngredientList} from "../../../components/Ingredients/IngredientList";
import {blue} from "@mui/material/colors";
import UpIcon from "@mui/icons-material/KeyboardArrowUp";
import Switch from "@mui/material/Switch";
import {useSelect} from "../../../hooks/useSelect";
export function IngredientsPage() {
const [value, setValue] = React.useState(0);
@@ -27,8 +28,7 @@ export function IngredientsPage() {
const [loading, setLoading] = useState(true);
const [findString, setFindString] = useState("");
const [ingredients, setIngredients] = useState([]);
const [openModal, setOpenModal] = useState(false);
const [selectedInfo, setSelectedInfo] = useState(null);
const {getIngredient, selectIngredient} = useSelect();
const {createError} = useAlert();
useEffect(() => {
@@ -76,12 +76,7 @@ export function IngredientsPage() {
});
}
const handleOpenModal = (i) => {
setOpenModal(true);
setSelectedInfo(i);
}
const handleCloseModal = () => {
setSelectedInfo(null);
setOpenModal(false);
selectIngredient(i)
}
return (
@@ -147,7 +142,7 @@ export function IngredientsPage() {
{/*Загрузчик*/}
<Loading loading={loading}/>
{/*Модальное окно информации об ингредиенте*/}
<IngredientInfoModal ingredient={selectedInfo} open={openModal} closeHandler={handleCloseModal}/>
<IngredientInfoModal ingredient={getIngredient()}/>
</Box>
)
}