@@ -2,7 +2,7 @@ import React, { useState } from 'react';
2
2
import Tabs from '@mui/material/Tabs' ;
3
3
import Tab from '@mui/material/Tab' ;
4
4
import Box from '@mui/material/Box' ;
5
- import { useNavigate } from 'react-router-dom' ;
5
+ import { useNavigate , useLocation } from 'react-router-dom' ;
6
6
import { Paper , Button , useTheme , Modal , Typography , Stack , TextField , InputAdornment , IconButton } from "@mui/material" ;
7
7
import { AutoAwesome , FormatListBulleted , VpnKey , Usb , CloudQueue , Description , Favorite , ContentCopy , SlowMotionVideo } from "@mui/icons-material" ;
8
8
import { useTranslation } from 'react-i18next' ;
@@ -17,6 +17,7 @@ export const MainMenu = ({ value = 'robots', handleChangeContent }: MainMenuProp
17
17
const theme = useTheme ( ) ;
18
18
const { t } = useTranslation ( ) ;
19
19
const navigate = useNavigate ( ) ;
20
+ const location = useLocation ( ) ;
20
21
const { notify } = useGlobalInfoStore ( ) ;
21
22
22
23
const [ cloudModalOpen , setCloudModalOpen ] = useState ( false ) ;
@@ -29,6 +30,13 @@ export const MainMenu = ({ value = 'robots', handleChangeContent }: MainMenuProp
29
30
handleChangeContent ( newValue ) ;
30
31
} ;
31
32
33
+ const handleRobotsClick = ( ) => {
34
+ if ( location . pathname !== '/robots' ) {
35
+ navigate ( '/robots' ) ;
36
+ handleChangeContent ( 'robots' ) ;
37
+ }
38
+ } ;
39
+
32
40
const copyDiscountCode = ( ) => {
33
41
navigator . clipboard . writeText ( ossDiscountCode ) . then ( ( ) => {
34
42
notify ( "success" , "Discount code copied to clipboard!" ) ;
@@ -81,7 +89,7 @@ export const MainMenu = ({ value = 'robots', handleChangeContent }: MainMenuProp
81
89
orientation = "vertical"
82
90
sx = { { alignItems : 'flex-start' } }
83
91
>
84
- < Tab value = "robots" label = { t ( 'mainmenu.recordings' ) } icon = { < AutoAwesome /> } iconPosition = "start" sx = { { justifyContent : 'flex-start' , textAlign : 'left' , fontSize : 'medium' } } />
92
+ < Tab value = "robots" label = { t ( 'mainmenu.recordings' ) } icon = { < AutoAwesome /> } iconPosition = "start" sx = { { justifyContent : 'flex-start' , textAlign : 'left' , fontSize : 'medium' } } onClick = { handleRobotsClick } />
85
93
< Tab value = "runs" label = { t ( 'mainmenu.runs' ) } icon = { < FormatListBulleted /> } iconPosition = "start" sx = { { justifyContent : 'flex-start' , textAlign : 'left' , fontSize : 'medium' } } />
86
94
< Tab value = "proxy" label = { t ( 'mainmenu.proxy' ) } icon = { < Usb /> } iconPosition = "start" sx = { { justifyContent : 'flex-start' , textAlign : 'left' , fontSize : 'medium' } } />
87
95
< Tab value = "apikey" label = { t ( 'mainmenu.apikey' ) } icon = { < VpnKey /> } iconPosition = "start" sx = { { justifyContent : 'flex-start' , textAlign : 'left' , fontSize : 'medium' } } />
0 commit comments