mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
replace React bunder based on webpack with Vite #952
This commit is contained in:
@@ -2,7 +2,7 @@ import { FC } from 'react';
|
||||
|
||||
import { Paper, Divider } from '@mui/material';
|
||||
|
||||
import { RequiredChildrenProps } from '../utils';
|
||||
import { RequiredChildrenProps } from 'utils';
|
||||
|
||||
interface SectionContentProps extends RequiredChildrenProps {
|
||||
title: string;
|
||||
|
||||
@@ -3,8 +3,8 @@ import { useLocation } from 'react-router-dom';
|
||||
|
||||
import { Box, Toolbar } from '@mui/material';
|
||||
|
||||
import { PROJECT_NAME } from '../../api/env';
|
||||
import { RequiredChildrenProps } from '../../utils';
|
||||
import { PROJECT_NAME } from 'api/env';
|
||||
import { RequiredChildrenProps } from 'utils';
|
||||
|
||||
import LayoutDrawer from './LayoutDrawer';
|
||||
import LayoutAppBar from './LayoutAppBar';
|
||||
|
||||
@@ -17,19 +17,19 @@ import {
|
||||
import PersonIcon from '@mui/icons-material/Person';
|
||||
import AccountCircleIcon from '@mui/icons-material/AccountCircle';
|
||||
|
||||
import { AuthenticatedContext } from '../../contexts/authentication';
|
||||
import { AuthenticatedContext } from 'contexts/authentication';
|
||||
|
||||
import { I18nContext } from '../../i18n/i18n-react';
|
||||
import type { Locales } from '../../i18n/i18n-types';
|
||||
import { loadLocaleAsync } from '../../i18n/i18n-util.async';
|
||||
import { I18nContext } from 'i18n/i18n-react';
|
||||
import type { Locales } from 'i18n/i18n-types';
|
||||
import { loadLocaleAsync } from 'i18n/i18n-util.async';
|
||||
|
||||
import { ReactComponent as NLflag } from '../../i18n/NL.svg';
|
||||
import { ReactComponent as DEflag } from '../../i18n/DE.svg';
|
||||
import { ReactComponent as GBflag } from '../../i18n/GB.svg';
|
||||
import { ReactComponent as SVflag } from '../../i18n/SV.svg';
|
||||
import { ReactComponent as PLflag } from '../../i18n/PL.svg';
|
||||
import { ReactComponent as NOflag } from '../../i18n/NO.svg';
|
||||
import { ReactComponent as FRflag } from '../../i18n/FR.svg';
|
||||
import { ReactComponent as NLflag } from 'i18n/NL.svg';
|
||||
import { ReactComponent as DEflag } from 'i18n/DE.svg';
|
||||
import { ReactComponent as GBflag } from 'i18n/GB.svg';
|
||||
import { ReactComponent as SVflag } from 'i18n/SV.svg';
|
||||
import { ReactComponent as PLflag } from 'i18n/PL.svg';
|
||||
import { ReactComponent as NOflag } from 'i18n/NO.svg';
|
||||
import { ReactComponent as FRflag } from 'i18n/FR.svg';
|
||||
|
||||
const ItemTypography = styled(Typography)<TypographyProps>({
|
||||
maxWidth: '250px',
|
||||
|
||||
@@ -2,7 +2,7 @@ import { FC } from 'react';
|
||||
|
||||
import { Box, Divider, Drawer, Toolbar, Typography, styled } from '@mui/material';
|
||||
|
||||
import { PROJECT_NAME } from '../../api/env';
|
||||
import { PROJECT_NAME } from 'api/env';
|
||||
|
||||
import LayoutMenu from './LayoutMenu';
|
||||
import { DRAWER_WIDTH } from './Layout';
|
||||
|
||||
@@ -9,12 +9,12 @@ import SettingsIcon from '@mui/icons-material/Settings';
|
||||
import LockIcon from '@mui/icons-material/Lock';
|
||||
import SettingsEthernetIcon from '@mui/icons-material/SettingsEthernet';
|
||||
|
||||
import ProjectMenu from '../../project/ProjectMenu';
|
||||
import ProjectMenu from 'project/ProjectMenu';
|
||||
|
||||
import LayoutMenuItem from './LayoutMenuItem';
|
||||
import { AuthenticatedContext } from '../../contexts/authentication';
|
||||
import { AuthenticatedContext } from 'contexts/authentication';
|
||||
|
||||
import { useI18nContext } from '../../i18n/i18n-react';
|
||||
import { useI18nContext } from 'i18n/i18n-react';
|
||||
|
||||
const LayoutMenu: FC = () => {
|
||||
const authenticatedContext = useContext(AuthenticatedContext);
|
||||
|
||||
@@ -5,7 +5,7 @@ import { ListItem, ListItemButton, ListItemIcon, ListItemText, SvgIconProps } fr
|
||||
|
||||
import { grey } from '@mui/material/colors';
|
||||
|
||||
import { routeMatches } from '../../utils';
|
||||
import { routeMatches } from 'utils';
|
||||
|
||||
interface LayoutMenuItemProps {
|
||||
icon: React.ComponentType<SvgIconProps>;
|
||||
|
||||
@@ -3,9 +3,9 @@ import { FC } from 'react';
|
||||
import { Box, Button, CircularProgress, Typography } from '@mui/material';
|
||||
import RefreshIcon from '@mui/icons-material/Refresh';
|
||||
|
||||
import { MessageBox } from '..';
|
||||
import { MessageBox } from 'components';
|
||||
|
||||
import { useI18nContext } from '../../i18n/i18n-react';
|
||||
import { useI18nContext } from 'i18n/i18n-react';
|
||||
|
||||
interface FormLoaderProps {
|
||||
message?: string;
|
||||
|
||||
@@ -2,7 +2,7 @@ import { FC } from 'react';
|
||||
|
||||
import { CircularProgress, Box, Typography, Theme } from '@mui/material';
|
||||
|
||||
import { useI18nContext } from '../../i18n/i18n-react';
|
||||
import { useI18nContext } from 'i18n/i18n-react';
|
||||
|
||||
interface LoadingSpinnerProps {
|
||||
height?: number | string;
|
||||
|
||||
@@ -2,7 +2,7 @@ import { FC } from 'react';
|
||||
import type { Blocker } from '@remix-run/router';
|
||||
import { Button, Dialog, DialogActions, DialogContent, DialogTitle } from '@mui/material';
|
||||
|
||||
import { useI18nContext } from '../../i18n/i18n-react';
|
||||
import { useI18nContext } from 'i18n/i18n-react';
|
||||
|
||||
interface BlockNavigationProps {
|
||||
blocker: Blocker;
|
||||
@@ -19,7 +19,7 @@ const BlockNavigation: FC<BlockNavigationProps> = ({ blocker }) => {
|
||||
<Button variant="outlined" onClick={() => blocker.reset?.()} color="secondary">
|
||||
{LL.STAY()}
|
||||
</Button>
|
||||
<Button variant="contained" onClick={() => blocker.proceed?.()} color="primary" autoFocus>
|
||||
<Button variant="contained" onClick={() => blocker.proceed?.()} color="primary">
|
||||
{LL.LEAVE()}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { FC, useContext } from 'react';
|
||||
import { Navigate } from 'react-router-dom';
|
||||
|
||||
import { AuthenticatedContext } from '../../contexts/authentication';
|
||||
import { RequiredChildrenProps } from '../../utils';
|
||||
import { AuthenticatedContext } from 'contexts/authentication';
|
||||
import { RequiredChildrenProps } from 'utils';
|
||||
|
||||
const RequireAdmin: FC<RequiredChildrenProps> = ({ children }) => {
|
||||
const authenticatedContext = useContext(AuthenticatedContext);
|
||||
|
||||
@@ -5,10 +5,10 @@ import {
|
||||
AuthenticatedContext,
|
||||
AuthenticatedContextValue,
|
||||
AuthenticationContext
|
||||
} from '../../contexts/authentication/context';
|
||||
import { storeLoginRedirect } from '../../api/authentication';
|
||||
} from 'contexts/authentication/context';
|
||||
import { storeLoginRedirect } from 'api/authentication';
|
||||
|
||||
import { RequiredChildrenProps } from '../../utils';
|
||||
import { RequiredChildrenProps } from 'utils';
|
||||
|
||||
const RequireAuthenticated: FC<RequiredChildrenProps> = ({ children }) => {
|
||||
const authenticationContext = useContext(AuthenticationContext);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { FC, useContext } from 'react';
|
||||
import { Navigate } from 'react-router-dom';
|
||||
|
||||
import * as AuthenticationApi from '../../api/authentication';
|
||||
import { AuthenticationContext } from '../../contexts/authentication';
|
||||
import { RequiredChildrenProps } from '../../utils';
|
||||
import * as AuthenticationApi from 'api/authentication';
|
||||
import { AuthenticationContext } from 'contexts/authentication';
|
||||
import { RequiredChildrenProps } from 'utils';
|
||||
|
||||
const RequireUnauthenticated: FC<RequiredChildrenProps> = ({ children }) => {
|
||||
const authenticationContext = useContext(AuthenticationContext);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useNavigate } from 'react-router-dom';
|
||||
|
||||
import { Tabs, useMediaQuery, useTheme } from '@mui/material';
|
||||
|
||||
import { RequiredChildrenProps } from '../../utils';
|
||||
import { RequiredChildrenProps } from 'utils';
|
||||
|
||||
interface RouterTabsProps extends RequiredChildrenProps {
|
||||
value: string | false;
|
||||
@@ -15,6 +15,7 @@ const RouterTabs: FC<RouterTabsProps> = ({ value, children }) => {
|
||||
const theme = useTheme();
|
||||
const smallDown = useMediaQuery(theme.breakpoints.down('sm'));
|
||||
|
||||
// TODO fix this
|
||||
const handleTabChange = (event: React.ChangeEvent<{}>, path: string) => {
|
||||
navigate(path);
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Box, Button, LinearProgress, Theme, Typography, useTheme } from '@mui/m
|
||||
import CloudUploadIcon from '@mui/icons-material/CloudUpload';
|
||||
import CancelIcon from '@mui/icons-material/Cancel';
|
||||
|
||||
import { useI18nContext } from '../../i18n/i18n-react';
|
||||
import { useI18nContext } from 'i18n/i18n-react';
|
||||
|
||||
const getBorderColor = (theme: Theme, props: DropzoneState) => {
|
||||
if (props.isDragAccept) {
|
||||
|
||||
@@ -2,10 +2,10 @@ import { useCallback, useEffect, useState } from 'react';
|
||||
import axios, { AxiosPromise, CancelTokenSource, AxiosProgressEvent } from 'axios';
|
||||
import { useSnackbar } from 'notistack';
|
||||
|
||||
import { extractErrorMessage } from '../../utils';
|
||||
import { FileUploadConfig } from '../../api/endpoints';
|
||||
import { extractErrorMessage } from 'utils';
|
||||
import { FileUploadConfig } from 'api/endpoints';
|
||||
|
||||
import { useI18nContext } from '../../i18n/i18n-react';
|
||||
import { useI18nContext } from 'i18n/i18n-react';
|
||||
|
||||
interface MediaUploadOptions {
|
||||
upload: (file: File, config?: FileUploadConfig) => AxiosPromise<void>;
|
||||
|
||||
Reference in New Issue
Block a user