Skip to content

Commit

Permalink
merge/fix: 전역 상태 관리 메서드명 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
ro-el-c authored Aug 12, 2024
2 parents 9dccfa2 + ff44b27 commit dcd18e7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
21 changes: 14 additions & 7 deletions src/components/global/GlobalNavigationBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ const GlobalNavigationBar = (props: { children?: React.ReactNode }) => {
const [isOverlayVisible, setIsOverlayVisible] = useState<boolean>(false);
const location = useLocation();

const { loginNeeded, registerStatus, setLoginNeeded } = useRegisterStore();
const { loginNeeded, registerStatus, setLoginNeededStatus } =
useRegisterStore();

useEffect(() => {
if (registerStatus !== RegisterStatus.LOG_IN && loginNeeded) {
Expand All @@ -34,12 +35,12 @@ const GlobalNavigationBar = (props: { children?: React.ReactNode }) => {
}, [loginNeeded, registerStatus]);

const handleClose = () => {
setLoginNeeded(false);
setLoginNeededStatus(false);
setIsOverlayVisible(false);
};

const handleLoginClick = () => {
setLoginNeeded(true);
setLoginNeededStatus(true);
setIsOverlayVisible(true);
};

Expand All @@ -54,7 +55,9 @@ const GlobalNavigationBar = (props: { children?: React.ReactNode }) => {
<MapuLogo className={styles.icon} />
</div>
<Link to="/timeline" className={styles.link}>
<div className={`${styles.iconContainer} ${isHomeActive ? styles.iconContainer_on : styles.iconContainer_off}`}>
<div
className={`${styles.iconContainer} ${isHomeActive ? styles.iconContainer_on : styles.iconContainer_off}`}
>
{isHomeActive ? (
<Home_on className={styles.icon} />
) : (
Expand All @@ -63,16 +66,20 @@ const GlobalNavigationBar = (props: { children?: React.ReactNode }) => {
</div>
</Link>
<Link to="/explore" className={styles.link}>
<div className={`${styles.iconContainer} ${isExploreActive ? styles.iconContainer_on : styles.iconContainer_off}`}>
{isExploreActive ? (
<div
className={`${styles.iconContainer} ${isExploreActive ? styles.iconContainer_on : styles.iconContainer_off}`}
>
{isExploreActive ? (
<Explore_on className={styles.icon} />
) : (
<Explore_off className={styles.icon} />
)}
</div>
</Link>
<Link to="/user/:userId" className={styles.link}>
<div className={`${styles.iconContainer} ${isUserpageActive ? styles.iconContainer_on : styles.iconContainer_off}`}>
<div
className={`${styles.iconContainer} ${isUserpageActive ? styles.iconContainer_on : styles.iconContainer_off}`}
>
<User className={styles.icon} />
</div>
</Link>
Expand Down
7 changes: 4 additions & 3 deletions src/components/userProfile/UserInfoBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ const UserInfoBar = (props: { children?: React.ReactNode }) => {
const [isLog, setIsLog] = useState<boolean>(false);
const [isOverlayVisible, setIsOverlayVisible] = useState<boolean>(false);

const { loginNeeded, registerStatus, setLoginNeeded } = useRegisterStore();
const { loginNeeded, registerStatus, setLoginNeededStatus } =
useRegisterStore();

const openFollowing = () => {
setIsFollowingOpen(true);
Expand Down Expand Up @@ -45,12 +46,12 @@ const UserInfoBar = (props: { children?: React.ReactNode }) => {
}, [loginNeeded, registerStatus]);

const handleClose = () => {
setLoginNeeded(false);
setLoginNeededStatus(false);
setIsOverlayVisible(false);
};

const handleLoginClick = () => {
setLoginNeeded(true);
setLoginNeededStatus(true);
setIsOverlayVisible(true);
};

Expand Down
5 changes: 2 additions & 3 deletions src/pages/UserProfile/UserProfile.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React,{ useState,useEffect } from 'react';
import React, { useState, useEffect } from 'react';
import { Outlet, useParams } from 'react-router-dom';

import GlobalNavigationBar from '../../components/global/GlobalNavigationBar';
Expand All @@ -16,7 +16,7 @@ const UserProfile = () => {
const [isLog, setIsLog] = useState<boolean>(false);
const [isOverlayVisible, setIsOverlayVisible] = useState<boolean>(false);

const { loginNeeded, registerStatus, setLoginNeeded } = useRegisterStore();
const { loginNeeded, registerStatus } = useRegisterStore();

useEffect(() => {
if (registerStatus !== RegisterStatus.LOG_IN && loginNeeded) {
Expand All @@ -30,7 +30,6 @@ const UserProfile = () => {
}
}, [loginNeeded, registerStatus]);


useEffect(() => {
const titleElement = document.getElementsByTagName('title')[0];
titleElement.innerHTML = `@@@님의 페이지 | MAPU`; //api 호출 -> 사용자 타이틀에 추가
Expand Down

0 comments on commit dcd18e7

Please sign in to comment.