@@ -7,7 +7,7 @@ import Popup, { PopupComponentProps } from '@atlaskit/popup';
77import { Box } from '@atlaskit/primitives' ;
88import { token } from '@atlaskit/tokens' ;
99import Tooltip from '@atlaskit/tooltip' ;
10- import React , { useCallback } from 'react' ;
10+ import React , { useCallback , useMemo } from 'react' ;
1111import { AgentMode , RovoDevModeInfo } from 'src/rovo-dev/client' ;
1212
1313import AgentModeSection from './AgentModeSection' ;
@@ -21,6 +21,16 @@ const styles = cssMap({
2121 } ,
2222} ) ;
2323
24+ interface OtherSectionItem {
25+ key : string ;
26+ icon : React . ReactElement ;
27+ label : string ;
28+ description : string ;
29+ action : ( ) => void ;
30+ toggled : boolean ;
31+ isInternalOnly ?: boolean ;
32+ }
33+
2434interface PromptSettingsPopupProps {
2535 onDeepPlanToggled ?: ( ) => void ;
2636 onYoloModeToggled ?: ( ) => void ;
@@ -76,6 +86,34 @@ const PromptSettingsPopup: React.FC<PromptSettingsPopupProps> = ({
7686 [ onAgentModeChange , onClose ] ,
7787 ) ;
7888
89+ const otherSectionItems = useMemo ( ( ) : OtherSectionItem [ ] => {
90+ const items : OtherSectionItem [ ] = [ ] ;
91+ if ( onFullContextToggled ) {
92+ items . push ( {
93+ key : 'fullContext' ,
94+ icon : < TelescopeIcon label = "Full-Context mode" /> ,
95+ label : 'Full-Context mode' ,
96+ description :
97+ 'Toggle Full-Context mode to enable the agent to research documents and historical data, helping it better understand the problem to solve.' ,
98+ action : onFullContextToggled ,
99+ toggled : isFullContextEnabled ,
100+ isInternalOnly : true ,
101+ } ) ;
102+ }
103+ if ( onYoloModeToggled ) {
104+ items . push ( {
105+ key : 'yolo' ,
106+ icon : < LockUnlockedIcon label = "YOLO mode" /> ,
107+ label : 'YOLO' ,
108+ description :
109+ 'Toggle yolo mode which runs all file CRUD operations and bash commands without confirmation. Use with caution!' ,
110+ action : onYoloModeToggled ,
111+ toggled : isYoloModeEnabled ,
112+ } ) ;
113+ }
114+ return items ;
115+ } , [ onFullContextToggled , onYoloModeToggled , isFullContextEnabled , isYoloModeEnabled ] ) ;
116+
79117 if ( ! onDeepPlanToggled && ! onYoloModeToggled && ! onFullContextToggled ) {
80118 return null ;
81119 }
@@ -114,33 +152,29 @@ const PromptSettingsPopup: React.FC<PromptSettingsPopupProps> = ({
114152 availableModes = { availableAgentModes }
115153 setAgentMode = { handleAgentModeChange }
116154 />
117- < Box
118- as = "p"
119- xcss = { styles . sectionTitle }
120- style = { {
121- fontSize : '12px' ,
122- } }
123- >
124- Others
125- </ Box >
126- { onFullContextToggled && (
127- < PromptSettingsItem
128- icon = { < TelescopeIcon label = "Full-Context mode" /> }
129- label = "Full-Context mode"
130- description = "Toggle Full-Context mode to enable the agent to research documents and historical data, helping it better understand the problem to solve."
131- action = { onFullContextToggled }
132- toggled = { isFullContextEnabled }
133- isInternalOnly = { true }
134- />
135- ) }
136- { onYoloModeToggled && (
137- < PromptSettingsItem
138- icon = { < LockUnlockedIcon label = "YOLO mode" /> }
139- label = "YOLO"
140- description = "Toggle yolo mode which runs all file CRUD operations and bash commands without confirmation. Use with caution!"
141- action = { onYoloModeToggled }
142- toggled = { isYoloModeEnabled }
143- />
155+ { otherSectionItems . length > 0 && (
156+ < >
157+ < Box
158+ as = "p"
159+ xcss = { styles . sectionTitle }
160+ style = { {
161+ fontSize : '12px' ,
162+ } }
163+ >
164+ Others
165+ </ Box >
166+ { otherSectionItems . map ( ( item ) => (
167+ < PromptSettingsItem
168+ key = { item . key }
169+ icon = { item . icon }
170+ label = { item . label }
171+ description = { item . description }
172+ action = { item . action }
173+ toggled = { item . toggled }
174+ isInternalOnly = { item . isInternalOnly }
175+ />
176+ ) ) }
177+ </ >
144178 ) }
145179 </ div >
146180 ) }
0 commit comments