File tree Expand file tree Collapse file tree
packages/vscode/src/views/panel/frontend Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { useState , useRef } from 'react'
1+ import { useState , useRef , useEffect } from 'react'
22import styles from './Home.module.scss'
33import { Scrollable } from '@ui/components/editor/panel/Scrollable'
44import { Timeline } from '@ui/components/editor/panel/Timeline'
@@ -20,6 +20,7 @@ import { use_timeline_scroll } from './hooks/use-timeline-scroll'
2020type Props = {
2121 vscode : any
2222 is_active : boolean
23+ on_go_forward : ( ) => void
2324 on_chatbots_click : ( ) => void
2425 on_api_calls_click : ( ) => void
2526 version : string
@@ -50,6 +51,17 @@ export const Home: React.FC<Props> = (props) => {
5051 const responses_ref = useRef < HTMLDivElement > ( null )
5152 const mode_ref = useRef < HTMLDivElement > ( null )
5253
54+ useEffect ( ( ) => {
55+ const handle_mouse_up = ( event : MouseEvent ) => {
56+ if ( props . is_active && event . button == 4 ) {
57+ props . on_go_forward ( )
58+ }
59+ }
60+
61+ window . addEventListener ( 'mouseup' , handle_mouse_up )
62+ return ( ) => window . removeEventListener ( 'mouseup' , handle_mouse_up )
63+ } , [ props . is_active , props . on_go_forward ] )
64+
5365 const {
5466 handle_reorder,
5567 handle_change,
Original file line number Diff line number Diff line change @@ -233,7 +233,7 @@ export const Panel = () => {
233233 }
234234
235235 const are_keyboard_shortcuts_disabled =
236- ! ! updating_preset || ! ! items_to_preview
236+ ! ! updating_preset || ! ! items_to_preview || active_view != 'main'
237237
238238 return (
239239 < LayoutContext . Provider value = { layout_context_value } >
@@ -325,6 +325,7 @@ export const Panel = () => {
325325 < Home
326326 vscode = { vscode }
327327 is_active = { active_view == 'home' }
328+ on_go_forward = { ( ) => set_active_view ( 'main' ) }
328329 on_chatbots_click = { ( ) => {
329330 set_active_view ( 'main' )
330331 set_main_view_scroll_reset_key ( ( k ) => k + 1 )
You can’t perform that action at this time.
0 commit comments