diff --git a/.idea/aws.xml b/.idea/aws.xml new file mode 100644 index 0000000..b63b642 --- /dev/null +++ b/.idea/aws.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/src/components/MainFeed.jsx b/src/components/MainFeed.jsx index ab3f91a..d644c99 100644 --- a/src/components/MainFeed.jsx +++ b/src/components/MainFeed.jsx @@ -7,6 +7,7 @@ import RightSidebar from "./RightSidebar"; import PostOnFeed from "./PostOnFeed"; import CreateUpdatePost from "./CreateUpdatePost"; import MenuIcon from "./icons/MenuIcon"; +import ProfileAvatar from "./profile/ProfileAvatar"; import { ProfileModal } from "./profile"; import AuthModal from "./AuthModal"; import RulesModal from "./RulesModal"; @@ -22,7 +23,7 @@ import { usePostStatus } from "../hooks/usePostStatus"; */ export default function MainFeed() { const navigate = useNavigate(); - const { user, token, isAuthenticated, logout } = useAuthContext(); + const { user, token, isAuthenticated } = useAuthContext(); const { deletePost } = useDeletePost(); const { toggleFavorite, loadFavorites } = useFavorites(); const { markAsFound } = usePostStatus(); @@ -312,13 +313,7 @@ export default function MainFeed() { activeNav={activeNav} onClose={() => setSidebarOpen(false)} onNavClick={setActiveNav} - onEditProfile={() => { - if (!isAuthenticated) { setAuthModalOpen(true); return; } - setProfileModalOpen(true); - }} - profileData={profileData} isAuthenticated={isAuthenticated} - onLogout={logout} onLoginClick={() => setAuthModalOpen(true)} onRulesClick={() => setRulesModalOpen(true)} onReviewsClick={() => navigate("/reviews")} @@ -336,8 +331,14 @@ export default function MainFeed() { Разместить объявление - {/* Пустой спейсер симметрично уравновешивает бургер слева */} -
+ {/* Иконка профиля в правом углу */} +
isAuthenticated ? setProfileModalOpen(true) : setAuthModalOpen(true)}> + {isAuthenticated ? ( + + ) : ( + 🔑 + )} +
{/* Фильтр по типу объявления */} diff --git a/src/components/Sidebar.jsx b/src/components/Sidebar.jsx index 3cdbfda..0b1135d 100644 --- a/src/components/Sidebar.jsx +++ b/src/components/Sidebar.jsx @@ -1,7 +1,6 @@ import LogoIcon from "./icons/LogoIcon"; import {NAV_BOTTOM, NAV_ITEMS} from "../config/feedConstants"; import {NavIcons} from "./icons/NavIcons"; -import Profile from "./profile/Profile"; import { useNavigate } from "react-router-dom"; export default function Sidebar({ @@ -9,10 +8,7 @@ export default function Sidebar({ activeNav, onClose, onNavClick, - onEditProfile, - profileData = {}, isAuthenticated, - onLogout, onLoginClick, onRulesClick, onReviewsClick, @@ -82,28 +78,6 @@ export default function Sidebar({ ); })} -
- - {isAuthenticated ? ( - <> - -
{ onLogout(); onClose(); }} - style={{ color: "rgba(255,107,107,.7)", marginTop: 8 }} - > - 🚪 Выйти -
- - ) : ( -
{ onLoginClick(); onClose(); }} - style={{ color: "#2de0c8" }} - > - 🔑 Войти -
- )}
diff --git a/src/components/profile/ProfileModal.jsx b/src/components/profile/ProfileModal.jsx index 1c1ed2c..2a99adb 100644 --- a/src/components/profile/ProfileModal.jsx +++ b/src/components/profile/ProfileModal.jsx @@ -14,7 +14,7 @@ import { } from "./ProfileFormFields"; export default function ProfileModal({ onClose, initialData = {} }) { - const { user, updateUser } = useAuthContext(); + const { user, updateUser, logout } = useAuthContext(); const { updateProfile, loading: saving, error: saveError } = useUpdateProfile(); const [form, setForm] = useState(initializeFormState(initialData)); const [errors, setErrors] = useState({}); @@ -105,6 +105,14 @@ export default function ProfileModal({ onClose, initialData = {} }) { {saveError &&

{saveError}

} + + ); diff --git a/src/styles/layout.css b/src/styles/layout.css index b8fc4b5..bd60ca7 100644 --- a/src/styles/layout.css +++ b/src/styles/layout.css @@ -35,6 +35,22 @@ .f-topbar-center { flex: 1; display: flex; justify-content: center; } .f-topbar-spacer { width: 32px; flex-shrink: 0; } +/* ── Topbar Profile ── */ +.f-topbar-profile { + width: 32px; height: 32px; flex-shrink: 0; + display: flex; align-items: center; justify-content: center; + cursor: pointer; border-radius: 50%; + transition: background .15s; +} +.f-topbar-profile:hover { background: rgba(255,255,255,.08); } +.f-topbar-profile .f-profile-avatar { + width: 28px; height: 28px; border-width: 1.5px; +} +.f-topbar-profile .f-profile-avatar-placeholder { + width: 28px; height: 28px; font-size: 1rem; +} +.f-topbar-login-icon { font-size: 1.1rem; line-height: 1; } + /* ── Filter Bar ── */ .f-filter-bar { display: flex; gap: 10px; diff --git a/src/styles/modal.css b/src/styles/modal.css index ed3614b..1941ca0 100644 --- a/src/styles/modal.css +++ b/src/styles/modal.css @@ -105,6 +105,19 @@ .f-m-submit:active:not(:disabled) { transform: translateY(0); } .f-m-submit:disabled { opacity: .5; cursor: not-allowed; animation: none; background: #444; color: #aaa; } .f-m-submit-row { display: flex; align-items: center; justify-content: center; gap: 8px; } + +/* ── Modal Logout Button ── */ +.f-modal-logout { + display: block; width: 100%; margin-top: 16px; padding: 10px; + border-radius: 10px; border: 1px solid rgba(255,107,107,.3); + background: rgba(255,107,107,.08); color: rgba(255,107,107,.8); + font-family: var(--font); font-size: .9rem; font-weight: 700; cursor: pointer; + transition: background .15s, border-color .15s; +} +.f-modal-logout:hover { + background: rgba(255,107,107,.18); + border-color: rgba(255,107,107,.5); +} .f-m-spinner { width: 16px; height: 16px; border: 2px solid rgba(8,35,32,.3); border-top-color: #082320;