2025-07-31 23:19:05 +05:30
|
|
|
import React, { useState } 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';
|
2025-09-19 01:01:24 +05:30
|
|
|
import { useNavigate, useLocation } from 'react-router-dom';
|
2025-08-25 20:05:20 +05:30
|
|
|
import { Paper, Button, useTheme, Modal, Typography, Stack, TextField, InputAdornment, IconButton } from "@mui/material";
|
2025-10-08 23:56:49 +05:30
|
|
|
import { AutoAwesome, FormatListBulleted, VpnKey, Usb, CloudQueue, Description, Favorite, ContentCopy, SlowMotionVideo, PlayArrow } from "@mui/icons-material";
|
2024-12-10 20:40:59 +05:30
|
|
|
import { useTranslation } from 'react-i18next';
|
2025-07-31 23:48:09 +05:30
|
|
|
import { useGlobalInfoStore } from "../../context/globalInfo";
|
2024-12-10 20:40:59 +05:30
|
|
|
|
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();
|
2025-01-09 23:13:03 +05:30
|
|
|
const navigate = useNavigate();
|
2025-09-19 01:01:24 +05:30
|
|
|
const location = useLocation();
|
2025-07-31 23:48:09 +05:30
|
|
|
const { notify } = useGlobalInfoStore();
|
2025-07-31 23:54:21 +05:30
|
|
|
|
2025-07-31 23:19:05 +05:30
|
|
|
const [sponsorModalOpen, setSponsorModalOpen] = useState(false);
|
2025-09-29 17:09:14 +05:30
|
|
|
const [docModalOpen, setDocModalOpen] = useState(false);
|
2025-07-31 23:19:05 +05:30
|
|
|
|
2025-07-31 23:54:21 +05:30
|
|
|
const ossDiscountCode = "MAXUNOSS8";
|
2025-07-31 23:48:09 +05:30
|
|
|
|
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);
|
|
|
|
|
};
|
|
|
|
|
|
2025-09-19 01:01:24 +05:30
|
|
|
const handleRobotsClick = () => {
|
|
|
|
|
if (location.pathname !== '/robots') {
|
|
|
|
|
navigate('/robots');
|
|
|
|
|
handleChangeContent('robots');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-07-31 23:48:09 +05:30
|
|
|
const copyDiscountCode = () => {
|
|
|
|
|
navigator.clipboard.writeText(ossDiscountCode).then(() => {
|
|
|
|
|
notify("success", "Discount code copied to clipboard!");
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
console.error('Failed to copy text: ', err);
|
|
|
|
|
notify("error", "Failed to copy discount code.");
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
2024-11-07 10:43:13 +05:30
|
|
|
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-08-25 19:59:35 +05:30
|
|
|
letterSpacing: '0.02857em',
|
|
|
|
|
padding: '20px 20px 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-08-25 20:05:20 +05:30
|
|
|
'&:hover': {
|
2025-08-25 19:59:35 +05:30
|
|
|
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
|
|
|
|
2025-08-25 19:59:35 +05:30
|
|
|
|
2024-06-24 22:42:37 +05:30
|
|
|
return (
|
2025-07-31 23:19:05 +05:30
|
|
|
<>
|
|
|
|
|
<Paper
|
|
|
|
|
sx={{
|
|
|
|
|
height: '100%',
|
|
|
|
|
width: '250px',
|
|
|
|
|
backgroundColor: theme.palette.background.paper,
|
|
|
|
|
paddingTop: '0.5rem',
|
|
|
|
|
color: defaultcolor,
|
|
|
|
|
}}
|
|
|
|
|
variant="outlined"
|
|
|
|
|
square
|
|
|
|
|
>
|
|
|
|
|
<Box sx={{ width: '100%', paddingBottom: '1rem' }}>
|
|
|
|
|
<Tabs
|
|
|
|
|
value={value}
|
|
|
|
|
onChange={handleChange}
|
|
|
|
|
textColor="primary"
|
|
|
|
|
indicatorColor="primary"
|
|
|
|
|
orientation="vertical"
|
|
|
|
|
sx={{ alignItems: 'flex-start' }}
|
|
|
|
|
>
|
2025-10-09 00:00:01 +05:30
|
|
|
<Tab value="robots" label={t('mainmenu.recordings')} icon={<AutoAwesome sx={{ fontSize: 20 }} />} iconPosition="start" sx={{ justifyContent: 'flex-start', textAlign: 'left', fontSize: 'medium' }} onClick={handleRobotsClick} />
|
2025-10-09 00:00:15 +05:30
|
|
|
<Tab value="runs" label={t('mainmenu.runs')} icon={<PlayArrow sx={{ fontSize: 20 }} />} iconPosition="start" sx={{ justifyContent: 'flex-start', textAlign: 'left', fontSize: 'medium' }} />
|
2025-10-09 00:00:24 +05:30
|
|
|
<Tab value="proxy" label={t('mainmenu.proxy')} icon={<Usb sx={{ fontSize: 20 }} />} iconPosition="start" sx={{ justifyContent: 'flex-start', textAlign: 'left', fontSize: 'medium' }} />
|
2025-10-09 00:00:32 +05:30
|
|
|
<Tab value="apikey" label={t('mainmenu.apikey')} icon={<VpnKey sx={{ fontSize: 20 }} />} iconPosition="start" sx={{ justifyContent: 'flex-start', textAlign: 'left', fontSize: 'medium' }} />
|
2025-07-31 23:19:05 +05:30
|
|
|
</Tabs>
|
|
|
|
|
<hr />
|
|
|
|
|
<Box sx={{ display: 'flex', flexDirection: 'column', textAlign: 'left' }}>
|
2025-09-29 17:09:14 +05:30
|
|
|
<Button
|
|
|
|
|
onClick={() => setDocModalOpen(true)}
|
|
|
|
|
sx={buttonStyles}
|
|
|
|
|
startIcon={<Description />}
|
|
|
|
|
>
|
2025-07-31 23:19:05 +05:30
|
|
|
Documentation
|
|
|
|
|
</Button>
|
2025-09-29 17:09:14 +05:30
|
|
|
<Modal open={docModalOpen ?? false} onClose={() => setDocModalOpen(false)}>
|
|
|
|
|
<Box sx={{ position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)', bgcolor: 'background.paper', borderRadius: 2, p: 4, width: 400 }}>
|
2025-09-29 17:12:22 +05:30
|
|
|
<Stack spacing={2}>
|
|
|
|
|
<Button
|
|
|
|
|
href="https://docs.maxun.dev"
|
|
|
|
|
target="_blank"
|
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
|
variant="outlined"
|
2025-10-09 00:01:25 +05:30
|
|
|
startIcon={<Description sx={{ fontSize: 20 }} />}
|
2025-09-29 17:12:22 +05:30
|
|
|
fullWidth
|
|
|
|
|
>
|
|
|
|
|
Documentation
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
href="https://www.youtube.com/@MaxunOSS/videos"
|
|
|
|
|
target="_blank"
|
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
|
variant="outlined"
|
|
|
|
|
startIcon={<SlowMotionVideo />}
|
|
|
|
|
fullWidth
|
|
|
|
|
>
|
|
|
|
|
Video Tutorials
|
|
|
|
|
</Button>
|
|
|
|
|
</Stack>
|
2025-09-29 17:09:14 +05:30
|
|
|
</Box>
|
|
|
|
|
</Modal>
|
2025-09-29 17:12:22 +05:30
|
|
|
<Button
|
|
|
|
|
href='https://app.maxun.dev/'
|
|
|
|
|
target="_blank"
|
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
|
sx={buttonStyles} startIcon={<CloudQueue />}>
|
2025-07-31 23:21:50 +05:30
|
|
|
Join Maxun Cloud
|
2025-07-31 23:19:05 +05:30
|
|
|
</Button>
|
|
|
|
|
<Button onClick={() => setSponsorModalOpen(true)} sx={buttonStyles} startIcon={<Favorite />}>
|
|
|
|
|
Sponsor Us
|
|
|
|
|
</Button>
|
|
|
|
|
</Box>
|
|
|
|
|
</Box>
|
|
|
|
|
</Paper>
|
|
|
|
|
<Modal open={sponsorModalOpen} onClose={() => setSponsorModalOpen(false)}>
|
2025-07-31 23:34:23 +05:30
|
|
|
<Box sx={{ position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)', bgcolor: 'background.paper', borderRadius: 2, p: 4, width: 600 }}>
|
2025-07-31 23:35:23 +05:30
|
|
|
<Typography variant="h6" marginBottom={4}>
|
2025-07-31 23:19:05 +05:30
|
|
|
Support Maxun Open Source
|
|
|
|
|
</Typography>
|
|
|
|
|
<Typography variant="body1" gutterBottom>
|
2025-07-31 23:31:29 +05:30
|
|
|
Maxun is built by a small, full-time team. Your donations directly contribute to making it better.
|
|
|
|
|
<br />
|
|
|
|
|
<br />
|
2025-07-31 23:48:09 +05:30
|
|
|
Thank you for your support! 💙
|
2025-07-31 23:19:05 +05:30
|
|
|
</Typography>
|
|
|
|
|
<Stack direction="row" spacing={2} mt={2}>
|
2025-08-25 20:05:20 +05:30
|
|
|
<Button href="https://checkout.dodopayments.com/buy/pdt_1Bdstszcg9VY8WYGwNBPM?quantity=1" target="_blank" rel="noopener noreferrer" variant="outlined" fullWidth>
|
2025-07-31 23:36:23 +05:30
|
|
|
Sponsor $5 One-Time
|
2025-07-31 23:19:05 +05:30
|
|
|
</Button>
|
2025-08-25 20:05:20 +05:30
|
|
|
<Button href="https://checkout.dodopayments.com/buy/pdt_HDalaYf8hEGVG7hXcfNBj?quantity=1" target="_blank" rel="noopener noreferrer" variant="outlined" fullWidth>
|
2025-07-31 23:36:23 +05:30
|
|
|
Sponsor $5 Monthly
|
2025-07-31 23:19:05 +05:30
|
|
|
</Button>
|
|
|
|
|
</Stack>
|
|
|
|
|
</Box>
|
|
|
|
|
</Modal>
|
|
|
|
|
</>
|
2024-06-24 22:42:37 +05:30
|
|
|
);
|
2025-08-01 00:39:31 +05:30
|
|
|
};
|