diff --git a/src/components/MainFeed.jsx b/src/components/MainFeed.jsx index cd7a70e..1a3809e 100644 --- a/src/components/MainFeed.jsx +++ b/src/components/MainFeed.jsx @@ -6,6 +6,7 @@ import RightSidebar from "./RightSidebar"; import PostOnFeed from "./PostOnFeed"; import CreateUpdatePost from "./CreateUpdatePost"; import MenuIcon from "./icons/MenuIcon"; +import { ProfileModal } from "./profile"; /** * MainFeed — корневой компонент приложения. @@ -23,6 +24,15 @@ export default function MainFeed() { const [modalOpen, setModalOpen] = useState(false); // Объявление, которое сейчас редактируется (null — модалка закрыта) const [editAd, setEditAd] = useState(null); + // Открыто ли модальное окно редактирования профиля + const [profileModalOpen, setProfileModalOpen] = useState(false); + // Данные профиля пользователя + const [profileData, setProfileData] = useState({ + firstName: "Иван", + lastName: "Иванов", + email: "ivan@example.com", + phone: "+7 (999) 123-45-67", + }); // Массив объявлений из API const [ads, setAds] = useState([]); // Set id объявлений, которые пользователь лайкнул (только локально) @@ -149,6 +159,7 @@ export default function MainFeed() { activeNav={activeNav} onClose={() => setSidebarOpen(false)} onNavClick={setActiveNav} + onEditProfile={() => setProfileModalOpen(true)} />
@@ -215,6 +226,14 @@ export default function MainFeed() { onSuccess={handleEditSave} /> )} + + {/* Модальное окно редактирования профиля */} + {profileModalOpen && ( + setProfileModalOpen(false)} + initialData={profileData} + /> + )}
); -} \ No newline at end of file +} diff --git a/src/components/Sidebar.jsx b/src/components/Sidebar.jsx index 9c00ded..338f6d1 100644 --- a/src/components/Sidebar.jsx +++ b/src/components/Sidebar.jsx @@ -4,8 +4,8 @@ import {NAV_BOTTOM, NAV_ITEMS} from "../config/feedConstants"; import {NavIcons} from "./icons/NavIcons"; import Profile from "./profile/Profile"; -export default function Sidebar({ open, activeNav, onClose, onNavClick }) { - const [profileData, setProfileData] = useState({ +export default function Sidebar({ open, activeNav, onClose, onNavClick, onEditProfile }) { + const [profileData] = useState({ firstName: "Иван", lastName: "Иванов", email: "ivan@example.com", @@ -48,9 +48,9 @@ export default function Sidebar({ open, activeNav, onClose, onNavClick }) { ); })}
- +
); -} \ No newline at end of file +} diff --git a/src/components/profile/Profile.jsx b/src/components/profile/Profile.jsx index cc43ab1..af88639 100644 --- a/src/components/profile/Profile.jsx +++ b/src/components/profile/Profile.jsx @@ -1,19 +1,11 @@ -import React, { useState } from "react"; -import ProfileModal from "./ProfileModal"; import ProfileAvatar from "./ProfileAvatar"; import ProfileInfo from "./ProfileInfo"; -export default function Profile({ data = {} }) { - const [showModal, setShowModal] = useState(false); - +export default function Profile({ data = {}, onEdit }) { return ( - <> -
setShowModal(true)}> - - -
- - {showModal && setShowModal(false)} initialData={data} />} - +
+ + +
); }