mui blue color fixes

This commit is contained in:
AmitChauhan63390
2024-12-08 04:49:29 +05:30
parent 3cf0786389
commit 587dacdaf1
6 changed files with 143 additions and 20 deletions

View File

@@ -14,18 +14,33 @@ import axios from "axios";
import { useGlobalInfoStore } from "../../context/globalInfo"; import { useGlobalInfoStore } from "../../context/globalInfo";
import { getStoredRecording } from "../../api/storage"; import { getStoredRecording } from "../../api/storage";
import { apiUrl } from "../../apiConfig.js"; import { apiUrl } from "../../apiConfig.js";
import Cookies from 'js-cookie';
interface IntegrationProps { interface IntegrationProps {
isOpen: boolean; isOpen: boolean;
handleStart: (data: IntegrationSettings) => void; handleStart: (data: IntegrationSettings) => void;
handleClose: () => void; handleClose: () => void;
} }
export interface IntegrationSettings { export interface IntegrationSettings {
spreadsheetId: string; spreadsheetId: string;
spreadsheetName: string; spreadsheetName: string;
data: string; data: string;
} }
// Helper functions to replace js-cookie functionality
const getCookie = (name: string): string | null => {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);
if (parts.length === 2) {
return parts.pop()?.split(';').shift() || null;
}
return null;
};
const removeCookie = (name: string): void => {
document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;
};
export const IntegrationSettingsModal = ({ export const IntegrationSettingsModal = ({
isOpen, isOpen,
handleStart, handleStart,
@@ -106,7 +121,7 @@ export const IntegrationSettingsModal = ({
}, },
{ withCredentials: true } { withCredentials: true }
); );
notify(`success`, `Google Sheet selected successfully`) notify(`success`, `Google Sheet selected successfully`);
console.log("Google Sheet ID updated:", response.data); console.log("Google Sheet ID updated:", response.data);
} catch (error: any) { } catch (error: any) {
console.error( console.error(
@@ -137,14 +152,14 @@ export const IntegrationSettingsModal = ({
useEffect(() => { useEffect(() => {
// Check if there is a success message in cookies // Check if there is a success message in cookies
const status = Cookies.get("robot_auth_status"); const status = getCookie("robot_auth_status");
const message = Cookies.get("robot_auth_message"); const message = getCookie("robot_auth_message");
if (status === "success" && message) { if (status === "success" && message) {
notify("success", message); notify("success", message);
// Clear the cookies after reading // Clear the cookies after reading
Cookies.remove("robot_auth_status"); removeCookie("robot_auth_status");
Cookies.remove("robot_auth_message"); removeCookie("robot_auth_message");
} }
// Check if we're on the callback URL // Check if we're on the callback URL
@@ -177,7 +192,6 @@ export const IntegrationSettingsModal = ({
> >
<Typography variant="h6"> <Typography variant="h6">
Integrate with Google Sheet{" "} Integrate with Google Sheet{" "}
{/* <Chip label="beta" color="primary" variant="outlined" /> */}
</Typography> </Typography>
{recording && recording.google_sheet_id ? ( {recording && recording.google_sheet_id ? (
@@ -320,4 +334,4 @@ export const modalStyle = {
height: "fit-content", height: "fit-content",
display: "block", display: "block",
padding: "20px", padding: "20px",
}; };

View File

@@ -124,4 +124,9 @@ const buttonStyles = {
alignItems: 'center', alignItems: 'center',
textTransform: 'none', textTransform: 'none',
color: 'inherit', color: 'inherit',
backgroundColor: 'transparent',
'&:hover': {
backgroundColor: 'rgba(255, 0, 195, 0.1)',
color: '#ff00c3',
},
}; };

View File

@@ -1,8 +1,48 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { styled } from '@mui/system'; import { styled } from '@mui/system';
import { Alert, AlertTitle, TextField, Button, Switch, FormControlLabel, Box, Typography, Tabs, Tab, Table, TableContainer, TableHead, TableRow, TableBody, TableCell, Paper } from '@mui/material'; import {
Alert,
AlertTitle,
TextField,
Button,
Switch,
FormControlLabel,
Box,
Typography,
Tabs,
Tab,
Table,
TableContainer,
TableHead,
TableRow,
TableBody,
TableCell,
Paper
} from '@mui/material';
import { sendProxyConfig, getProxyConfig, testProxyConfig, deleteProxyConfig } from '../../api/proxy'; import { sendProxyConfig, getProxyConfig, testProxyConfig, deleteProxyConfig } from '../../api/proxy';
import { useGlobalInfoStore } from '../../context/globalInfo'; import { useGlobalInfoStore } from '../../context/globalInfo';
import { useThemeMode } from '../../context/theme-provider';
// Custom styled Tabs component
const CustomTabs = styled(Tabs)(({ theme }) => ({
'& .MuiTabs-indicator': {
backgroundColor: '#ff00c3', // Pink indicator
},
}));
// Custom styled Tab component
const CustomTab = styled(Tab)(({ theme }) => ({
'&.Mui-selected': {
color: '#ff00c3', // Pink for selected tab
},
'&:hover': {
color: '#ff00c3', // Pink on hover
// Subtle hover effect
},
'&.MuiTab-root': {
textTransform: 'none', // Removes uppercase transformation
},
}));
const FormContainer = styled(Box)({ const FormContainer = styled(Box)({
display: 'flex', display: 'flex',
@@ -132,16 +172,37 @@ const ProxyForm: React.FC = () => {
fetchProxyConfig(); fetchProxyConfig();
}, []); }, []);
const theme = useThemeMode();
const isDarkMode = theme.darkMode;
return ( return (
<> <>
<FormContainer> <FormContainer>
<Typography variant="h6" gutterBottom component="div" style={{ marginTop: '20px' }}> <Typography variant="h6" gutterBottom component="div" style={{ marginTop: '20px' }}>
Proxy Configuration Proxy Configuration
</Typography> </Typography>
<Tabs value={tabIndex} onChange={handleTabChange}> <CustomTabs
<Tab label="Standard Proxy" /> value={tabIndex}
<Tab label="Automatic Proxy Rotation" /> onChange={handleTabChange}
</Tabs> TabIndicatorProps={{
style: {
backgroundColor: '#FF69B4' // Ensures pink indicator
}
}}
>
<CustomTab
label="Standard Proxy"
style={{
color: tabIndex === 0 ? '#FF69B4' : (isDarkMode ? 'white' : 'black')
}}
/>
<CustomTab
label="Automatic Proxy Rotation"
style={{
color: tabIndex === 1 ? '#FF69B4' : (isDarkMode ? 'white' : 'black')
}}
/>
</CustomTabs>
{tabIndex === 0 && ( {tabIndex === 0 && (
isProxyConfigured ? ( isProxyConfigured ? (
<Box sx={{ maxWidth: 600, width: '100%', marginTop: '5px' }}> <Box sx={{ maxWidth: 600, width: '100%', marginTop: '5px' }}>
@@ -236,15 +297,15 @@ const ProxyForm: React.FC = () => {
<Typography variant="body1" gutterBottom component="div"> <Typography variant="body1" gutterBottom component="div">
Coming Soon - In Open Source (Basic Rotation) & Cloud (Advanced Rotation). If you don't want to manage the infrastructure, join our cloud waitlist to get early access. Coming Soon - In Open Source (Basic Rotation) & Cloud (Advanced Rotation). If you don't want to manage the infrastructure, join our cloud waitlist to get early access.
</Typography> </Typography>
<Button variant="contained" color="primary" sx={{ marginTop: '20px' }}> <Button variant="contained" color="primary" sx={{ marginTop: '20px',backgroundColor: '#ff00c3' }}>
<a style={{ color: 'white', textDecoration: 'none' }} href="https://forms.gle/hXjgqDvkEhPcaBW76">Join Maxun Cloud Waitlist</a> <a style={{ color: 'white', textDecoration: 'none' }} href="https://forms.gle/hXjgqDvkEhPcaBW76">Join Maxun Cloud Waitlist</a>
</Button> </Button>
</> </>
</Box> </Box>
)} )}
</FormContainer> </FormContainer>
<Alert severity="info" sx={{ marginTop: '80px', marginLeft: '50px', height: '230px', width: '450px', border: '1px solid #ff00c3' }}> <Alert severity="info" sx={{ marginTop: '80px', marginLeft: '50px', height: '230px', width: '450px', border: '1px solid #ff00c3', bgcolor: isDarkMode ? '#3b002d' : '#ffc4f1', color: isDarkMode ? 'white' : 'black' }}>
<AlertTitle>If your proxy requires a username and password, always provide them separately from the proxy URL. </AlertTitle> <AlertTitle>If your proxy requires a username and password, always provide them separately from the proxy URL. </AlertTitle>
<br /> <br />
<b>The right way</b> <b>The right way</b>
<br /> <br />
@@ -258,9 +319,10 @@ const ProxyForm: React.FC = () => {
<b>The wrong way</b> <b>The wrong way</b>
<br /> <br />
Proxy URL: http://myusername:mypassword@proxy.com:1337 Proxy URL: http://myusername:mypassword@proxy.com:1337
<br />
</Alert> </Alert>
</> </>
); );
}; };
export default ProxyForm; export default ProxyForm;

View File

@@ -6,7 +6,7 @@ const lightTheme = createTheme({
palette: { palette: {
mode: 'light', mode: 'light',
primary: { primary: {
main: '#1e88e5', main: '#ff00c3', // Pink as the primary color
}, },
background: { background: {
default: '#ffffff', default: '#ffffff',
@@ -16,13 +16,33 @@ const lightTheme = createTheme({
primary: '#000000', primary: '#000000',
}, },
}, },
components: {
MuiTabs: {
styleOverrides: {
indicator: {
backgroundColor: '#ff00c3', // Pink for tab indicators
},
},
},
MuiButton: {
styleOverrides: {
root: {
backgroundColor: '#ff00c3', // Pink button background
color: '#ffffff',
'&:hover': {
backgroundColor: '#e600b3', // Slightly darker pink on hover
},
},
},
},
},
}); });
const darkTheme = createTheme({ const darkTheme = createTheme({
palette: { palette: {
mode: 'dark', mode: 'dark',
primary: { primary: {
main: '#90caf9', main: '#ff00c3', // Pink as the primary color
}, },
background: { background: {
default: '#121212', default: '#121212',
@@ -32,6 +52,26 @@ const darkTheme = createTheme({
primary: '#ffffff', primary: '#ffffff',
}, },
}, },
components: {
MuiTabs: {
styleOverrides: {
indicator: {
backgroundColor: '#ff00c3', // Pink for tab indicators
},
},
},
MuiButton: {
styleOverrides: {
root: {
backgroundColor: '#ff00c3', // Pink button background
color: '#ffffff',
'&:hover': {
backgroundColor: '#e600b3', // Slightly darker pink on hover
},
},
},
},
},
}); });
const ThemeModeContext = createContext({ const ThemeModeContext = createContext({

View File

@@ -38,7 +38,7 @@ const Login = () => {
const { data } = await axios.post(`${apiUrl}/auth/login`, { const { data } = await axios.post(`${apiUrl}/auth/login`, {
email, email,
password, password,
}); }, { withCredentials: true });
dispatch({ type: "LOGIN", payload: data }); dispatch({ type: "LOGIN", payload: data });
notify("success", "Welcome to Maxun!"); notify("success", "Welcome to Maxun!");
window.localStorage.setItem("user", JSON.stringify(data)); window.localStorage.setItem("user", JSON.stringify(data));

View File

@@ -39,6 +39,8 @@ const Register = () => {
email, email,
password, password,
}); });
console.log(data)
dispatch({ type: "LOGIN", payload: data }); dispatch({ type: "LOGIN", payload: data });
notify("success", "Registration Successful!"); notify("success", "Registration Successful!");
window.localStorage.setItem("user", JSON.stringify(data)); window.localStorage.setItem("user", JSON.stringify(data));