@@ -20,6 +20,7 @@ import { Scrollable } from '@ui/components/editor/panel/Scrollable'
2020import { BrowserExtensionMessage as UiBrowserExtensionMessage } from '@ui/components/editor/panel/BrowserExtensionMessage'
2121import { ApiToolConfiguration } from '@/views/panel/types/messages'
2222import { use_last_choice_button_title } from './hooks/use-last-choice-button-title'
23+ import { use_cycle_mode } from './hooks/use-cycle-mode'
2324
2425type Props = {
2526 initialize_chats : ( params : {
@@ -91,11 +92,13 @@ const web_mode_labels: Record<WebMode, string> = {
9192 'no-context' : 'No context' ,
9293 'code-completions' : 'Code at cursor'
9394}
95+ const WEB_MODES = Object . keys ( web_mode_labels ) as WebMode [ ]
9496
9597const api_mode_labels : Record < ApiMode , string > = {
9698 'edit-context' : 'Edit context' ,
9799 'code-completions' : 'Code at cursor'
98100}
101+ const API_MODES = Object . keys ( api_mode_labels ) as ApiMode [ ]
99102
100103export const MainView : React . FC < Props > = ( props ) => {
101104 // We need this because we can't use overflow: hidden
@@ -114,6 +117,16 @@ export const MainView: React.FC<Props> = (props) => {
114117 const [ is_apply_disabled_temporarily , set_is_apply_disabled_temporarily ] =
115118 useState ( false )
116119
120+ use_cycle_mode ( {
121+ home_view_type : props . home_view_type ,
122+ web_mode : props . web_mode ,
123+ on_web_mode_change : props . on_web_mode_change ,
124+ api_mode : props . api_mode ,
125+ on_api_mode_change : props . on_api_mode_change ,
126+ web_modes : WEB_MODES ,
127+ api_modes : API_MODES
128+ } )
129+
117130 const calculate_dropdown_max_width = ( ) => {
118131 if ( ! container_ref . current || ! top_left_ref . current ) return
119132
@@ -249,7 +262,7 @@ export const MainView: React.FC<Props> = (props) => {
249262 ) }
250263 selected_value = { props . web_mode }
251264 on_change = { props . on_web_mode_change }
252- title = { `Current mode: ${ web_mode_labels [ props . web_mode ] } ` }
265+ footer_text = "shift+tab cycle down, alt+shift+tab cycle up"
253266 max_width = { dropdown_max_width }
254267 />
255268 ) }
@@ -260,7 +273,7 @@ export const MainView: React.FC<Props> = (props) => {
260273 ) }
261274 selected_value = { props . api_mode }
262275 on_change = { props . on_api_mode_change }
263- title = { `Current mode: ${ api_mode_labels [ props . api_mode ] } ` }
276+ footer_text = "shift+tab cycle down, alt+shift+tab cycle up"
264277 max_width = { dropdown_max_width }
265278 />
266279 ) }
0 commit comments