@@ -7,10 +7,14 @@ import ChatPanel from '@/components/chat/message/ChatPanel';
77import { useAtomValue , useSetAtom } from 'jotai' ;
88import { panelAtom } from '@/atoms/chatAtoms' ;
99import { Suspense , useEffect } from 'react' ;
10+ import { userAtom } from '@/atoms/authAtoms' ;
11+ import { useRouter } from 'next/navigation' ;
1012
1113export default function Chat ( ) {
1214 const panel = useAtomValue ( panelAtom ) ;
1315 const setPanel = useSetAtom ( panelAtom ) ;
16+ const user = useAtomValue ( userAtom ) ;
17+ const router = useRouter ( ) ;
1418
1519 // lg 이상일 때 panel이 'chat'이면 자동으로 'closet'으로 전환
1620 useEffect ( ( ) => {
@@ -29,6 +33,18 @@ export default function Chat() {
2933 return ( ) => mq . removeEventListener ( 'change' , handler ) ;
3034 } , [ panel , setPanel ] ) ;
3135
36+ // useEffect(() => {
37+ // console.log(user);
38+ // if (!user) {
39+ // alert('로그인이 필요합니다.');
40+ // router.push('/signin');
41+ // }
42+ // }, [user, router]);
43+
44+ // if (!user) {
45+ // return null;
46+ // }
47+
3248 return (
3349 < Suspense >
3450 < div className = "flex flex-col" >
@@ -41,26 +57,16 @@ export default function Chat() {
4157 < div className = "hidden lg:flex w-full lg:w-1/2 h-full lg:transition-all lg:duration-300" >
4258 < ChatPanel />
4359 </ div >
44- { panel === 'closet' && (
45- < div className = "hidden lg:flex flex-col h-full w-full lg:w-1/2 bg-beige border-l border-navy-200" >
46- < div className = "flex-shrink-0" >
47- < ChatHeader />
48- </ div >
49- < div className = "flex-1 min-h-0" >
50- < ClosetPanel />
51- </ div >
60+
61+ < div className = "hidden lg:flex flex-col h-full w-full lg:w-1/2 bg-beige border-l border-navy-200" >
62+ < div className = "flex-shrink-0" >
63+ < ChatHeader />
5264 </ div >
53- ) }
54- { panel === 'fitting' && (
55- < div className = "hidden lg:flex flex-col h-full w-full lg:w-1/2 bg-beige border-l border-navy-200" >
56- < div className = "flex-shrink-0" >
57- < ChatHeader />
58- </ div >
59- < div className = "flex-1 min-h-0" >
60- < FittingPanel />
61- </ div >
65+ < div className = "flex-1 min-h-0" >
66+ { panel === 'closet' && < ClosetPanel /> }
67+ { panel === 'fitting' && < FittingPanel /> }
6268 </ div >
63- ) }
69+ </ div >
6470
6571 { /* 모바일/태블릿: 단일 패널 레이아웃 */ }
6672 < div className = "lg:hidden w-full h-[calc(100vh-5rem)]" >
0 commit comments