some fixes

This commit is contained in:
AmitChauhan63390
2024-11-24 00:49:39 +05:30
parent 965044a173
commit f71822f844
15 changed files with 399 additions and 164 deletions

View File

@@ -2,16 +2,13 @@ import styled from "styled-components";
import { Stack } from "@mui/material"; import { Stack } from "@mui/material";
import { useThemeMode } from "../../context/theme-provider"; import { useThemeMode } from "../../context/theme-provider";
interface LoaderProps { interface LoaderProps {
text: string; text: string;
} }
export const Loader: React.FC<LoaderProps> = ({ text }) => { export const Loader: React.FC<LoaderProps> = ({ text }) => {
const { darkMode } = useThemeMode(); const { darkMode } = useThemeMode();
return ( return (
<Stack direction="column" sx={{ margin: "30px 0px", alignItems: "center" }}> <Stack direction="column" sx={{ margin: "30px 0px", alignItems: "center" }}>
<DotsContainer> <DotsContainer>
@@ -29,14 +26,13 @@ interface StyledParagraphProps {
darkMode: boolean; darkMode: boolean;
} }
const StyledParagraph = styled.p<StyledParagraphProps>` const StyledParagraph = styled.p<StyledParagraphProps>`
font-size: medium; font-size: medium;
font-weight: 700; font-weight: 700;
font-family: inherit; font-family: inherit;
color: ${({ darkMode }) => (darkMode ? 'white' : 'black')}; color: ${({ darkMode }) => (darkMode ? 'white' : 'black')};
margin-top: 20px; margin-top: 20px;
flex-wrap: wrap;
`; `;
const DotsContainer = styled.div` const DotsContainer = styled.div`

View File

@@ -1,26 +1,23 @@
import styled from 'styled-components'; import styled from 'styled-components';
import { useThemeMode } from '../../../context/theme-provider';
export const NavBarButton = styled.button<{ disabled: boolean }>`
export const NavBarButton = styled.button<{ disabled: boolean, mode: 'light' | 'dark' }>`
margin-left: 10px; margin-left: 10px;
margin-right: 5px; margin-right: 5px;
padding: 0; padding: 0;
border: none; border: none;
background-color: transparent; background-color: ${mode => mode ? '#333' : '#ffffff'};
cursor: ${({ disabled }) => disabled ? 'default' : 'pointer'}; cursor: ${({ disabled }) => disabled ? 'default' : 'pointer'};
width: 24px; width: 24px;
height: 24px; height: 24px;
border-radius: 12px; border-radius: 12px;
outline: none; outline: none;
color: ${({ disabled }) => disabled ? '#999' : '#333'}; color: ${mode => mode ? '#ffffff' : '#333333'};
${({ disabled }) => disabled ? null : `
&:hover {
background-color: #ddd;
}
&:active {
background-color: #d0d0d0;
}
`};
`; `;
export const UrlFormButton = styled.button` export const UrlFormButton = styled.button`

View File

@@ -142,7 +142,7 @@ const Canvas = ({ width, height, onCreateRef }: CanvasProps) => {
<canvas <canvas
tabIndex={0} tabIndex={0}
ref={canvasRef} ref={canvasRef}
height={400} height={1000}
width={900} width={900}
style={{ display: 'block' }} style={{ display: 'block' }}
/> />

View File

@@ -18,6 +18,7 @@ const CustomBoxContainer = styled.div<CustomBoxContainerProps>`
background-color: ${({ isDarkMode }) => (isDarkMode ? '#313438' : 'white')}; background-color: ${({ isDarkMode }) => (isDarkMode ? '#313438' : 'white')};
color: ${({ isDarkMode }) => (isDarkMode ? 'white' : 'black')}; color: ${({ isDarkMode }) => (isDarkMode ? 'white' : 'black')};
margin: 80px 13px 25px 13px; margin: 80px 13px 25px 13px;
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
`; `;
const Triangle = styled.div<CustomBoxContainerProps>` const Triangle = styled.div<CustomBoxContainerProps>`

View File

@@ -1,6 +1,4 @@
import type { import type { FC } from 'react';
FC,
} from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import ReplayIcon from '@mui/icons-material/Replay'; import ReplayIcon from '@mui/icons-material/Replay';
@@ -13,13 +11,39 @@ import { useCallback, useEffect, useState } from "react";
import { useSocketStore } from "../../context/socket"; import { useSocketStore } from "../../context/socket";
import { getCurrentUrl } from "../../api/recording"; import { getCurrentUrl } from "../../api/recording";
import { useGlobalInfoStore } from '../../context/globalInfo'; import { useGlobalInfoStore } from '../../context/globalInfo';
import { useThemeMode } from '../../context/theme-provider';
const StyledNavBar = styled.div<{ browserWidth: number }>` const StyledNavBar = styled.div<{ browserWidth: number; isDarkMode: boolean }>`
display: flex; display: flex;
padding: 12px 0px; align-items: center;
background-color: theme.palette.background.paper; padding: 10px 20px;
width: ${({ browserWidth }) => browserWidth}px; background-color: ${({ isDarkMode }) => (isDarkMode ? '#2C2F33' : '#F5F5F5')};
border-radius: 0px 5px 0px 0px; width: ${({ browserWidth }) => `${browserWidth}px`};
border-radius: 0px 0px 8px 8px;
box-shadow: ${({ isDarkMode }) => (isDarkMode ? '0px 2px 10px rgba(0, 0, 0, 0.2)' : '0px 2px 10px rgba(0, 0, 0, 0.1)')};
transition: background-color 0.3s ease, box-shadow 0.3s ease;
margin-bottom: 15px;
`;
const IconButton = styled(NavBarButton)<{ mode: string }>`
display: flex;
align-items: center;
justify-content: center;
padding: 8px;
margin-right: 12px;
background-color: ${({ mode }) => (mode === 'dark' ? '#40444B' : '#E0E0E0')};
border-radius: 50%;
transition: background-color 0.3s ease, transform 0.1s ease;
color: ${({ mode }) => (mode === 'dark' ? '#FFFFFF' : '#333')};
cursor: pointer;
&:hover {
background-color: ${({ mode }) => (mode === 'dark' ? '#586069' : '#D0D0D0')};
}
&:active {
transform: scale(0.95);
}
`; `;
interface NavBarProps { interface NavBarProps {
@@ -31,6 +55,7 @@ const BrowserNavBar: FC<NavBarProps> = ({
browserWidth, browserWidth,
handleUrlChanged, handleUrlChanged,
}) => { }) => {
const isDarkMode = useThemeMode().darkMode;
const { socket } = useSocketStore(); const { socket } = useSocketStore();
const { recordingUrl, setRecordingUrl } = useGlobalInfoStore(); const { recordingUrl, setRecordingUrl } = useGlobalInfoStore();
@@ -67,7 +92,7 @@ const BrowserNavBar: FC<NavBarProps> = ({
socket.off('urlChanged', handleCurrentUrlChange); socket.off('urlChanged', handleCurrentUrlChange);
} }
} }
}, [socket, handleCurrentUrlChange]) }, [socket, handleCurrentUrlChange]);
const addAddress = (address: string) => { const addAddress = (address: string) => {
if (socket) { if (socket) {
@@ -78,38 +103,41 @@ const BrowserNavBar: FC<NavBarProps> = ({
}; };
return ( return (
<StyledNavBar browserWidth={900}> <StyledNavBar browserWidth={browserWidth} isDarkMode={isDarkMode}>
<NavBarButton <IconButton
type="button" type="button"
onClick={() => { onClick={() => {
socket?.emit('input:back'); socket?.emit('input:back');
}} }}
disabled={false} disabled={false}
mode={isDarkMode ? 'dark' : 'light'}
> >
<ArrowBackIcon /> <ArrowBackIcon />
</NavBarButton> </IconButton>
<NavBarButton <IconButton
type="button" type="button"
onClick={() => { onClick={() => {
socket?.emit('input:forward'); socket?.emit('input:forward');
}} }}
disabled={false} disabled={false}
mode={isDarkMode ? 'dark' : 'light'}
> >
<ArrowForwardIcon /> <ArrowForwardIcon />
</NavBarButton> </IconButton>
<NavBarButton <IconButton
type="button" type="button"
onClick={() => { onClick={() => {
if (socket) { if (socket) {
handleRefresh() handleRefresh();
} }
}} }}
disabled={false} disabled={false}
mode={isDarkMode ? 'dark' : 'light'}
> >
<ReplayIcon /> <ReplayIcon />
</NavBarButton> </IconButton>
<UrlForm <UrlForm
currentAddress={recordingUrl} currentAddress={recordingUrl}

View File

@@ -24,18 +24,19 @@ const BrowserRecordingSave = () => {
<Grid container> <Grid container>
<Grid item xs={12} md={3} lg={3}> <Grid item xs={12} md={3} lg={3}>
<div style={{ <div style={{
marginTop: '12px',
// marginLeft: '10px', // marginLeft: '10px',
color: 'white', color: 'white',
position: 'absolute', position: 'absolute',
background: '#ff00c3', background: '#ff00c3',
border: 'none', border: 'none',
borderRadius: '5px', borderRadius: '0px 0px 8px 8px',
padding: '7.5px', padding: '7.5px',
width: 'calc(100% - 20px)', // Ensure it takes full width but with padding width: '100%', // Ensure it takes full width but with padding
overflow: 'hidden', overflow: 'hidden',
display: 'flex', display: 'flex',
justifyContent: 'space-between', justifyContent: 'space-between',
height:"48px"
}}> }}>
<Button onClick={() => setOpenModal(true)} variant="outlined" style={{ marginLeft: "25px" }} size="small" color="error"> <Button onClick={() => setOpenModal(true)} variant="outlined" style={{ marginLeft: "25px" }} size="small" color="error">
Discard Discard

View File

@@ -1,8 +1,8 @@
import * as React from 'react'; import * as React from 'react';
import { Box, IconButton, Tab, Tabs } from "@mui/material"; import { Box, IconButton, Tab, Tabs } from "@mui/material";
import { AddButton } from "../atoms/buttons/AddButton";
import { useBrowserDimensionsStore } from "../../context/browserDimensions"; import { useBrowserDimensionsStore } from "../../context/browserDimensions";
import { Close } from "@mui/icons-material"; import { Close } from "@mui/icons-material";
import { useThemeMode } from '../../context/theme-provider';
interface BrowserTabsProp { interface BrowserTabsProp {
tabs: string[], tabs: string[],
@@ -28,18 +28,34 @@ export const BrowserTabs = (
handleChangeIndex(newValue); handleChangeIndex(newValue);
} }
}; };
const isDarkMode = useThemeMode().darkMode;
return ( return (
<Box sx={{ <Box sx={{
width: 800,
display: 'flex', display: 'flex',
overflow: 'auto', overflow: 'auto',
alignItems: 'center', alignItems: 'center',
backgroundColor: `${isDarkMode? '#1e2124' : 'white'}`, // Dark background synced with BrowserNavbar
padding: '8px',
borderRadius: '8px 8px 0px 0px',
boxShadow: '0px 4px 10px rgba(0, 0, 0, 0.3)', // Synced shadow style
width: '900px', // Fixed width
}}> }}>
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}> <Box sx={{ borderColor: '#333' }}> {/* Synced border color */}
<Tabs <Tabs
value={tabIndex} value={tabIndex}
onChange={handleChange} onChange={handleChange}
variant="scrollable"
scrollButtons="auto"
sx={{
backgroundColor: `${isDarkMode? '#1e2124' : 'white'}`, // Dark background synced with BrowserNavbar
minHeight: '48px',
'& .MuiTabs-indicator': {
backgroundColor: '#ff00c3', // Synced subtle indicator color
height: '3px',
borderRadius: '3px 3px 0 0',
},
}}
> >
{tabs.map((tab, index) => { {tabs.map((tab, index) => {
return ( return (
@@ -47,8 +63,19 @@ export const BrowserTabs = (
key={`tab-${index}`} key={`tab-${index}`}
id={`tab-${index}`} id={`tab-${index}`}
sx={{ sx={{
background: 'white', backgroundColor: '#f5f5f5', // Synced dark background for tabs
borderRadius: '5px 5px 0px 0px' borderRadius: '8px 8px 0px 0px',
marginRight: '8px',
minHeight: '48px',
textTransform: 'none',
fontWeight: '500',
fontSize: '14px',
color: 'black', // Synced light gray text color
'&.Mui-selected': {
backgroundColor:` ${isDarkMode?"#2a2a2a":"#f5f5f5"}`, // Synced selected tab color
color: '#ff00c3', // Slightly lighter text when selected
},
}} }}
icon={<CloseButton closeTab={() => { icon={<CloseButton closeTab={() => {
tabWasClosed = true; tabWasClosed = true;
@@ -60,15 +87,25 @@ export const BrowserTabs = (
if (!tabWasClosed) { if (!tabWasClosed) {
handleTabChange(index) handleTabChange(index)
} }
} }}
}
label={tab} label={tab}
/> />
); );
})} })}
</Tabs> </Tabs>
</Box> </Box>
{/* <AddButton handleClick={handleAddNewTab} style={{ background: 'white' }} /> */} {/* <IconButton
aria-label="add tab"
onClick={handleAddNewTab}
sx={{
backgroundColor: '#2A2A2A', // Synced dark button background
color: '#CFCFCF', // Synced light text color
marginLeft: '8px',
'&:hover': { backgroundColor: '#3A3A3A' }, // Synced hover color
}}
>
+
</IconButton> */}
</Box> </Box>
); );
} }
@@ -86,12 +123,22 @@ const CloseButton = ({ closeTab, disabled }: CloseButtonProps) => {
onClick={closeTab} onClick={closeTab}
disabled={disabled} disabled={disabled}
sx={{ sx={{
height: '34px', height: '28px',
'&:hover': { color: 'white', backgroundColor: '#1976d2' } width: '28px',
padding: '4px',
backgroundColor: '#3A3A3A', // Synced dark gray background
borderRadius: '50%',
'&:hover': {
backgroundColor: '#505050', // Synced hover color for close button
color: '#FFFFFF',
},
'&.Mui-disabled': {
opacity: 0.4, // Lower opacity for disabled state
},
transition: 'background-color 0.3s ease, color 0.3s ease',
}} }}
component="span"
> >
<Close /> <Close fontSize="small" />
</IconButton> </IconButton>
); );
} }

View File

@@ -17,6 +17,7 @@ import StorageIcon from '@mui/icons-material/Storage';
import ArrowUpwardIcon from '@mui/icons-material/ArrowUpward'; import ArrowUpwardIcon from '@mui/icons-material/ArrowUpward';
import { SidePanelHeader } from './SidePanelHeader'; import { SidePanelHeader } from './SidePanelHeader';
import { useGlobalInfoStore } from '../../context/globalInfo'; import { useGlobalInfoStore } from '../../context/globalInfo';
import { useThemeMode } from '../../context/theme-provider';
interface InterpretationLogProps { interface InterpretationLogProps {
isOpen: boolean; isOpen: boolean;
@@ -113,6 +114,8 @@ export const InterpretationLog: React.FC<InterpretationLogProps> = ({ isOpen, se
} }
}, [hasScrapeListAction, hasScrapeSchemaAction, hasScreenshotAction, setIsOpen]); }, [hasScrapeListAction, hasScrapeSchemaAction, hasScreenshotAction, setIsOpen]);
const isDarkMode = useThemeMode();
return ( return (
<Grid container> <Grid container>
<Grid item xs={12} md={9} lg={9}> <Grid item xs={12} md={9} lg={9}>
@@ -121,7 +124,9 @@ export const InterpretationLog: React.FC<InterpretationLogProps> = ({ isOpen, se
variant="contained" variant="contained"
color="primary" color="primary"
sx={{ sx={{
marginTop: '10px',
borderRadius: ' 0 0 10px 10px',
color: 'white', color: 'white',
position: 'absolute', position: 'absolute',
background: '#ff00c3', background: '#ff00c3',
@@ -145,8 +150,8 @@ export const InterpretationLog: React.FC<InterpretationLogProps> = ({ isOpen, se
onOpen={toggleDrawer(true)} onOpen={toggleDrawer(true)}
PaperProps={{ PaperProps={{
sx: { sx: {
background: 'white', background: `${isDarkMode ? '#1e2124' : 'white'}`,
color: 'black', color: `${isDarkMode ? 'white' : 'black'}`,
padding: '10px', padding: '10px',
height: 500, height: 500,
width: width - 10, width: width - 10,

View File

@@ -1,15 +1,25 @@
import React, { useState, useContext } from 'react'; import React, { useState, useContext } from 'react';
import axios from 'axios'; import axios from 'axios';
import { useNavigate } from 'react-router-dom';
import {
IconButton,
Menu,
MenuItem,
Typography,
Tooltip,
Chip
} from "@mui/material";
import {
AccountCircle,
Logout,
Clear,
Brightness4,
Brightness7
} from "@mui/icons-material";
import styled from "styled-components"; import styled from "styled-components";
import { stopRecording } from "../../api/recording"; import { stopRecording } from "../../api/recording";
import { useGlobalInfoStore } from "../../context/globalInfo"; import { useGlobalInfoStore } from "../../context/globalInfo";
import { IconButton, Menu, MenuItem, Typography, Avatar, Tooltip,Chip } from "@mui/material";
import { AccountCircle, Logout, Clear, Brightness4, Brightness7 } from "@mui/icons-material";
import { AccountCircle, Logout, Clear } from "@mui/icons-material";
import { useNavigate } from 'react-router-dom';
import { AuthContext } from '../../context/auth'; import { AuthContext } from '../../context/auth';
import { SaveRecording } from '../molecules/SaveRecording'; import { SaveRecording } from '../molecules/SaveRecording';
import DiscordIcon from '../atoms/DiscordIcon'; import DiscordIcon from '../atoms/DiscordIcon';
@@ -23,13 +33,11 @@ interface NavBarProps {
} }
export const NavBar: React.FC<NavBarProps> = ({ recordingName, isRecording }) => { export const NavBar: React.FC<NavBarProps> = ({ recordingName, isRecording }) => {
const { notify, browserId, setBrowserId } = useGlobalInfoStore(); const { notify, browserId, setBrowserId } = useGlobalInfoStore();
const { state, dispatch } = useContext(AuthContext); const { state, dispatch } = useContext(AuthContext);
const { user } = state; const { user } = state;
const navigate = useNavigate(); const navigate = useNavigate();
const { darkMode, toggleTheme } = useThemeMode(); const { darkMode, toggleTheme } = useThemeMode();
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null); const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
const handleMenuOpen = (event: React.MouseEvent<HTMLElement>) => { const handleMenuOpen = (event: React.MouseEvent<HTMLElement>) => {
@@ -57,99 +65,167 @@ export const NavBar: React.FC<NavBarProps> = ({ recordingName, isRecording }) =>
navigate('/'); navigate('/');
}; };
const renderBrandSection = () => (
<BrandContainer>
<LogoImage src={MaxunLogo} alt="Maxun Logo" />
<ProjectName mode={darkMode ? 'dark' : 'light'}>Maxun</ProjectName>
<Chip
label="beta"
variant="outlined"
sx={{
marginTop: '10px',
borderColor: '#ff00c3',
color: '#ff00c3'
}}
/>
</BrandContainer>
);
const renderSocialButtons = () => (
<>
<IconButton
component="a"
href="https://discord.gg/5GbPjBUkws"
target="_blank"
rel="noopener noreferrer"
sx={{
...styles.socialButton,
color: darkMode ? '#ffffff' : '#333333',
'&:hover': {
color: '#ff00c3'
}
}}
>
<DiscordIcon sx={{ marginRight: '5px' }} />
</IconButton>
<iframe
src="https://ghbtns.com/github-btn.html?user=getmaxun&repo=maxun&type=star&count=true&size=large"
frameBorder="0"
scrolling="0"
width="170"
height="30"
title="GitHub"
/>
</>
);
const renderUserMenu = () => (
<>
<IconButton
onClick={handleMenuOpen}
sx={styles.userButton(darkMode)}
>
<AccountCircle sx={{ marginRight: '5px' }} />
<Typography variant="body1">{user?.email}</Typography>
</IconButton>
<Menu
anchorEl={anchorEl}
open={Boolean(anchorEl)}
onClose={handleMenuClose}
anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}
transformOrigin={{ vertical: 'top', horizontal: 'right' }}
PaperProps={{
sx: {
backgroundColor: darkMode ? '#1e2124' : '#ffffff',
color: darkMode ? '#ffffff' : '#333333'
}
}}
>
<MenuItem onClick={() => { handleMenuClose(); logout(); }}>
<Logout sx={{ marginRight: '5px' }} /> Logout
</MenuItem>
</Menu>
</>
);
const renderThemeToggle = () => (
<Tooltip title="Toggle light/dark theme">
<IconButton
onClick={toggleTheme}
sx={{
color: darkMode ? '#ffffff' : '#333333',
'&:hover': {
color: '#ff00c3'
}
}}
>
{darkMode ? <Brightness7 /> : <Brightness4 />}
</IconButton>
</Tooltip>
);
const renderRecordingControls = () => (
<>
<IconButton
onClick={goToMainMenu}
sx={styles.discardButton}
>
<Clear sx={{ marginRight: '5px' }} />
Discard
</IconButton>
<SaveRecording fileName={recordingName} />
</>
);
return ( return (
<NavBarWrapper mode={darkMode ? 'dark' : 'light'}> <NavBarWrapper mode={darkMode ? 'dark' : 'light'}>
<div style={{ display: 'flex', justifyContent: 'flex-start' }}> {renderBrandSection()}
<img src={MaxunLogo} width={45} height={40} style={{ borderRadius: '5px', margin: '5px 0px 5px 15px' }} /> {user && (
<ControlsContainer>
<div style={{ padding: '11px' }}><ProjectName>Maxun</ProjectName></div> {!isRecording ? (
<Chip label="beta" color="primary" variant="outlined" sx={{ marginTop: '10px' }} /> <>
</div> {renderSocialButtons()}
{ {renderUserMenu()}
user ? ( {renderThemeToggle()}
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'flex-end' }}>
{!isRecording ? (
<>
<IconButton
component="a"
href="https://discord.gg/5GbPjBUkws"
target="_blank"
rel="noopener noreferrer"
sx={{
display: 'flex',
alignItems: 'center',
borderRadius: '5px',
padding: '8px',
marginRight: '30px',
}}
>
<DiscordIcon sx={{ marginRight: '5px' }} />
</IconButton>
<iframe src="https://ghbtns.com/github-btn.html?user=getmaxun&repo=maxun&type=star&count=true&size=large" frameBorder="0" scrolling="0" width="170" height="30" title="GitHub"></iframe>
<IconButton onClick={handleMenuOpen} sx={{
display: 'flex',
alignItems: 'center',
borderRadius: '5px',
padding: '8px',
}}
>
<DiscordIcon sx={{ marginRight: '5px' }} />
</IconButton>
<iframe src="https://ghbtns.com/github-btn.html?user=getmaxun&repo=maxun&type=star&count=true&size=large" frameBorder="0" scrolling="0" width="170" height="30" title="GitHub"></iframe>
<IconButton onClick={handleMenuOpen} sx={{
display: 'flex',
alignItems: 'center',
borderRadius: '5px',
padding: '8px',
marginRight: '10px',
'&:hover': { backgroundColor: darkMode ? '#333':'#F5F5F5', color: '#ff00c3' }
}}>
<AccountCircle sx={{ marginRight: '5px' }} />
<Typography variant="body1">{user.email}</Typography>
</IconButton>
<Menu
anchorEl={anchorEl}
open={Boolean(anchorEl)}
onClose={handleMenuClose}
anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}
transformOrigin={{ vertical: 'top', horizontal: 'right' }}
>
<MenuItem onClick={() => { handleMenuClose(); logout(); }}>
<Logout sx={{ marginRight: '5px' }} /> Logout
</MenuItem>
</Menu>
{/* Theme Toggle Button */}
<Tooltip title="Toggle light/dark theme">
<IconButton onClick={toggleTheme} color="inherit">
{darkMode ? <Brightness7 /> : <Brightness4 />}
</IconButton>
</Tooltip>
</> </>
) : ( ) : (
<> renderRecordingControls()
<IconButton onClick={goToMainMenu} sx={{
borderRadius: '5px',
padding: '8px',
background: 'red',
color: 'white',
marginRight: '10px',
'&:hover': { color: 'white', backgroundColor: 'red' }
}}>
<Clear sx={{ marginRight: '5px' }} />
Discard
</IconButton>
<SaveRecording fileName={recordingName} />
</>
)} )}
</div> </ControlsContainer>
) : null} )}
</NavBarWrapper> </NavBarWrapper>
); );
}; };
// Styles
const styles = {
socialButton: {
display: 'flex',
alignItems: 'center',
borderRadius: '5px',
padding: '8px',
marginRight: '30px',
color: '#333333',
'&:hover': {
color: '#ff00c3'
}
},
userButton: (darkMode: boolean) => ({
display: 'flex',
alignItems: 'center',
borderRadius: '5px',
padding: '8px',
marginRight: '10px',
color: darkMode ? '#ffffff' : '#333333',
'&:hover': {
backgroundColor: darkMode ? '#333' : '#F5F5F5',
color: '#ff00c3'
}
}),
discardButton: {
borderRadius: '5px',
padding: '8px',
background: 'red',
color: 'white',
marginRight: '10px',
'&:hover': {
color: 'white',
backgroundColor: '#ff0000'
}
}
};
// Styled Components
const NavBarWrapper = styled.div<{ mode: 'light' | 'dark' }>` const NavBarWrapper = styled.div<{ mode: 'light' | 'dark' }>`
grid-area: navbar; grid-area: navbar;
background-color: ${({ mode }) => (mode === 'dark' ? '#1e2124' : '#ffffff')}; background-color: ${({ mode }) => (mode === 'dark' ? '#1e2124' : '#ffffff')};
@@ -159,7 +235,27 @@ const NavBarWrapper = styled.div<{ mode: 'light' | 'dark' }>`
border-bottom: 1px solid ${({ mode }) => (mode === 'dark' ? '#333' : '#e0e0e0')}; border-bottom: 1px solid ${({ mode }) => (mode === 'dark' ? '#333' : '#e0e0e0')};
`; `;
const ProjectName = styled.b<{ mode: 'light' | 'dark' }>` const BrandContainer = styled.div`
color: ${({ mode }) => (mode === 'dark' ? 'white' : 'black')}; display: flex;
font-size: 1.3em; justify-content: flex-start;
`; `;
const LogoImage = styled.img.attrs({
width: 45,
height: 40,
})`
border-radius: 5px;
margin: 5px 0px 5px 15px;
`;
const ProjectName = styled.b<{ mode: 'light' | 'dark' }>`
color: ${({ mode }) => (mode === 'dark' ? 'white' : '#333333')};
font-size: 1.3em;
padding: 11px;
`;
const ControlsContainer = styled.div`
display: flex;
align-items: center;
justify-content: flex-end;
`;

View File

@@ -75,10 +75,50 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
<Box sx={{ width: '100%' }}> <Box sx={{ width: '100%' }}>
<TabContext value={tab}> <TabContext value={tab}>
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}> <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
<Tabs value={tab} onChange={(e, newTab) => setTab(newTab)} aria-label="run-content-tabs"> <Tabs
<Tab label="Output Data" value='output' /> value={tab}
<Tab label="Log" value='log' /> onChange={(e, newTab) => setTab(newTab)}
</Tabs> aria-label="run-content-tabs"
sx={{
// Remove the default blue indicator
'& .MuiTabs-indicator': {
backgroundColor: '#FF00C3', // Change to pink
},
// Remove default transition effects
'& .MuiTab-root': {
'&.Mui-selected': {
color: '#FF00C3',
},
}
}}
>
<Tab
label="Output Data"
value='output'
sx={{
color: (theme) => theme.palette.mode === 'dark' ? '#fff' : '#000',
'&:hover': {
color: '#FF00C3'
},
'&.Mui-selected': {
color: '#FF00C3',
}
}}
/>
<Tab
label="Log"
value='log'
sx={{
color: (theme) => theme.palette.mode === 'dark' ? '#fff' : '#000',
'&:hover': {
color: '#FF00C3'
},
'&.Mui-selected': {
color: '#FF00C3',
}
}}
/>
</Tabs>
</Box> </Box>
<TabPanel value='log'> <TabPanel value='log'>
<Box sx={{ <Box sx={{
@@ -159,6 +199,7 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
background: 'rgba(0,0,0,0.06)', background: 'rgba(0,0,0,0.06)',
maxHeight: '300px', maxHeight: '300px',
overflow: 'scroll', overflow: 'scroll',
backgroundColor: '#19171c'
}}> }}>
<pre> <pre>
{JSON.stringify(row.serializableOutput, null, 2)} {JSON.stringify(row.serializableOutput, null, 2)}

View File

@@ -76,7 +76,7 @@ export const SaveRecording = ({ fileName }: SaveRecordingProps) => {
return ( return (
<div> <div>
<Button onClick={() => setOpenModal(true)} variant="outlined" sx={{ marginRight: '20px' }} size="small" color="success"> <Button onClick={() => setOpenModal(true)} variant='contained' sx={{ marginRight: '20px',backgroundColor: '#ff00c3',color: 'white' }} size="small" color="success">
Finish Finish
</Button> </Button>

View File

@@ -12,6 +12,7 @@ import {
} from "../../api/recording"; } from "../../api/recording";
import { Box } from "@mui/material"; import { Box } from "@mui/material";
import { InterpretationLog } from "../molecules/InterpretationLog"; import { InterpretationLog } from "../molecules/InterpretationLog";
import { Height } from "@mui/icons-material";
// TODO: Tab !show currentUrl after recordingUrl global state // TODO: Tab !show currentUrl after recordingUrl global state
export const BrowserContent = () => { export const BrowserContent = () => {
@@ -139,7 +140,7 @@ export const BrowserContent = () => {
}, [handleUrlChanged]); }, [handleUrlChanged]);
return ( return (
<div id="browser"> <div id="browser" style={{ display: "flex", flexDirection: "column"}} >
<BrowserTabs <BrowserTabs
tabs={tabs} tabs={tabs}
handleTabChange={handleTabChange} handleTabChange={handleTabChange}
@@ -152,10 +153,15 @@ export const BrowserContent = () => {
// todo: use width from browser dimension once fixed // todo: use width from browser dimension once fixed
browserWidth={900} browserWidth={900}
handleUrlChanged={handleUrlChanged} handleUrlChanged={handleUrlChanged}
/> />
<BrowserWindow /> <BrowserWindow />
</div> </div>
); );
}; };
const BrowserContentWrapper = styled.div``; const BrowserContentWrapper = styled.div`
position: relative;
width: 100vw;
height: 100vh;
overflow: hidden;`;

View File

@@ -319,7 +319,7 @@ export const BrowserWindow = () => {
return ( return (
<div onClick={handleClick} style={{ width: '900px' }} id="browser-window"> <div onClick={handleClick} style={{ width: '900px', height: "400px" , borderRadius: '8px 8px 0px 0px '}} id="browser-window">
{ {
getText === true || getList === true ? ( getText === true || getList === true ? (
<GenericModal <GenericModal

View File

@@ -391,7 +391,22 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
const theme = useThemeMode(); const theme = useThemeMode();
const isDarkMode = theme.darkMode; const isDarkMode = theme.darkMode;
return ( return (
<Paper sx={{ height: '520px', width: 'auto', alignItems: "center", background: isDarkMode?'#1E2124': 'inherit',color: isDarkMode ? 'black' : 'inherit' }} id="browser-actions" elevation={0}> <Paper
sx={{
borderRadius: '8px 8px 0px 0px', // Slightly more rounded corners for a smoother look
height: '520px',
width: 'auto',
alignItems: "center",
padding: '16px', // Add padding for spacing inside the component
background: isDarkMode
? 'linear-gradient(135deg, #1E2124 0%, #292C2F 100%)' // Subtle gradient for dark mode
: 'linear-gradient(135deg, #f5f5f5 0%, #ffffff 100%)', // Subtle gradient for light mode
color: isDarkMode ? '#E0E0E0' : '#333333', // Adjusted color for better contrast
// Smooth transition for shadows and background changes
}}
id="browser-actions"
elevation={0}
>
{/* <SimpleBox height={60} width='100%' background='lightGray' radius='0%'> {/* <SimpleBox height={60} width='100%' background='lightGray' radius='0%'>
<Typography sx={{ padding: '10px' }}>Last action: {` ${lastAction}`}</Typography> <Typography sx={{ padding: '10px' }}>Last action: {` ${lastAction}`}</Typography>
</SimpleBox> */} </SimpleBox> */}
@@ -484,7 +499,7 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
</Box> </Box>
<Box> <Box>
{browserSteps.map(step => ( {browserSteps.map(step => (
<Box key={step.id} onMouseEnter={() => handleMouseEnter(step.id)} onMouseLeave={() => handleMouseLeave(step.id)} sx={{ padding: '10px', margin: '11px', borderRadius: '5px', position: 'relative', background: 'white' }}> <Box key={step.id} onMouseEnter={() => handleMouseEnter(step.id)} onMouseLeave={() => handleMouseLeave(step.id)} sx={{ padding: '10px', margin: '11px', borderRadius: '5px', position: 'relative', background: isDarkMode ? "#1E2124" : 'white', color: isDarkMode ? "white" : 'black' }}>
{ {
step.type === 'text' && ( step.type === 'text' && (
<> <>
@@ -520,7 +535,7 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
</InputAdornment> </InputAdornment>
) )
}} }}
sx={{ background: isDarkMode ? "#1E2124" : 'white', color: isDarkMode ? "white" : 'black' }}
/> />
{!confirmedTextSteps[step.id] && ( {!confirmedTextSteps[step.id] && (
<Box display="flex" justifyContent="space-between" gap={2}> <Box display="flex" justifyContent="space-between" gap={2}>
@@ -542,7 +557,7 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
<> <>
<Typography>List Selected Successfully</Typography> <Typography>List Selected Successfully</Typography>
{Object.entries(step.fields).map(([key, field]) => ( {Object.entries(step.fields).map(([key, field]) => (
<Box key={key}> <Box key={key} sx={{ padding: '10px', margin: '11px', borderRadius: '5px', position: 'relative', background: `${isDarkMode ? "#1E2124" : 'white'}` }}>
<TextField <TextField
label="Field Label" label="Field Label"
value={field.label || ''} value={field.label || ''}
@@ -558,7 +573,7 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
) )
}} }}
style={{ background: isDarkMode ? "#1E2124" : 'white' }}
/> />
<TextField <TextField
label="Field Data" label="Field Data"
@@ -573,7 +588,7 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
</InputAdornment> </InputAdornment>
) )
}} }}
style={{ background: isDarkMode ? "#1E2124" : 'white' }}
/> />
{!confirmedListTextFields[step.id]?.[key] && ( {!confirmedListTextFields[step.id]?.[key] && (
<Box display="flex" justifyContent="space-between" gap={2}> <Box display="flex" justifyContent="space-between" gap={2}>

View File

@@ -59,7 +59,9 @@ export const RecordingPage = ({ recordingName }: RecordingPageProps) => {
useEffect(() => { useEffect(() => {
if (darkMode) { if (darkMode) {
document.body.style.background = 'rgba(18,18,18,1)'; document.body.style.background = 'rgba(18,18,18,1)';
} else { } else {
document.body.style.background = 'radial-gradient(circle, rgba(255, 255, 255, 1) 0%, rgba(232, 191, 222, 1) 100%, rgba(255, 255, 255, 1) 100%)'; document.body.style.background = 'radial-gradient(circle, rgba(255, 255, 255, 1) 0%, rgba(232, 191, 222, 1) 100%, rgba(255, 255, 255, 1) 100%)';
} }