Files
parcer/src/components/dashboard/MainMenu.tsx

130 lines
3.9 KiB
TypeScript
Raw Normal View History

2024-11-07 00:46:47 +05:30
import React from 'react';
2024-06-24 22:42:37 +05:30
import Tabs from '@mui/material/Tabs';
import Tab from '@mui/material/Tab';
import Box from '@mui/material/Box';
import { useNavigate } from 'react-router-dom';
2024-11-07 00:46:47 +05:30
import { Paper, Button, useTheme } from "@mui/material";
2025-06-13 19:00:56 +05:30
import { AutoAwesome, FormatListBulleted, VpnKey, Usb, CloudQueue, Description } from "@mui/icons-material";
2024-12-10 20:40:59 +05:30
import { useTranslation } from 'react-i18next';
import i18n from '../../i18n';
2024-06-24 22:42:37 +05:30
interface MainMenuProps {
value: string;
handleChangeContent: (newValue: string) => void;
}
2025-01-09 23:17:58 +05:30
export const MainMenu = ({ value = 'robots', handleChangeContent }: MainMenuProps) => {
2024-11-07 00:46:47 +05:30
const theme = useTheme();
2025-01-09 17:15:26 +05:30
const { t } = useTranslation();
const navigate = useNavigate();
2024-06-24 22:42:37 +05:30
const handleChange = (event: React.SyntheticEvent, newValue: string) => {
2025-01-09 23:14:03 +05:30
navigate(`/${newValue}`);
2024-06-24 22:42:37 +05:30
handleChangeContent(newValue);
};
// Define colors based on theme mode
const defaultcolor = theme.palette.mode === 'light' ? 'black' : 'white';
2025-01-08 21:31:17 +05:30
const buttonStyles = {
justifyContent: 'flex-start',
textAlign: 'left',
2025-06-13 20:14:14 +05:30
fontSize: '17px',
2025-06-13 20:13:56 +05:30
letterSpacing: '0.02857em',
2025-07-12 01:49:53 +05:30
padding: '20px 16px 20px 22px',
2025-01-08 21:31:17 +05:30
minHeight: '48px',
minWidth: '100%',
display: 'flex',
alignItems: 'center',
textTransform: 'none',
color: theme.palette.mode === 'light' ? '#6C6C6C' : 'inherit',
2025-06-13 19:10:12 +05:30
'&:hover': {
color: theme.palette.mode === 'light' ? '#6C6C6C' : 'inherit',
2025-06-27 17:04:31 +05:30
backgroundColor: theme.palette.mode === 'light' ? '#f5f5f5' : 'inherit',
2025-06-13 19:10:12 +05:30
},
2025-01-08 21:31:17 +05:30
};
2025-01-09 17:15:26 +05:30
2024-06-24 22:42:37 +05:30
return (
<Paper
sx={{
2025-05-24 22:30:53 +05:30
height: '100%',
2024-10-10 23:15:28 +05:30
width: '250px',
2024-11-07 00:46:47 +05:30
backgroundColor: theme.palette.background.paper,
2024-10-29 08:45:09 +05:30
paddingTop: '0.5rem',
color: defaultcolor,
2024-06-24 22:42:37 +05:30
}}
2024-10-10 23:10:35 +05:30
variant="outlined"
2024-10-23 07:14:31 +05:30
square
2024-06-24 22:42:37 +05:30
>
2024-11-07 00:46:47 +05:30
<Box sx={{ width: '100%', paddingBottom: '1rem' }}>
2024-06-24 22:42:37 +05:30
<Tabs
value={value}
onChange={handleChange}
2025-01-08 21:31:17 +05:30
textColor="primary"
indicatorColor="primary"
2024-06-24 22:42:37 +05:30
orientation="vertical"
2025-01-08 21:31:17 +05:30
sx={{ alignItems: 'flex-start' }}
2024-06-24 22:42:37 +05:30
>
2024-10-28 18:47:17 +05:30
<Tab
2025-01-08 21:31:17 +05:30
sx={{
justifyContent: 'flex-start',
textAlign: 'left',
fontSize: 'medium',
}}
2025-01-09 23:17:58 +05:30
value="robots"
2024-12-10 20:40:59 +05:30
label={t('mainmenu.recordings')}
2024-10-28 18:47:17 +05:30
icon={<AutoAwesome />}
iconPosition="start"
/>
<Tab
2025-01-08 21:31:17 +05:30
sx={{
justifyContent: 'flex-start',
textAlign: 'left',
fontSize: 'medium',
}}
2024-10-28 18:47:17 +05:30
value="runs"
2024-12-10 20:40:59 +05:30
label={t('mainmenu.runs')}
2024-10-28 18:47:17 +05:30
icon={<FormatListBulleted />}
iconPosition="start"
/>
<Tab
2025-01-08 21:31:17 +05:30
sx={{
justifyContent: 'flex-start',
textAlign: 'left',
fontSize: 'medium',
}}
2024-10-28 18:47:17 +05:30
value="proxy"
2024-12-10 20:40:59 +05:30
label={t('mainmenu.proxy')}
2024-10-28 18:47:17 +05:30
icon={<Usb />}
iconPosition="start"
/>
<Tab
2025-01-08 21:31:17 +05:30
sx={{
justifyContent: 'flex-start',
textAlign: 'left',
fontSize: 'medium',
}}
2024-10-28 18:47:17 +05:30
value="apikey"
2024-12-10 20:40:59 +05:30
label={t('mainmenu.apikey')}
2024-10-28 18:47:17 +05:30
icon={<VpnKey />}
iconPosition="start"
/>
2024-09-30 18:06:46 +05:30
</Tabs>
2024-10-28 18:45:51 +05:30
<hr />
2025-07-12 01:47:47 +05:30
<Box sx={{ display: 'flex', flexDirection: 'column', textAlign: 'left' }}>
2025-05-28 02:41:04 +05:30
{/* <Button href={`${apiUrl}/api-docs/`} target="_blank" rel="noopener noreferrer" sx={buttonStyles} startIcon={<Code />}>
2024-12-10 20:40:59 +05:30
{t('mainmenu.apidocs')}
2025-05-28 02:41:04 +05:30
</Button> */}
2025-06-13 18:58:21 +05:30
<Button href='https://docs.maxun.dev' target="_blank" rel="noopener noreferrer" sx={buttonStyles} startIcon={<Description />}>
2025-06-13 19:00:56 +05:30
Documentation
2025-06-13 18:55:27 +05:30
</Button>
2025-06-13 19:00:28 +05:30
<Button href="https://app.maxun.dev/login" target="_blank" rel="noopener noreferrer" sx={buttonStyles} startIcon={<CloudQueue />}>
{t('mainmenu.feedback')}
</Button>
2024-10-28 18:45:51 +05:30
</Box>
2024-06-24 22:42:37 +05:30
</Box>
</Paper>
);
2025-06-13 20:13:56 +05:30
};