@@ -18,17 +18,22 @@ import {
18
18
ActionViewAsPDF ,
19
19
} from './PageActions' ;
20
20
21
- interface PageActionsDropdownProps {
22
- siteTitle : string ;
23
- markdownPageURL : string ;
24
- mcpURL ?: string ;
25
- pdfURL ?: string ;
26
- className ?: string ;
27
- actions : SiteCustomizationSettings [ 'pageActions' ] ;
21
+ export type PageActionsDropdownURLs = {
22
+ html : string ;
23
+ markdown : string ;
24
+ mcp ?: string ;
25
+ pdf ?: string ;
28
26
editOnGit ?: {
29
27
provider : GitSyncState [ 'installationProvider' ] ;
30
28
url : string ;
31
29
} ;
30
+ } ;
31
+
32
+ interface PageActionsDropdownProps {
33
+ siteTitle : string ;
34
+ urls : PageActionsDropdownURLs ;
35
+ className ?: string ;
36
+ actions : SiteCustomizationSettings [ 'pageActions' ] ;
32
37
}
33
38
34
39
/**
@@ -75,7 +80,7 @@ export function PageActionsDropdown(props: PageActionsDropdownProps) {
75
80
* Return the list of actions to show in the dropdown menu.
76
81
*/
77
82
function getPageDropdownActions ( props : PageActionsDropdownProps ) : React . ReactNode [ ] {
78
- const { siteTitle, markdownPageURL , mcpURL , actions } = props ;
83
+ const { siteTitle, urls , actions } = props ;
79
84
const assistants = useAI ( ) . assistants . filter (
80
85
( assistant ) => assistant . ui === true && assistant . pageAction
81
86
) ;
@@ -94,55 +99,45 @@ function getPageDropdownActions(props: PageActionsDropdownProps): React.ReactNod
94
99
< DropdownMenuSeparator className = "first:hidden" />
95
100
< ActionCopyMarkdown
96
101
isDefaultAction = { ! assistants . length }
97
- markdownPageURL = { markdownPageURL }
102
+ markdownPageURL = { urls . markdown }
98
103
type = "dropdown-menu-item"
99
104
/>
100
- < ActionViewAsMarkdown markdownPageURL = { markdownPageURL } type = "dropdown-menu-item" />
105
+ < ActionViewAsMarkdown markdownPageURL = { urls . markdown } type = "dropdown-menu-item" />
101
106
</ React . Fragment >
102
107
) : null ,
103
108
104
109
actions . externalAI ? (
105
110
< React . Fragment key = "externalAI" >
106
111
< DropdownMenuSeparator className = "first:hidden" />
107
- < ActionOpenInLLM
108
- provider = "chatgpt"
109
- url = { markdownPageURL }
110
- type = "dropdown-menu-item"
111
- />
112
- < ActionOpenInLLM
113
- provider = "claude"
114
- url = { markdownPageURL }
115
- type = "dropdown-menu-item"
116
- />
112
+ < ActionOpenInLLM provider = "chatgpt" url = { urls . html } type = "dropdown-menu-item" />
113
+ < ActionOpenInLLM provider = "claude" url = { urls . html } type = "dropdown-menu-item" />
117
114
</ React . Fragment >
118
115
) : null ,
119
116
120
- actions . mcp && mcpURL ? (
117
+ actions . mcp && urls . mcp ? (
121
118
< React . Fragment key = "mcp" >
122
119
< DropdownMenuSeparator className = "first:hidden" />
123
- < ActionCopyMCPURL mcpURL = { mcpURL } type = "dropdown-menu-item" />
120
+ < ActionCopyMCPURL mcpURL = { urls . mcp } type = "dropdown-menu-item" />
124
121
< ActionOpenMCP
125
122
provider = "vscode"
126
- mcpURL = { mcpURL }
123
+ mcpURL = { urls . mcp }
127
124
siteTitle = { siteTitle }
128
125
type = "dropdown-menu-item"
129
126
/>
130
127
</ React . Fragment >
131
128
) : null ,
132
129
133
- props . editOnGit || props . pdfURL ? (
130
+ urls . editOnGit || urls . pdf ? (
134
131
< React . Fragment key = "editOnGit" >
135
132
< DropdownMenuSeparator className = "first:hidden" />
136
- { props . editOnGit ? (
133
+ { urls . editOnGit ? (
137
134
< ActionOpenEditOnGit
138
135
type = "dropdown-menu-item"
139
- provider = { props . editOnGit . provider }
140
- url = { props . editOnGit . url }
136
+ provider = { urls . editOnGit . provider }
137
+ url = { urls . editOnGit . url }
141
138
/>
142
139
) : null }
143
- { props . pdfURL ? (
144
- < ActionViewAsPDF url = { props . pdfURL } type = "dropdown-menu-item" />
145
- ) : null }
140
+ { urls . pdf ? < ActionViewAsPDF url = { urls . pdf } type = "dropdown-menu-item" /> : null }
146
141
</ React . Fragment >
147
142
) : null ,
148
143
] . filter ( Boolean ) ;
@@ -152,7 +147,7 @@ function getPageDropdownActions(props: PageActionsDropdownProps): React.ReactNod
152
147
* A default action shown as a quick-access button beside the dropdown menu
153
148
*/
154
149
function getPageDefaultAction ( props : PageActionsDropdownProps ) {
155
- const { markdownPageURL , actions } = props ;
150
+ const { urls , actions } = props ;
156
151
const assistants = useAI ( ) . assistants . filter (
157
152
( assistant ) => assistant . ui === true && assistant . pageAction
158
153
) ;
@@ -162,12 +157,12 @@ function getPageDefaultAction(props: PageActionsDropdownProps) {
162
157
return < ActionOpenAssistant assistant = { assistant } type = "button" /> ;
163
158
}
164
159
165
- if ( props . editOnGit ) {
160
+ if ( urls . editOnGit ) {
166
161
return (
167
162
< ActionOpenEditOnGit
168
163
type = "button"
169
- provider = { props . editOnGit . provider }
170
- url = { props . editOnGit . url }
164
+ provider = { urls . editOnGit . provider }
165
+ url = { urls . editOnGit . url }
171
166
/>
172
167
) ;
173
168
}
@@ -176,7 +171,7 @@ function getPageDefaultAction(props: PageActionsDropdownProps) {
176
171
return (
177
172
< ActionCopyMarkdown
178
173
isDefaultAction = { ! assistant }
179
- markdownPageURL = { markdownPageURL }
174
+ markdownPageURL = { urls . markdown }
180
175
type = "button"
181
176
/>
182
177
) ;
0 commit comments