File tree Expand file tree Collapse file tree 5 files changed +9
-9
lines changed
Expand file tree Collapse file tree 5 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 11import styled from 'styled-components' ;
22
3- export const Container = styled . div < { $isAdmin : boolean } > `
3+ export const Container = styled . div < { $isAdmin : boolean | undefined } > `
44 display: flex;
55 flex-direction: column;
66 border: 2px solid #f0f0f0;
Original file line number Diff line number Diff line change @@ -22,9 +22,9 @@ interface SidebarProps {
2222const Sidebar = ( { menuItems, profileImage, nickname } : SidebarProps ) => {
2323 const isLoggedIn = useAuthStore ( ( state ) => state . isLoggedIn ) ;
2424 const location = useLocation ( ) ;
25+ const isAdmin = useAuthStore ( ) . userData ?. admin ;
2526 const isUserPage = location . pathname . includes ( '/user' ) ;
2627 const isManagePage = location . pathname . includes ( '/manage' ) ;
27- const isAdmin = location . pathname . includes ( '/admin' ) ;
2828
2929 const isMyProfile = isLoggedIn && ! isUserPage && ! isManagePage ;
3030 const getActiveIndex = useCallback ( ( ) => {
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import * as S from './ContentTab.styled';
33import { Link , Outlet , useLocation } from 'react-router-dom' ;
44import ScrollWrapper from './ScrollWrapper' ;
55import MovedInquiredLink from '../customerService/MoveInquiredLink' ;
6+ import useAuthStore from '../../../store/authStore' ;
67
78interface Filter {
89 title : string ;
@@ -18,8 +19,8 @@ interface ContentProps {
1819
1920export default function ContentTab ( { filter, $justifyContent } : ContentProps ) {
2021 const { pathname } = useLocation ( ) ;
22+ const isAdmin = useAuthStore ( ) . userData ?. admin ;
2123 const [ filterId , setFilterId ] = useState < number > ( ) ;
22- const isAdmin = pathname . includes ( '/admin' ) ;
2324
2425 useEffect ( ( ) => {
2526 const currentFilter = filter . find ( ( item ) =>
Original file line number Diff line number Diff line change 1- import { useLocation } from 'react-router-dom' ;
21import {
32 ACTIVITY_FILTER ,
43 ACTIVITY_FILTER_ADMIN ,
54} from '../../../../constants/user/myPageFilter' ;
65import ContentTab from '../ContentTab' ;
6+ import useAuthStore from '../../../../store/authStore' ;
77
88export default function ActivityLog ( ) {
9- const { pathname } = useLocation ( ) ;
10- const isAdmin = pathname . includes ( '/admin' ) ;
9+ const isAdmin = useAuthStore ( ) . userData ?. admin ;
1110
1211 return (
1312 < ContentTab
Original file line number Diff line number Diff line change 1- import { Link , useLocation } from 'react-router-dom' ;
1+ import { Link } from 'react-router-dom' ;
22import * as S from '../../mypage/joinedProject/MyJoinProjects.styled' ;
33import { ROUTES } from '../../../../constants/routes' ;
44import NoContent from '../../../common/noContent/NoContent' ;
55import ScrollWrapper from '../../mypage/ScrollWrapper' ;
66import Spinner from '../../mypage/Spinner' ;
77import Project from '../../mypage/joinedProject/Project' ;
88import { useGetUserProjectList } from '../../../../hooks/user/useGetUserProjectList' ;
9+ import useAuthStore from '../../../../store/authStore' ;
910
1011export default function UserProjects ( ) {
11- const { pathname } = useLocation ( ) ;
12- const isAdmin = pathname . includes ( '/admin' ) ;
12+ const isAdmin = useAuthStore ( ) . userData ?. admin ;
1313 const { userProjectData, isLoading, title } = useGetUserProjectList ( ) ;
1414
1515 if ( isLoading ) {
You can’t perform that action at this time.
0 commit comments