11import { Icon , useCall , useCallStateHooks } from '@stream-io/video-react-sdk' ;
22import { decodeBase64 } from 'stream-chat' ;
3+ import { useRouter } from 'next/router' ;
34import { getConnectionString } from '../lib/connectionString' ;
45
56export const DevMenu = ( ) => {
67 const call = useCall ( ) ;
78 const { useLocalParticipant } = useCallStateHooks ( ) ;
89 const localParticipant = useLocalParticipant ( ) ;
10+ const router = useRouter ( ) ;
11+ const withParams = ( url : string ) => {
12+ const targetUrl = new URL ( url , window . location . origin ) ;
13+ const existingParams = targetUrl . searchParams ;
14+ const params = router . query ;
15+ for ( const key in params ) {
16+ existingParams . set ( key , params [ key ] as string ) ;
17+ }
18+ return targetUrl . toString ( ) ;
19+ } ;
920 return (
1021 < ul className = "rd__dev-menu" >
1122 < li className = "rd__dev-menu__item" >
@@ -65,7 +76,9 @@ export const DevMenu = () => {
6576 < li className = "rd__dev-menu__item" >
6677 < a
6778 className = "rd__link rd__link--faux-button rd__link--align-left"
68- href = { `${ process . env . NEXT_PUBLIC_BASE_PATH || '' } /call-recordings` }
79+ href = { withParams (
80+ `${ process . env . NEXT_PUBLIC_BASE_PATH || '' } /call-recordings` ,
81+ ) }
6982 target = "_blank"
7083 rel = "noreferrer"
7184 >
@@ -102,7 +115,7 @@ export const DevMenu = () => {
102115 { call && (
103116 < a
104117 className = "rd__link rd__link--faux-button rd__link--align-left"
105- href = { `/stats/${ call . cid } ` }
118+ href = { withParams ( `/stats/${ call . cid } ` ) }
106119 rel = "noreferrer"
107120 target = "_blank"
108121 >
@@ -112,7 +125,9 @@ export const DevMenu = () => {
112125 { call && localParticipant && (
113126 < a
114127 className = "rd__link rd__link--faux-button rd__link--align-left"
115- href = { `/stats/${ call . cid } ?user_id=${ call . currentUserId } &user_session_id=${ call [ 'unifiedSessionId' ] || localParticipant . sessionId } &kind=details` }
128+ href = { withParams (
129+ `/stats/${ call . cid } ?user_id=${ call . currentUserId } &user_session_id=${ call [ 'unifiedSessionId' ] || localParticipant . sessionId } &kind=details` ,
130+ ) }
116131 rel = "noreferrer"
117132 target = "_blank"
118133 >
@@ -122,7 +137,9 @@ export const DevMenu = () => {
122137 { call && localParticipant && (
123138 < a
124139 className = "rd__link rd__link--faux-button rd__link--align-left"
125- href = { `/stats/${ call . cid } ?user_id=${ call . currentUserId } &user_session_id=${ call [ 'unifiedSessionId' ] || localParticipant . sessionId } &kind=timeline` }
140+ href = { withParams (
141+ `/stats/${ call . cid } ?user_id=${ call . currentUserId } &user_session_id=${ call [ 'unifiedSessionId' ] || localParticipant . sessionId } &kind=timeline` ,
142+ ) }
126143 rel = "noreferrer"
127144 target = "_blank"
128145 >
0 commit comments