Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(refactor): move away from atomic design pattern #333

Merged
merged 64 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
314b9f9
chore: lint
amhsirak Jan 9, 2025
37cdcf6
chore: lint
amhsirak Jan 9, 2025
528507e
chore: lint
amhsirak Jan 9, 2025
1da937a
chore: lint
amhsirak Jan 9, 2025
1530626
chore: lint
amhsirak Jan 9, 2025
2e24650
chore: lint
amhsirak Jan 9, 2025
50062fa
chore: lint
amhsirak Jan 9, 2025
d124004
chore: lint
amhsirak Jan 9, 2025
3d646eb
chore: lint
amhsirak Jan 9, 2025
1b5051d
chore: lint
amhsirak Jan 9, 2025
00776ad
chore: lint
amhsirak Jan 9, 2025
bead6a0
chore: lint
amhsirak Jan 9, 2025
e6a77a2
chore: lint
amhsirak Jan 9, 2025
f5ba146
chore: lint
amhsirak Jan 9, 2025
06034ec
chore: lint
amhsirak Jan 9, 2025
db67d16
chore: lint
amhsirak Jan 9, 2025
b841405
chore: lint
amhsirak Jan 9, 2025
70e99f8
chore: lint
amhsirak Jan 9, 2025
880cabb
chore: lint
amhsirak Jan 9, 2025
9a517fc
chore: lint
amhsirak Jan 9, 2025
cc369c5
chore: lint
amhsirak Jan 9, 2025
1842ebb
chore: lint
amhsirak Jan 9, 2025
c52c10a
chore: lint
amhsirak Jan 9, 2025
792e39b
chore: lint
amhsirak Jan 9, 2025
6933b4f
chore: lint
amhsirak Jan 9, 2025
61e6429
chore: lint
amhsirak Jan 9, 2025
e12d115
chore: lint
amhsirak Jan 9, 2025
de7f81e
chore: lint
amhsirak Jan 9, 2025
8207689
chore: lint
amhsirak Jan 9, 2025
5f4073a
chore: lint
amhsirak Jan 9, 2025
adb9c46
chore: lint
amhsirak Jan 9, 2025
1546ce5
chore: lint
amhsirak Jan 9, 2025
e879525
chore: lint
amhsirak Jan 9, 2025
2ac581f
chore: lint
amhsirak Jan 9, 2025
fe6d29a
chore: lint
amhsirak Jan 9, 2025
ca65359
chore: lint
amhsirak Jan 9, 2025
c814e37
chore: lint
amhsirak Jan 9, 2025
6b79c3a
chore: lint
amhsirak Jan 9, 2025
5af1cd4
feat: move buttons to ui directory
amhsirak Jan 9, 2025
6640e88
feat: move loader and text to ui directory
amhsirak Jan 9, 2025
6c59dc5
feat: move form to ui directory
amhsirak Jan 9, 2025
31a5e44
feat: move dropdown mui to ui directory
amhsirak Jan 9, 2025
aca84da
feat: move componentsto ui directory
amhsirak Jan 9, 2025
f809959
feat: create proxy directory
amhsirak Jan 9, 2025
4802229
feat: create api ui directory
amhsirak Jan 9, 2025
dc0dc11
feat: create pickers ui directory
amhsirak Jan 9, 2025
de51793
feat: create icons ui directory
amhsirak Jan 9, 2025
f152bd0
feat: create integration sui directory
amhsirak Jan 9, 2025
4325070
feat: create robot ui directory
amhsirak Jan 9, 2025
82b8b4d
feat: create run ui directory
amhsirak Jan 9, 2025
416d581
feat: create run ui directory
amhsirak Jan 9, 2025
4d2b018
feat: create robot ui directory
amhsirak Jan 9, 2025
18b91fd
feat: create robot ui directory
amhsirak Jan 9, 2025
a3de19a
feat: create run ui directory
amhsirak Jan 9, 2025
403345b
feat: create recorder ui directory
amhsirak Jan 9, 2025
2d0d18d
feat: create recorder ui directory
amhsirak Jan 9, 2025
70deb3f
feat: create browser ui directory
amhsirak Jan 9, 2025
8c5a5d7
feat: create dashboard ui directory
amhsirak Jan 9, 2025
78e9ac1
feat: create action ui directory
amhsirak Jan 9, 2025
07abb00
chore: remove unused import
amhsirak Jan 9, 2025
95eba1b
chore: remove unused import
amhsirak Jan 9, 2025
4733049
chore: remove unused import
amhsirak Jan 9, 2025
9c3a7a8
chore: whitespace
amhsirak Jan 9, 2025
4949304
chore: whitespace
amhsirak Jan 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/api/storage.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { default as axios } from "axios";
import { WorkflowFile } from "maxun-core";
import { RunSettings } from "../components/molecules/RunSettings";
import { ScheduleSettings } from "../components/molecules/ScheduleSettings";
import { RunSettings } from "../components/run/RunSettings";
import { ScheduleSettings } from "../components/robot/ScheduleSettings";
import { CreateRunResponse, ScheduleRunResponse } from "../pages/MainPage";
import { apiUrl } from "../apiConfig";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { forwardRef, useImperativeHandle } from 'react';
import { Stack, TextField } from "@mui/material";
import { WarningText } from '../../atoms/texts';
import { WarningText } from '../../ui/texts';
import InfoIcon from "@mui/icons-material/Info";

export const ScrapeSettings = forwardRef((props, ref) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { forwardRef, useCallback, useImperativeHandle, useRef } from 'react';
import { WarningText } from "../../atoms/texts";
import React, { forwardRef, useImperativeHandle, useRef } from 'react';
import { WarningText } from "../../ui/texts";
import InfoIcon from "@mui/icons-material/Info";
import { KeyValueForm } from "../KeyValueForm";
import { KeyValueForm } from "../../recorder/KeyValueForm";

export const ScrapeSchemaSettings = forwardRef((props, ref) => {
const keyValueFormRef = useRef<{ getObject: () => object }>(null);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { forwardRef, useImperativeHandle } from 'react';
import { InputLabel, MenuItem, TextField, Select, FormControl } from "@mui/material";
import { MenuItem, TextField } from "@mui/material";
import { ScreenshotSettings as Settings } from "../../../shared/types";
import styled from "styled-components";
import { SelectChangeEvent } from "@mui/material/Select/Select";
import { Dropdown } from "../../atoms/DropdownMui";
import { Dropdown } from "../../ui/DropdownMui";

export const ScreenshotSettings = forwardRef((props, ref) => {
const [settings, setSettings] = React.useState<Settings>({});
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import React, { useCallback, useEffect, useState } from "react";
import styled from "styled-components";
import BrowserNavBar from "../molecules/BrowserNavBar";
import BrowserNavBar from "./BrowserNavBar";
import { BrowserWindow } from "./BrowserWindow";
import { useBrowserDimensionsStore } from "../../context/browserDimensions";
import { BrowserTabs } from "../molecules/BrowserTabs";
import { BrowserTabs } from "./BrowserTabs";
import { useSocketStore } from "../../context/socket";
import {
getCurrentTabs,
getCurrentUrl,
interpretCurrentRecording,
} from "../../api/recording";
import { Box } from "@mui/material";
import { InterpretationLog } from "../molecules/InterpretationLog";

// TODO: Tab !show currentUrl after recordingUrl global state
export const BrowserContent = () => {
Expand Down Expand Up @@ -152,9 +148,9 @@ export const BrowserContent = () => {
// todo: use width from browser dimension once fixed
browserWidth={900}
handleUrlChanged={handleUrlChanged}

/>
<BrowserWindow />
<BrowserWindow />
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import type { FC } from 'react';
import styled from 'styled-components';

import ReplayIcon from '@mui/icons-material/Replay';
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
import ArrowForwardIcon from '@mui/icons-material/ArrowForward';

import { NavBarButton } from '../atoms/buttons/buttons';
import { NavBarButton } from '../ui/buttons/buttons';
import { UrlForm } from './UrlForm';
import { useCallback, useEffect, useState } from "react";
import { useSocketStore } from "../../context/socket";
Expand All @@ -21,7 +19,7 @@ const StyledNavBar = styled.div<{ browserWidth: number; isDarkMode: boolean }>`
border-radius: 0px 5px 0px 0px;
`;

const IconButton = styled(NavBarButton)<{ mode: string }>`
const IconButton = styled(NavBarButton) <{ mode: string }>`
background-color: ${({ mode }) => (mode === 'dark' ? '#2C2F33' : '#f6f6f6')};
transition: background-color 0.3s ease, transform 0.1s ease;
color: ${({ mode }) => (mode === 'dark' ? '#FFFFFF' : '#333')};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useState } from 'react'
import { Grid, Button, Box, Typography } from '@mui/material';
import { SaveRecording } from "./SaveRecording";
import { SaveRecording } from "../recorder/SaveRecording";
import { useGlobalInfoStore } from '../../context/globalInfo';
import { stopRecording } from "../../api/recording";
import { useNavigate } from 'react-router-dom';
import { GenericModal } from "../atoms/GenericModal";
import { GenericModal } from "../ui/GenericModal";
import { useTranslation } from 'react-i18next';

const BrowserRecordingSave = () => {
Expand Down Expand Up @@ -37,18 +37,18 @@ const BrowserRecordingSave = () => {
overflow: 'hidden',
display: 'flex',
justifyContent: 'space-between',
height:"48px"
height: "48px"
}}>
<Button
onClick={() => setOpenModal(true)}
variant="outlined"
color="error"
sx={{
<Button
onClick={() => setOpenModal(true)}
variant="outlined"
color="error"
sx={{
marginLeft: '25px',
color: 'red !important',
borderColor: 'red !important',
backgroundColor: 'whitesmoke !important',
}}
}}
size="small"
>
{t('right_panel.buttons.discard')}
Expand All @@ -60,10 +60,10 @@ const BrowserRecordingSave = () => {
<Button onClick={goToMainMenu} variant="contained" color="error">
{t('right_panel.buttons.discard')}
</Button>
<Button
onClick={() => setOpenModal(false)}
<Button
onClick={() => setOpenModal(false)}
variant="outlined"
sx={{
sx={{
color: '#ff00c3 !important',
borderColor: '#ff00c3 !important',
backgroundColor: 'whitesmoke !important',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ export const BrowserTabs = (
id={`tab-${index}`}
sx={{
background: 'white',
borderRadius: '5px 5px 0px 0px',
borderRadius: '5px 5px 0px 0px',
'&.Mui-selected': {
backgroundColor:` ${isDarkMode?"#2a2a2a":"#f5f5f5"}`, // Synced selected tab color
backgroundColor: ` ${isDarkMode ? "#2a2a2a" : "#f5f5f5"}`, // Synced selected tab color
color: '#ff00c3', // Slightly lighter text when selected
},
}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { useCallback, useEffect, useState } from 'react';
import { useSocketStore } from '../../context/socket';
import { Button } from '@mui/material';
import Canvas from "../atoms/canvas";
import { Highlighter } from "../atoms/Highlighter";
import { GenericModal } from '../atoms/GenericModal';
import Canvas from "../recorder/canvas";
import { Highlighter } from "../recorder/Highlighter";
import { GenericModal } from '../ui/GenericModal';
import { useActionContext } from '../../context/browserActions';
import { useBrowserSteps, TextStep } from '../../context/browserSteps';
import { useGlobalInfoStore } from '../../context/globalInfo';
Expand Down Expand Up @@ -141,9 +141,9 @@ export const BrowserWindow = () => {
} else if (data.elementInfo?.isIframeContent && data.childSelectors) {
// Handle pure iframe elements - similar to previous shadow DOM logic but using iframe syntax
// Check if the selector matches any iframe child selectors
const isIframeChild = data.childSelectors.some(childSelector =>
const isIframeChild = data.childSelectors.some(childSelector =>
data.selector.includes(':>>') && // Iframe uses :>> for traversal
childSelector.split(':>>').some(part =>
childSelector.split(':>>').some(part =>
data.selector.includes(part.trim())
)
);
Expand All @@ -152,46 +152,46 @@ export const BrowserWindow = () => {
// Handle mixed DOM cases with iframes
// Split the selector into parts and check each against child selectors
const selectorParts = data.selector.split(':>>').map(part => part.trim());
const isValidMixedSelector = selectorParts.some(part =>
const isValidMixedSelector = selectorParts.some(part =>
// We know data.childSelectors is defined due to hasValidChildSelectors check
data.childSelectors!.some(childSelector =>
data.childSelectors!.some(childSelector =>
childSelector.includes(part)
)
);
setHighlighterData(isValidMixedSelector ? data : null);
} else if (data.elementInfo?.isShadowRoot && data.childSelectors) {
// New case: Handle pure Shadow DOM elements
// Check if the selector matches any shadow root child selectors
const isShadowChild = data.childSelectors.some(childSelector =>
const isShadowChild = data.childSelectors.some(childSelector =>
data.selector.includes('>>') && // Shadow DOM uses >> for piercing
childSelector.split('>>').some(part =>
childSelector.split('>>').some(part =>
data.selector.includes(part.trim())
)
);
setHighlighterData(isShadowChild ? data : null);
} else if (data.selector.includes('>>') && hasValidChildSelectors) {
} else if (data.selector.includes('>>') && hasValidChildSelectors) {
// New case: Handle mixed DOM cases
// Split the selector into parts and check each against child selectors
const selectorParts = data.selector.split('>>').map(part => part.trim());
const isValidMixedSelector = selectorParts.some(part =>
const isValidMixedSelector = selectorParts.some(part =>
// Now we know data.childSelectors is defined
data.childSelectors!.some(childSelector =>
data.childSelectors!.some(childSelector =>
childSelector.includes(part)
)
);
setHighlighterData(isValidMixedSelector ? data : null);
} else {
} else {
// if !valid child in normal mode, clear the highlighter
setHighlighterData(null);
}
} else {
}
} else {
// Set highlighterData for the initial listSelector selection
setHighlighterData(data);
}
} else {
}
} else {
// For non-list steps
setHighlighterData(data);
}
}
}, [highlighterData, getList, socket, listSelector, paginationMode, paginationType, captureStage]);


Expand Down Expand Up @@ -403,11 +403,11 @@ export const BrowserWindow = () => {
overflow: 'hidden',
padding: '5px 10px',
}}
sx={{
sx={{
color: '#ff00c3 !important',
borderColor: '#ff00c3 !important',
backgroundColor: 'whitesmoke !important',
}}
}}
>
<span style={{
display: 'block',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useState, useEffect, useCallback, useRef } from 'react';
import type { SyntheticEvent } from 'react';
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
import { NavBarForm, NavBarInput } from "../atoms/form";
import { UrlFormButton } from "../atoms/buttons/buttons";
import { NavBarForm, NavBarInput } from "../ui/form";
import { UrlFormButton } from "../ui/buttons/buttons";
import { useSocketStore } from '../../context/socket';
import { Socket } from "socket.io-client";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,20 @@ import React from 'react';
import Tabs from '@mui/material/Tabs';
import Tab from '@mui/material/Tab';
import Box from '@mui/material/Box';

import { Paper, Button, useTheme } from "@mui/material";
import { AutoAwesome, FormatListBulleted, VpnKey, Usb, Article, CloudQueue,Code, } from "@mui/icons-material";


import { AutoAwesome, FormatListBulleted, VpnKey, Usb, Article, CloudQueue, Code, } from "@mui/icons-material";
import { apiUrl } from "../../apiConfig";
import { useTranslation } from 'react-i18next';
import i18n from '../../i18n';



interface MainMenuProps {
value: string;
handleChangeContent: (newValue: string) => void;
}

export const MainMenu = ({ value = 'recordings', handleChangeContent }: MainMenuProps) => {
const theme = useTheme();
const {t} = useTranslation();
const { t } = useTranslation();

const handleChange = (event: React.SyntheticEvent, newValue: string) => {
handleChangeContent(newValue);
Expand All @@ -41,7 +36,7 @@ export const MainMenu = ({ value = 'recordings', handleChangeContent }: MainMenu
textTransform: 'none',
color: theme.palette.mode === 'light' ? '#6C6C6C' : 'inherit',
};


return (
<Paper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { IconButton, Menu, MenuItem, Typography, Chip, Button, Modal, Tabs, Tab,
import { AccountCircle, Logout, Clear, YouTube, X, Update, Close, Language, Brightness7, Brightness4, Description } from "@mui/icons-material";
import { useNavigate } from 'react-router-dom';
import { AuthContext } from '../../context/auth';
import { SaveRecording } from '../molecules/SaveRecording';
import DiscordIcon from '../atoms/DiscordIcon';
import { SaveRecording } from '../recorder/SaveRecording';
import DiscordIcon from '../icons/DiscordIcon';
import { apiUrl } from '../../apiConfig';
import MaxunLogo from "../../assets/maxunlogo.png";
import { useThemeMode } from '../../context/theme-provider';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useEffect } from "react";
import { GenericModal } from "../atoms/GenericModal";
import { GenericModal } from "../ui/GenericModal";
import {
MenuItem,
Typography,
Expand Down Expand Up @@ -187,11 +187,11 @@ export const IntegrationSettingsModal = ({
return (
<GenericModal isOpen={isOpen} onClose={handleClose} modalStyle={modalStyle}>
<div style={{
display: "flex",
flexDirection: "column",
alignItems: "flex-start",
marginLeft: "65px",
}}>
display: "flex",
flexDirection: "column",
alignItems: "flex-start",
marginLeft: "65px",
}}>
<Typography variant="h6">
{t('integration_settings.title')}
</Typography>
Expand Down Expand Up @@ -235,8 +235,8 @@ export const IntegrationSettingsModal = ({
<>
{recording.google_sheet_email && (
<Typography sx={{ margin: "20px 0px 30px 0px" }}>
{t('integration_settings.descriptions.authenticated_as', {
email: recording.google_sheet_email
{t('integration_settings.descriptions.authenticated_as', {
email: recording.google_sheet_email
})}
</Typography>
)}
Expand Down
Loading