@@ -4,6 +4,7 @@ import { Link, Outlet, useLocation } from 'react-router-dom';
44import ScrollWrapper from './ScrollWrapper' ;
55import MovedInquiredLink from '../customerService/MoveInquiredLink' ;
66import useAuthStore from '../../../store/authStore' ;
7+ import { ADMIN_ROUTE , ROUTES } from '../../../constants/routes' ;
78
89interface Filter {
910 title : string ;
@@ -23,15 +24,26 @@ export default function ContentTab({ filter, $justifyContent }: ContentProps) {
2324 const [ filterId , setFilterId ] = useState < number > ( ) ;
2425
2526 useEffect ( ( ) => {
26- const currentFilter = filter . find ( ( item ) =>
27- pathname . includes ( item . url . split ( '/' ) . pop ( ) || '' )
28- ) ;
29- if ( currentFilter && currentFilter . id !== undefined ) {
30- setFilterId ( currentFilter . id ) ;
27+ if (
28+ pathname . includes ( ROUTES . notificationsAppliedProjects ) ||
29+ pathname . includes ( ROUTES . activityInquiries ) ||
30+ pathname . includes ( ADMIN_ROUTE . appliedProject )
31+ ) {
32+ return setFilterId ( 1 ) ;
33+ } else if (
34+ pathname . includes ( ROUTES . notificationsCheckedApplicants ) ||
35+ pathname . includes ( ADMIN_ROUTE . joinedProject )
36+ ) {
37+ return setFilterId ( 2 ) ;
38+ } else if (
39+ pathname . includes ( `${ ROUTES . myPageNotifications } /${ ROUTES . comments } ` ) ||
40+ pathname . includes ( ADMIN_ROUTE . createdProject )
41+ ) {
42+ return setFilterId ( 3 ) ;
3143 } else {
32- setFilterId ( filter [ 0 ] ?. id || 0 ) ;
44+ return setFilterId ( 0 ) ;
3345 }
34- } , [ pathname , filter ] ) ;
46+ } , [ setFilterId , pathname ] ) ;
3547
3648 function handleChangeId ( id : number ) {
3749 setFilterId ( id ) ;
@@ -46,6 +58,7 @@ export default function ContentTab({ filter, $justifyContent }: ContentProps) {
4658 to = { filter . url }
4759 onClick = { ( ) => handleChangeId ( filter . id as number ) }
4860 >
61+ { ' ' }
4962 < S . WrapperTitle $selected = { filter ?. id === filterId } >
5063 < S . FilterTitle > { filter . title } </ S . FilterTitle >
5164 </ S . WrapperTitle >
0 commit comments