feat: sponsor & cloud
This commit is contained in:
@@ -1,12 +1,11 @@
|
|||||||
import React from 'react';
|
import React, { useState } from 'react';
|
||||||
import Tabs from '@mui/material/Tabs';
|
import Tabs from '@mui/material/Tabs';
|
||||||
import Tab from '@mui/material/Tab';
|
import Tab from '@mui/material/Tab';
|
||||||
import Box from '@mui/material/Box';
|
import Box from '@mui/material/Box';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { Paper, Button, useTheme } from "@mui/material";
|
import { Paper, Button, useTheme, Modal, Typography, Stack } from "@mui/material";
|
||||||
import { AutoAwesome, FormatListBulleted, VpnKey, Usb, CloudQueue, Description } from "@mui/icons-material";
|
import { AutoAwesome, FormatListBulleted, VpnKey, Usb, CloudQueue, Description, Favorite } from "@mui/icons-material";
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import i18n from '../../i18n';
|
|
||||||
|
|
||||||
interface MainMenuProps {
|
interface MainMenuProps {
|
||||||
value: string;
|
value: string;
|
||||||
@@ -18,19 +17,20 @@ export const MainMenu = ({ value = 'robots', handleChangeContent }: MainMenuProp
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const [cloudModalOpen, setCloudModalOpen] = useState(false);
|
||||||
|
const [sponsorModalOpen, setSponsorModalOpen] = useState(false);
|
||||||
|
|
||||||
const handleChange = (event: React.SyntheticEvent, newValue: string) => {
|
const handleChange = (event: React.SyntheticEvent, newValue: string) => {
|
||||||
navigate(`/${newValue}`);
|
navigate(`/${newValue}`);
|
||||||
handleChangeContent(newValue);
|
handleChangeContent(newValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Define colors based on theme mode
|
|
||||||
const defaultcolor = theme.palette.mode === 'light' ? 'black' : 'white';
|
const defaultcolor = theme.palette.mode === 'light' ? 'black' : 'white';
|
||||||
|
|
||||||
const buttonStyles = {
|
const buttonStyles = {
|
||||||
justifyContent: 'flex-start',
|
justifyContent: 'flex-start',
|
||||||
textAlign: 'left',
|
textAlign: 'left',
|
||||||
fontSize: '17px',
|
fontSize: '17px',
|
||||||
letterSpacing: '0.02857em',
|
|
||||||
padding: '20px 16px 20px 22px',
|
padding: '20px 16px 20px 22px',
|
||||||
minHeight: '48px',
|
minHeight: '48px',
|
||||||
minWidth: '100%',
|
minWidth: '100%',
|
||||||
@@ -39,91 +39,87 @@ export const MainMenu = ({ value = 'robots', handleChangeContent }: MainMenuProp
|
|||||||
textTransform: 'none',
|
textTransform: 'none',
|
||||||
color: theme.palette.mode === 'light' ? '#6C6C6C' : 'inherit',
|
color: theme.palette.mode === 'light' ? '#6C6C6C' : 'inherit',
|
||||||
'&:hover': {
|
'&:hover': {
|
||||||
color: theme.palette.mode === 'light' ? '#6C6C6C' : 'inherit',
|
|
||||||
backgroundColor: theme.palette.mode === 'light' ? '#f5f5f5' : 'inherit',
|
backgroundColor: theme.palette.mode === 'light' ? '#f5f5f5' : 'inherit',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Paper
|
<>
|
||||||
sx={{
|
<Paper
|
||||||
height: '100%',
|
sx={{
|
||||||
width: '250px',
|
height: '100%',
|
||||||
backgroundColor: theme.palette.background.paper,
|
width: '250px',
|
||||||
paddingTop: '0.5rem',
|
backgroundColor: theme.palette.background.paper,
|
||||||
color: defaultcolor,
|
paddingTop: '0.5rem',
|
||||||
}}
|
color: defaultcolor,
|
||||||
variant="outlined"
|
}}
|
||||||
square
|
variant="outlined"
|
||||||
>
|
square
|
||||||
<Box sx={{ width: '100%', paddingBottom: '1rem' }}>
|
>
|
||||||
<Tabs
|
<Box sx={{ width: '100%', paddingBottom: '1rem' }}>
|
||||||
value={value}
|
<Tabs
|
||||||
onChange={handleChange}
|
value={value}
|
||||||
textColor="primary"
|
onChange={handleChange}
|
||||||
indicatorColor="primary"
|
textColor="primary"
|
||||||
orientation="vertical"
|
indicatorColor="primary"
|
||||||
sx={{ alignItems: 'flex-start' }}
|
orientation="vertical"
|
||||||
>
|
sx={{ alignItems: 'flex-start' }}
|
||||||
<Tab
|
>
|
||||||
sx={{
|
<Tab value="robots" label={t('mainmenu.recordings')} icon={<AutoAwesome />} iconPosition="start" sx={{ justifyContent: 'flex-start', textAlign: 'left', fontSize: 'medium' }} />
|
||||||
justifyContent: 'flex-start',
|
<Tab value="runs" label={t('mainmenu.runs')} icon={<FormatListBulleted />} iconPosition="start" sx={{ justifyContent: 'flex-start', textAlign: 'left', fontSize: 'medium' }} />
|
||||||
textAlign: 'left',
|
<Tab value="proxy" label={t('mainmenu.proxy')} icon={<Usb />} iconPosition="start" sx={{ justifyContent: 'flex-start', textAlign: 'left', fontSize: 'medium' }} />
|
||||||
fontSize: 'medium',
|
<Tab value="apikey" label={t('mainmenu.apikey')} icon={<VpnKey />} iconPosition="start" sx={{ justifyContent: 'flex-start', textAlign: 'left', fontSize: 'medium' }} />
|
||||||
}}
|
</Tabs>
|
||||||
value="robots"
|
<hr />
|
||||||
label={t('mainmenu.recordings')}
|
<Box sx={{ display: 'flex', flexDirection: 'column', textAlign: 'left' }}>
|
||||||
icon={<AutoAwesome />}
|
<Button href='https://docs.maxun.dev' target="_blank" rel="noopener noreferrer" sx={buttonStyles} startIcon={<Description />}>
|
||||||
iconPosition="start"
|
Documentation
|
||||||
/>
|
</Button>
|
||||||
<Tab
|
<Button onClick={() => setCloudModalOpen(true)} sx={buttonStyles} startIcon={<CloudQueue />}>
|
||||||
sx={{
|
Maxun Cloud
|
||||||
justifyContent: 'flex-start',
|
</Button>
|
||||||
textAlign: 'left',
|
<Button onClick={() => setSponsorModalOpen(true)} sx={buttonStyles} startIcon={<Favorite />}>
|
||||||
fontSize: 'medium',
|
Sponsor Us
|
||||||
}}
|
</Button>
|
||||||
value="runs"
|
</Box>
|
||||||
label={t('mainmenu.runs')}
|
</Box>
|
||||||
icon={<FormatListBulleted />}
|
</Paper>
|
||||||
iconPosition="start"
|
|
||||||
/>
|
{/* Maxun Cloud Modal */}
|
||||||
<Tab
|
<Modal open={cloudModalOpen} onClose={() => setCloudModalOpen(false)}>
|
||||||
sx={{
|
<Box sx={{ position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)', bgcolor: 'background.paper', borderRadius: 2, p: 4, width: 400 }}>
|
||||||
justifyContent: 'flex-start',
|
<Typography variant="h6" gutterBottom>
|
||||||
textAlign: 'left',
|
Upgrade to Maxun Cloud
|
||||||
fontSize: 'medium',
|
</Typography>
|
||||||
}}
|
<Typography variant="body1" gutterBottom>
|
||||||
value="proxy"
|
Hosting, scaling, and support — all done for you. No setup, no stress.
|
||||||
label={t('mainmenu.proxy')}
|
As a thank-you, OSS users get <strong>5% off</strong>.
|
||||||
icon={<Usb />}
|
</Typography>
|
||||||
iconPosition="start"
|
<Button href="https://app.maxun.dev/login" target="_blank" variant="contained" fullWidth sx={{ mt: 2 }}>
|
||||||
/>
|
Go to Maxun Cloud
|
||||||
<Tab
|
|
||||||
sx={{
|
|
||||||
justifyContent: 'flex-start',
|
|
||||||
textAlign: 'left',
|
|
||||||
fontSize: 'medium',
|
|
||||||
}}
|
|
||||||
value="apikey"
|
|
||||||
label={t('mainmenu.apikey')}
|
|
||||||
icon={<VpnKey />}
|
|
||||||
iconPosition="start"
|
|
||||||
/>
|
|
||||||
</Tabs>
|
|
||||||
<hr />
|
|
||||||
<Box sx={{ display: 'flex', flexDirection: 'column', textAlign: 'left' }}>
|
|
||||||
{/* <Button href={`${apiUrl}/api-docs/`} target="_blank" rel="noopener noreferrer" sx={buttonStyles} startIcon={<Code />}>
|
|
||||||
{t('mainmenu.apidocs')}
|
|
||||||
</Button> */}
|
|
||||||
<Button href='https://docs.maxun.dev' target="_blank" rel="noopener noreferrer" sx={buttonStyles} startIcon={<Description />}>
|
|
||||||
Documentation
|
|
||||||
</Button>
|
|
||||||
<Button href="https://app.maxun.dev/login" target="_blank" rel="noopener noreferrer" sx={buttonStyles} startIcon={<CloudQueue />}>
|
|
||||||
{t('mainmenu.feedback')}
|
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Modal>
|
||||||
</Paper>
|
|
||||||
|
{/* Sponsor Modal */}
|
||||||
|
<Modal open={sponsorModalOpen} onClose={() => setSponsorModalOpen(false)}>
|
||||||
|
<Box sx={{ position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)', bgcolor: 'background.paper', borderRadius: 2, p: 4, width: 400 }}>
|
||||||
|
<Typography variant="h6" gutterBottom>
|
||||||
|
Support Maxun Open Source
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="body1" gutterBottom>
|
||||||
|
Maxun is built with love and maintained by a small team. Help us keep it alive and growing 💙
|
||||||
|
</Typography>
|
||||||
|
<Stack direction="row" spacing={2} mt={2}>
|
||||||
|
<Button href="https://github.com/sponsors/YOUR_GITHUB" target="_blank" variant="outlined" fullWidth>
|
||||||
|
One-Time
|
||||||
|
</Button>
|
||||||
|
<Button href="https://github.com/sponsors/YOUR_GITHUB" target="_blank" variant="contained" fullWidth>
|
||||||
|
Monthly
|
||||||
|
</Button>
|
||||||
|
</Stack>
|
||||||
|
</Box>
|
||||||
|
</Modal>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user