Skip to content

Commit

Permalink
Merge pull request #45 from reedoooo/clean/styledAndCustomComponents
Browse files Browse the repository at this point in the history
simpliofying
  • Loading branch information
reedoooo authored May 4, 2024
2 parents bd399d1 + 0ab6641 commit d2bb963
Show file tree
Hide file tree
Showing 103 changed files with 1,406 additions and 1,501 deletions.
32 changes: 6 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
"@floating-ui/react": "^0.26.9",
Expand All @@ -19,56 +18,35 @@
"@mui/x-data-grid": "^6.16.2",
"@mui/x-date-pickers": "^6.10.1",
"@nivo/line": "^0.83.0",
"@nivo/pie": "^0.84.0",
"@stripe/react-stripe-js": "^2.1.1",
"@stripe/stripe-js": "^1.54.2",
"auth0-js": "^9.22.1",
"axios": "^1.4.0",
"chroma-js": "^2.4.2",
"date-fns": "^2.30.0",
"dayjs": "^1.11.9",
"downshift": "^9.0.1",
"image-downloader": "^4.3.0",
"jwt-decode": "^3.1.2",
"lodash": "^4.17.21",
"lodash.set": "^4.3.2",
"logrocket": "^8.1.0",
"material-ui-image": "^3.3.2",
"mathjs": "^12.4.1",
"moment": "^2.29.4",
"nanoid": "^5.0.7",
"notistack": "^3.0.1",
"pino": "^8.20.0",
"polished": "^4.3.1",
"react": "^17.0.0 || ^18.0.0",
"react": "^18.3.1",
"react-cookie": "^4.1.1",
"react-device-detect": "^2.2.3",
"react-dom": "^17.0.0 || ^18.0.0",
"react-dom": "^18.3.1",
"react-error-boundary": "^4.0.13",
"react-helmet": "^6.1.0",
"react-helmet-async": "^2.0.4",
"react-hook-form": "^7.50.0",
"react-icons": "^4.10.1",
"react-if": "^4.1.5",
"react-material-ui-carousel": "^3.4.2",
"react-perfect-scrollbar": "^1.5.8",
"react-pro-sidebar": "^1.1.0-alpha.1",
"react-responsive-carousel": "^3.2.23",
"react-router-dom": "^6.17.0",
"react-scale-text": "^1.2.2",
"react-scripts": "5.0.1",
"react-scroll-parallax": "^3.4.5",
"react-slick": "^0.29.0",
"react-spinners": "^0.13.8",
"react-spring": "^9.7.3",
"react-stripe-checkout": "^2.6.3",
"react-swipeable-views": "^0.14.0",
"react-table": "^7.8.0",
"react-transition-group": "^4.4.5",
"react-virtualized": "^9.22.5",
"recharts": "^2.12.3",
"sass": "^1.69.7",
"shortid": "^2.2.16",
"slick-carousel": "^1.8.1",
"stripe": "^12.14.0",
"styled-components": "^6.1.8",
"swiper": "^11.0.6",
Expand Down Expand Up @@ -101,11 +79,13 @@
]
},
"devDependencies": {
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"eslint": "^8.46.0",
"eslint-config-prettier": "^8.9.0",
"eslint-plugin-prettier": "^5.0.0",
"http-proxy-middleware": "^2.0.6",
"prettier": "^3.0.0"
"prettier": "^3.0.0",
"react-scripts": "5.0.1"
}
}
112 changes: 69 additions & 43 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,64 +1,90 @@
// App.js
import React, { Suspense, lazy } from 'react';
import React, { Suspense, lazy, useEffect } from 'react';
import { Route, Routes, useNavigate } from 'react-router-dom';

import './assets/css/index.css';
import './assets/css/card.css';
import './assets/css/page.css';
import useManageCookies from 'context/hooks/useManageCookies';
import useConfigurator from 'context/hooks/useConfigurator';
import PageLayout from 'layout/REUSABLE_COMPONENTS/utils/layout-utils/PageLayout';
import Navigation from 'layout/navigation';
import Configurator from 'layout/REUSABLE_COMPONENTS/Configurator';
import { CSSTransition, TransitionGroup } from 'react-transition-group';
import LoadingOverlay from 'layout/REUSABLE_COMPONENTS/utils/system-utils/LoadingOverlay';
import { Route, Routes } from 'react-router-dom';
import PrivateRoute from 'layout/navigation/PrivateRoute';
import LoginDialog from 'pages/LoginDialog';
import LoginDialog from 'layout/dialogs/LoginDialog';
import Navigation from 'layout/navigation';
import { ROUTE_CONFIG } from 'data';
import {
Configurator,
LoadingOverlay,
PageLayout,
} from 'layout/REUSABLE_COMPONENTS';
import {
useUserData,
useConfigurator,
useManageCookies,
useMode,
} from 'context';
import { ThemeProvider } from 'styled-components';
import { CssBaseline } from '@mui/material';

// ==============================|| APP ||============================== //

const PrivateRoute = ({ children }) => {
const { user } = useUserData();
const navigate = useNavigate();
useEffect(() => {
if (user === null) {
navigate('/login', { replace: true });
}
}, [navigate, user]);

return children;
};

const LazyRoute = ({ componentName, ...rest }) => {
const Component = lazy(() => import(`./pages/${componentName}`));
return <Component {...rest} />;
};
const App = () => {
const { getCookie } = useManageCookies();
const { theme } = useMode();
const { isLoggedIn } = getCookie(['isLoggedIn']);
const { isConfiguratorOpen } = useConfigurator();
return (
<PageLayout
sx={{
backgroundColor: '#3D3D3D',
}}
>
<Navigation isLoggedIn={isLoggedIn} />
{isConfiguratorOpen && <Configurator />}
<TransitionGroup component={null} exit={false}>
<CSSTransition key={location.key} classNames="fade" timeout={300}>
<Suspense fallback={<LoadingOverlay />}>
<Routes>
{ROUTE_CONFIG.routes.map(
({ path, componentName, isPrivate }, index) => (
<Route
key={index}
path={path}
element={
isPrivate ? (
<PrivateRoute>
<ThemeProvider theme={theme}>
<CssBaseline theme={theme} />
{/* <GlobalStyles /> */}
<PageLayout
sx={{
backgroundColor: '#3D3D3D',
}}
>
<Navigation isLoggedIn={isLoggedIn} />
{isConfiguratorOpen && <Configurator />}
<TransitionGroup component={null} exit={false}>
<CSSTransition key={location.key} classNames="fade" timeout={300}>
<Suspense fallback={<LoadingOverlay />}>
<Routes>
{ROUTE_CONFIG.routes.map(
({ path, componentName, isPrivate }, index) => (
<Route
key={index}
path={path}
element={
isPrivate ? (
<PrivateRoute>
<LazyRoute componentName={componentName} />
</PrivateRoute>
) : (
<LazyRoute componentName={componentName} />
</PrivateRoute>
) : (
<LazyRoute componentName={componentName} />
)
}
/>
)
)}
</Routes>
</Suspense>
</CSSTransition>
</TransitionGroup>
<LoginDialog />
</PageLayout>
)
}
/>
)
)}
</Routes>
</Suspense>
</CSSTransition>
</TransitionGroup>
<LoginDialog />
</PageLayout>
</ThemeProvider>
);
};

Expand Down
69 changes: 69 additions & 0 deletions src/assets/themeSettings.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import {
boxShadow,
hexToRgba,
hexToRgb,
linearGradient,
pxToRem,
rgba,
} from './themes';
import {
breakpoints,
colors,
borders,
boxShadows,
typography,
palette,
} from './themes';
import { Transitions } from './themes';
import components from './themes/components';

export const themeSettings = (mode) => {
return {
functions: {
boxShadow,
hexToRgb,
hexToRgba,
linearGradient,
pxToRem,
rgba,
},
palette: {
...colors,
mode: mode,
},
newPalette: {
...palette,
mode: mode,
},
components: {
...components,
},
breakpoints: breakpoints.values,
Transitions: Transitions,
borders: borders,
boxShadows: boxShadows,
typography: typography,
spacing: (factor) => `${0.25 * factor}rem`,
zIndex: {
appBar: 1200,
drawer: 1100,
},
// components: {
// MuiCssBaseline: components.MuiCssBaseline,
// MuiDivider: components.MuiDivider,
// MuiTableContainer: components.MuiTableContainer,
// MuiTableCell: components.MuiTableCell,
// MuiTableHead: components.MuiTableHead,
// MuiButton: components.MuiButton,
// MuiInput: components.MuiInput,
// MuiInputLabel: components.MuiInputLabel,
// MuiSlider: components.MuiSlider,
// MuiSwitch: components.MuiSwitch,
// MuiCard: components.MuiCard,
// MuiCardMedia: components.MuiCardMedia,
// MuiCardContent: components.MuiCardContent,
// MuiTabs: components.MuiTabs,
// MuiTab: components.MuiTab,
// },
};
};
38 changes: 0 additions & 38 deletions src/assets/themes/GlobalStyles.js

This file was deleted.

38 changes: 38 additions & 0 deletions src/assets/themes/base/cleanup/GlobalStyles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// import { GlobalStyles } from '@mui/material';

// const MyGlobalStyles = () => (
// <GlobalStyles
// styles={{
// html: {
// height: '100%',
// fontSize: '16px', // default font-size
// maxWidth: '100vw',
// fontFamily: '"Roboto", sans-serif', // default font
// color: '#333', // default text color
// },
// body: {
// backgroundColor: '#f4f4f4', // a light grey background
// margin: '0', // remove default margin
// padding: '0', // remove default padding
// maxWidth: '100vw',
// boxSizing: 'border-box', // box model handling
// },
// '*': {
// boxSizing: 'inherit', // every element to inherit boxSizing
// },
// a: {
// textDecoration: 'none', // remove underline from all links
// color: 'inherit', // links will inherit their parent color
// },
// '*::-webkit-scrollbar-track': {
// backgroundColor: 'gray.200',
// },
// '*::-webkit-scrollbar-thumb': {
// backgroundColor: 'gray.500',
// borderRadius: '20px',
// },
// }}
// />
// );

// export default MyGlobalStyles;
Loading

0 comments on commit d2bb963

Please sign in to comment.