moved icon profile on up
This commit is contained in:
@@ -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() {
|
||||
Разместить объявление
|
||||
</button>
|
||||
</div>
|
||||
{/* Пустой спейсер симметрично уравновешивает бургер слева */}
|
||||
<div className="f-topbar-spacer" />
|
||||
{/* Иконка профиля в правом углу */}
|
||||
<div className="f-topbar-profile" onClick={() => isAuthenticated ? setProfileModalOpen(true) : setAuthModalOpen(true)}>
|
||||
{isAuthenticated ? (
|
||||
<ProfileAvatar avatar={profileData.avatar} name={`${profileData.firstName || ""} ${profileData.lastName || ""}`} />
|
||||
) : (
|
||||
<span className="f-topbar-login-icon">🔑</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Фильтр по типу объявления */}
|
||||
|
||||
@@ -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({
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
<div className="f-sb-divider" />
|
||||
|
||||
{isAuthenticated ? (
|
||||
<>
|
||||
<Profile data={profileData} onEdit={onEditProfile} />
|
||||
<div
|
||||
className="f-sb-item"
|
||||
onClick={() => { onLogout(); onClose(); }}
|
||||
style={{ color: "rgba(255,107,107,.7)", marginTop: 8 }}
|
||||
>
|
||||
<span style={{ fontSize: "1.1rem" }}>🚪</span> Выйти
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<div
|
||||
className="f-sb-item"
|
||||
onClick={() => { onLoginClick(); onClose(); }}
|
||||
style={{ color: "#2de0c8" }}
|
||||
>
|
||||
<span style={{ fontSize: "1.1rem" }}>🔑</span> Войти
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
|
||||
@@ -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 && <p className="f-err-msg" style={{ marginBottom: 10 }}>{saveError}</p>}
|
||||
|
||||
<SubmitButton loading={compressing || saving} onSubmit={handleSubmit} />
|
||||
|
||||
<button
|
||||
type="button"
|
||||
className="f-modal-logout"
|
||||
onClick={() => { logout(); onClose(); }}
|
||||
>
|
||||
Выйти
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user