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-01-09 23:13:03 +05:30
|
|
|
import { useNavigate } from 'react-router-dom';
|
2025-07-31 23:48:09 +05:30
|
|
|
import { Paper, Button, useTheme, Modal, Typography, Stack, TextField, InputAdornment, IconButton } from "@mui/material"; // Added TextField, InputAdornment, IconButton
|
|
|
|
|
import { AutoAwesome, FormatListBulleted, VpnKey, Usb, CloudQueue, Description, Favorite, ContentCopy } from "@mui/icons-material"; // Added ContentCopy
|
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-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 [cloudModalOpen, setCloudModalOpen] = useState(false);
|
|
|
|
|
const [sponsorModalOpen, setSponsorModalOpen] = useState(false);
|
|
|
|
|
|
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-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 19:59:35 +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
|
|
|
|
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' }}
|
|
|
|
|
>
|
|
|
|
|
<Tab value="robots" label={t('mainmenu.recordings')} icon={<AutoAwesome />} iconPosition="start" sx={{ justifyContent: 'flex-start', textAlign: 'left', fontSize: 'medium' }} />
|
|
|
|
|
<Tab value="runs" label={t('mainmenu.runs')} icon={<FormatListBulleted />} iconPosition="start" sx={{ justifyContent: 'flex-start', textAlign: 'left', fontSize: 'medium' }} />
|
|
|
|
|
<Tab value="proxy" label={t('mainmenu.proxy')} icon={<Usb />} iconPosition="start" sx={{ justifyContent: 'flex-start', textAlign: 'left', fontSize: 'medium' }} />
|
|
|
|
|
<Tab value="apikey" label={t('mainmenu.apikey')} icon={<VpnKey />} iconPosition="start" sx={{ justifyContent: 'flex-start', textAlign: 'left', fontSize: 'medium' }} />
|
|
|
|
|
</Tabs>
|
|
|
|
|
<hr />
|
|
|
|
|
<Box sx={{ display: 'flex', flexDirection: 'column', textAlign: 'left' }}>
|
|
|
|
|
<Button href='https://docs.maxun.dev' target="_blank" rel="noopener noreferrer" sx={buttonStyles} startIcon={<Description />}>
|
|
|
|
|
Documentation
|
|
|
|
|
</Button>
|
2025-08-25 20:04:49 +05:30
|
|
|
<Button href="https://www.youtube.com/@MaxunOSS/videos" target="_blank" rel="noopener noreferrer" sx={buttonStyles} startIcon={<SlowMotionVideo />}>
|
|
|
|
|
Tutorials
|
|
|
|
|
</Button>
|
2025-07-31 23:19:05 +05:30
|
|
|
<Button onClick={() => setCloudModalOpen(true)} 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={cloudModalOpen} onClose={() => setCloudModalOpen(false)}>
|
2025-07-31 23:34:37 +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:51:53 +05:30
|
|
|
<Typography variant="h6" marginBottom={4}>
|
2025-07-31 23:21:50 +05:30
|
|
|
Join Maxun Cloud
|
2025-07-31 23:19:05 +05:30
|
|
|
</Typography>
|
|
|
|
|
<Typography variant="body1" gutterBottom>
|
2025-07-31 23:54:07 +05:30
|
|
|
Unlock reliable web data extraction. Maxun Cloud ensures you bypass blocks and scale with ease.
|
2025-07-31 23:19:05 +05:30
|
|
|
</Typography>
|
2025-07-31 23:48:09 +05:30
|
|
|
<Typography variant="body1" gutterBottom>
|
2025-08-01 00:04:09 +05:30
|
|
|
As a thank-you to open source users, enjoy 8% off your subscription!
|
2025-07-31 23:48:09 +05:30
|
|
|
</Typography>
|
2025-07-31 23:54:21 +05:30
|
|
|
<Typography variant="body2" color="text.secondary" sx={{ mt: 2, mb: 0.5, fontSize: 13 }}>
|
2025-07-31 23:51:53 +05:30
|
|
|
Use the discount code
|
2025-07-31 23:54:21 +05:30
|
|
|
</Typography>
|
|
|
|
|
<TextField
|
2025-07-31 23:50:04 +05:30
|
|
|
size="small"
|
2025-07-31 23:48:09 +05:30
|
|
|
value={ossDiscountCode}
|
|
|
|
|
InputProps={{
|
|
|
|
|
readOnly: true,
|
|
|
|
|
endAdornment: (
|
2025-07-31 23:54:21 +05:30
|
|
|
<InputAdornment position="end">
|
|
|
|
|
<IconButton onClick={copyDiscountCode} edge="end" aria-label="copy discount code" size="small">
|
|
|
|
|
<ContentCopy fontSize="small" />
|
|
|
|
|
</IconButton>
|
|
|
|
|
</InputAdornment>
|
2025-07-31 23:48:09 +05:30
|
|
|
),
|
|
|
|
|
}}
|
2025-07-31 23:50:04 +05:30
|
|
|
sx={{ mb: 2, fontSize: 13 }}
|
2025-07-31 23:54:21 +05:30
|
|
|
/>
|
2025-07-31 23:48:09 +05:30
|
|
|
|
|
|
|
|
<Button href="https://app.maxun.dev/login" target="_blank" fullWidth variant="outlined" sx={{ mt: 2 }}>
|
2025-07-31 23:19:05 +05:30
|
|
|
Go to Maxun Cloud
|
2025-06-13 19:00:28 +05:30
|
|
|
</Button>
|
2024-10-28 18:45:51 +05:30
|
|
|
</Box>
|
2025-07-31 23:19:05 +05:30
|
|
|
</Modal>
|
|
|
|
|
|
|
|
|
|
<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-01 00:39:31 +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-01 00:39:31 +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
|
|
|
};
|