@@ -30,35 +30,36 @@ const externalLinks = (
30
30
activePage : ActivePage ,
31
31
location : WindowLocation ,
32
32
) : { label : string ; icon : IconName ; link : string ; type : string } [ ] => {
33
+ if ( ! activePage ) {
34
+ return [ ] ;
35
+ }
36
+
33
37
let githubEditPath = '#' ;
34
- let requestPath = '#' ;
35
-
36
- if ( activePage ) {
37
- const githubPathName = location . pathname . replace ( 'docs/' , '' ) ;
38
-
39
- if ( customGithubPaths [ githubPathName ] ) {
40
- githubEditPath = customGithubPaths [ githubPathName ] ;
41
- } else if ( activePage . template === 'mdx' ) {
42
- githubEditPath =
43
- githubBasePathMDX + ( activePage . page . index ? `${ githubPathName } /index.mdx` : `${ githubPathName } .mdx` ) ;
44
- } else {
45
- githubEditPath =
46
- githubBasePathTextile +
47
- ( activePage . page . index ? `${ githubPathName } /index.textile` : `${ githubPathName } .textile` ) ;
48
- }
38
+ const githubPathName = location . pathname . replace ( 'docs/' , '' ) ;
39
+
40
+ if ( customGithubPaths [ githubPathName ] ) {
41
+ githubEditPath = customGithubPaths [ githubPathName ] ;
42
+ } else if ( activePage . template === 'mdx' ) {
43
+ githubEditPath =
44
+ githubBasePathMDX + ( activePage . page . index ? `${ githubPathName } /index.mdx` : `${ githubPathName } .mdx` ) ;
45
+ } else {
46
+ githubEditPath =
47
+ githubBasePathTextile + ( activePage . page . index ? `${ githubPathName } /index.textile` : `${ githubPathName } .textile` ) ;
48
+ }
49
49
50
- const language = new URLSearchParams ( location . search ) . get ( 'lang' ) as LanguageKey ;
51
- const requestTitle = `Change request for: ${ activePage . page . link } ` ;
52
- const requestBody = encodeURIComponent ( `
50
+ const language = activePage . languages . length > 0 ? activePage . language : null ;
51
+ const requestTitle = `Change request for: ${ activePage . page . link } ` ;
52
+ const requestBody = encodeURIComponent ( `
53
53
**Page name**: ${ activePage . page . name }
54
54
**URL**: [${ activePage . page . link } ](https://ably.com${ activePage . page . link } )
55
55
${ language && languageInfo [ language ] ? `Language: **${ languageInfo [ language ] . label } **` : '' }
56
56
57
57
**Requested change or enhancement**:
58
58
` ) ;
59
59
60
- requestPath = `${ requestBasePath } ?title=${ requestTitle } &body=${ requestBody } ` ;
61
- }
60
+ const requestPath = `${ requestBasePath } ?title=${ requestTitle } &body=${ requestBody } ` ;
61
+ const prompt = `Tell me more about Ably's '${ activePage . page . name } ' feature from https://ably.com${ activePage . page . link } ${ language ? ` for ${ languageInfo [ language ] ?. label } ` : '' } ` ;
62
+ const gptPath = `https://chatgpt.com/?q=${ encodeURIComponent ( prompt ) } ` ;
62
63
63
64
return [
64
65
{
@@ -68,6 +69,7 @@ const externalLinks = (
68
69
type : 'github' ,
69
70
} ,
70
71
{ label : 'Request changes' , icon : 'icon-gui-hand-raised-outline' , link : requestPath , type : 'request' } ,
72
+ { label : 'Open in ChatGPT' , icon : 'icon-tech-openai' , link : gptPath , type : 'llm' } ,
71
73
] ;
72
74
} ;
73
75
@@ -253,7 +255,7 @@ const RightSidebar = () => {
253
255
< div
254
256
className = { cn (
255
257
'flex items-center p-4' ,
256
- index === 0 && 'border-b border-neutral-300 dark:border-neutral-1000' ,
258
+ index > 0 && 'border-t border-neutral-300 dark:border-neutral-1000' ,
257
259
) }
258
260
>
259
261
< div className = "flex-1 flex items-center gap-3" >
0 commit comments