@@ -28,18 +28,9 @@ const CollaborationRoomPage: React.FC = () => {
28
28
const [ showChat , setShowChat ] = useState ( false ) ;
29
29
const [ loading , setLoading ] = useState < boolean > ( true ) ;
30
30
const [ error , setError ] = useState < string | null > ( null ) ;
31
- const resizeTimeoutRef = useRef < NodeJS . Timeout > ( ) ;
32
31
33
32
// Extract details from location.state if available
34
33
const { roomId, attemptStartedAt, matchUserId, questionId } = locationState || { } ;
35
- const handleResize = useCallback ( ( ) => {
36
- if ( resizeTimeoutRef . current ) {
37
- clearTimeout ( resizeTimeoutRef . current ) ;
38
- }
39
- resizeTimeoutRef . current = setTimeout ( ( ) => {
40
- console . log ( "Resizing..." ) ;
41
- } , 100 ) ;
42
- } , [ ] ) ;
43
34
44
35
useEffect ( ( ) => {
45
36
const populateRoom = async ( ) => {
@@ -98,33 +89,19 @@ const CollaborationRoomPage: React.FC = () => {
98
89
fetchQuestion ( ) ;
99
90
} , [ room ] ) ;
100
91
101
- useEffect ( ( ) => {
102
- const resizeObserver = new ResizeObserver ( ( entries ) => {
103
- if ( entries [ 0 ] ) handleResize ( ) ;
104
- } ) ;
105
-
106
- const container = document . querySelector ( `.${ styles . container } ` ) ;
107
- if ( container ) resizeObserver . observe ( container ) ;
108
-
109
- return ( ) => {
110
- resizeObserver . disconnect ( ) ;
111
- if ( resizeTimeoutRef . current ) clearTimeout ( resizeTimeoutRef . current ) ;
112
- } ;
113
- } , [ handleResize ] ) ;
114
-
115
92
// Resizable Layout Configurations
116
93
const { position : questionPosition , separatorProps : verticalSeparatorProps } = useResizable ( {
117
94
axis : "x" ,
118
95
min : 300 ,
119
- initial : window . innerWidth * 0.3 ,
120
- max : window . innerWidth * 0.6
96
+ initial : window . innerWidth * 0.4 ,
97
+ max : 800
121
98
} ) ;
122
99
123
100
const { position : outputPosition , separatorProps : horizontalSeparatorProps } = useResizable ( {
124
101
axis : "y" ,
125
102
min : 60 ,
126
- initial : window . innerHeight * 0.2 ,
127
- max : window . innerHeight * 0.6 ,
103
+ initial : 60 ,
104
+ max : 500 ,
128
105
reverse : true
129
106
} ) ;
130
107
@@ -145,17 +122,10 @@ const CollaborationRoomPage: React.FC = () => {
145
122
< >
146
123
{ room && question ? (
147
124
< div className = { styles . container } >
148
- < div className = { styles . questionContainer } style = { { width : questionPosition } } >
149
- < div className = { styles . questionContent } >
150
- < ToggleButton showChat = { showChat } onClick = { ( ) => setShowChat ( ! showChat ) } />
151
- < div className = { styles . contentArea } >
152
- < div className = { `${ styles . questionDetail } ${ showChat ? styles . hidden : "" } ` } >
153
- < QuestionDetail question = { question } />
154
- </ div >
155
- < div className = { `${ styles . chatFrame } ${ showChat ? styles . visible : styles . hidden } ` } >
156
- < ChatFrame roomId = { room . roomId } />
157
- </ div >
158
- </ div >
125
+ < div className = { styles . leftContainer } style = { { width : questionPosition } } >
126
+ < ToggleButton showChat = { showChat } onClick = { ( ) => setShowChat ( ( showChat ) => ! showChat ) } />
127
+ < div className = { styles . questionAndChatContainer } >
128
+ { showChat ? < ChatFrame roomId = { roomId } /> : < QuestionDetail question = { question } /> }
159
129
</ div >
160
130
</ div >
161
131
0 commit comments