Compare commits

..

No commits in common. "5822f5f7b08451585497352c1b4a664ebea21ea5" and "e72736e69286cd0b5c4e8cd93b6bc183caf017d8" have entirely different histories.

12 changed files with 16 additions and 162 deletions

View File

@ -43,11 +43,5 @@
"dry-wash.landing.hero-section.headline": "Оживите свою поездку с помощью экологически чистого ухода!",
"dry-wash.landing.make-order-button": "Сделать заказ",
"dry-wash.landing.site-logo": "Логотип компании \u00ABDry Master\u00BB",
"dry-wash.landing.social-proof-section.heading": "Нас выбирают",
"dry-wash.notFound.title": "Страница не найдена",
"dry-wash.notFound.description": "К сожалению, запрашиваемая вами страница не существует.",
"dry-wash.notFound.button.back": " Вернуться на главную",
"dry-wash.errorBoundary.title":"Что-то пошло не так",
"dry-wash.errorBoundary.description": " Мы уже работаем над исправлением проблемы",
"dry-wash.errorBoundary.button.reload": "Перезагрузить страницу"
}
"dry-wash.landing.social-proof-section.heading": "Нас выбирают"
}

17
package-lock.json generated
View File

@ -15,7 +15,6 @@
"@emotion/react": "^11.4.1",
"@emotion/styled": "^11.3.0",
"@fontsource/open-sans": "^5.1.0",
"@lottiefiles/react-lottie-player": "^3.5.4",
"@types/react": "^18.3.12",
"express": "^4.21.1",
"framer-motion": "^6.2.8",
@ -3450,17 +3449,6 @@
"tslib": "2"
}
},
"node_modules/@lottiefiles/react-lottie-player": {
"version": "3.5.4",
"resolved": "https://registry.npmjs.org/@lottiefiles/react-lottie-player/-/react-lottie-player-3.5.4.tgz",
"integrity": "sha512-2FptWtHQ+o7MzdsMKSvNZ1Mz7xtKSYI0WL9HjZ1r+CvsXR3lbLQUDp7Pwx6qhg0Akm4VluQ+8/D1S1fcr1Ao4w==",
"dependencies": {
"lottie-web": "^5.12.2"
},
"peerDependencies": {
"react": "16 - 18"
}
},
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@ -7820,11 +7808,6 @@
"loose-envify": "cli.js"
}
},
"node_modules/lottie-web": {
"version": "5.12.2",
"resolved": "https://registry.npmjs.org/lottie-web/-/lottie-web-5.12.2.tgz",
"integrity": "sha512-uvhvYPC8kGPjXT3MyKMrL3JitEAmDMp30lVkuq/590Mw9ok6pWcFCwXJveo0t5uqYw1UREQHofD+jVpdjBv8wg=="
},
"node_modules/lru-cache": {
"version": "10.4.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",

View File

@ -23,7 +23,6 @@
"@emotion/react": "^11.4.1",
"@emotion/styled": "^11.3.0",
"@fontsource/open-sans": "^5.1.0",
"@lottiefiles/react-lottie-player": "^3.5.4",
"@types/react": "^18.3.12",
"express": "^4.21.1",
"framer-motion": "^6.2.8",

View File

@ -2,16 +2,13 @@ import React from 'react';
import { BrowserRouter } from 'react-router-dom';
import Routers from './routes';
import { ChakraProvider, theme as chakraTheme } from '@chakra-ui/react';
import ErrorBoundary from './components/ErrorBoundary';
const App = () => {
return (
<ChakraProvider theme={chakraTheme}>
<ErrorBoundary>
<BrowserRouter>
<Routers />
</BrowserRouter>
</ErrorBoundary>
<BrowserRouter>
<Routers></Routers>
</BrowserRouter>
</ChakraProvider>
);
};

File diff suppressed because one or more lines are too long

View File

@ -1,64 +0,0 @@
import React, { Component, ErrorInfo, ReactNode } from 'react';
import { Heading, Text, Button, Center, VStack } from '@chakra-ui/react';
import i18next from 'i18next';
interface ErrorBoundaryState {
hasError: boolean;
error: Error | null;
errorInfo: ErrorInfo | null;
}
interface ErrorBoundaryProps {
children: ReactNode;
}
class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
constructor(props: ErrorBoundaryProps) {
super(props);
this.state = {
hasError: false,
error: null,
errorInfo: null,
};
}
static getDerivedStateFromError(): Partial<ErrorBoundaryState> {
return { hasError: true };
}
componentDidCatch(error: Error, errorInfo: ErrorInfo): void {
console.error('Error caught by ErrorBoundary:', error, errorInfo);
this.setState({ error, errorInfo });
}
render() {
const { hasError } = this.state;
//TODO: добавить анимацию после залива 404 страницы
if (hasError) {
return (
<Center minH='100vh'>
<VStack spacing={4} textAlign='center'>
<Heading as='h1' size='2xl'>
{i18next.t('dry-wash.errorBoundary.title')}
</Heading>
<Text fontSize='lg'>
{i18next.t('dry-wash.errorBoundary.description')}
</Text>
<Button
colorScheme='teal'
size='lg'
variant='outline'
onClick={() => window.location.reload()}
>
{i18next.t('dry-wash.errorBoundary.button.reload')}
</Button>
</VStack>
</Center>
);
}
return this.props.children;
}
}
export default ErrorBoundary;

View File

@ -1 +0,0 @@
export { default } from './ErrorBoundary';

View File

@ -3,19 +3,13 @@ import Sidebar from '../Sidebar';
import Orders from '../Orders';
import Masters from '../Masters';
import React from 'react';
import { Navigate, Route, Routes } from 'react-router-dom';
const LayoutArm = () => (
const LayoutArm = ({ currentPage, onSelectPage }) => (
<Flex h='100vh'>
<Sidebar />
<Sidebar onSelectPage={onSelectPage} />
<Box flex='1' bg='gray.50'>
<Routes>
<Route>
<Route index element={<Navigate to='orders' replace />} />
<Route path='orders' element={<Orders />} />
<Route path='masters' element={<Masters />} />
</Route>
</Routes>
{currentPage === 'orders' && <Orders />}
{currentPage === 'masters' && <Masters />}
</Box>
</Flex>
);

View File

@ -2,9 +2,7 @@ import { Box, Button, Heading, VStack } from '@chakra-ui/react';
import React from 'react';
import { Divider } from '@chakra-ui/react';
import i18next from 'i18next';
import { Link } from 'react-router-dom';
const Sidebar = () => (
const Sidebar = ({ onSelectPage }) => (
<Box
borderRight='1px solid black'
bg='gray.50'
@ -20,8 +18,7 @@ const Sidebar = () => (
<VStack align='start' spacing='4'>
<Divider />
<Button
as={Link}
to='orders'
onClick={() => onSelectPage('orders')}
w='100%'
colorScheme='green'
variant='ghost'
@ -30,8 +27,7 @@ const Sidebar = () => (
</Button>
<Divider />
<Button
as={Link}
to='masters'
onClick={() => onSelectPage('masters')}
w='100%'
colorScheme='green'
variant='ghost'

View File

@ -2,7 +2,9 @@ import React, { useState } from 'react';
import LayoutArm from '../../components/LayoutArm';
const Page = () => {
return <LayoutArm />;
const [currentPage, setCurrentPage] = useState('orders');
return <LayoutArm currentPage={currentPage} onSelectPage={setCurrentPage} />;
};
export default Page;

View File

@ -1,43 +0,0 @@
import React from 'react';
import { Text, Button, Center, VStack, Heading } from '@chakra-ui/react';
import { Link } from 'react-router-dom';
import { Player } from '@lottiefiles/react-lottie-player';
import animate from '../../assets/animation/notFound.json';
import i18next from 'i18next';
const NotFound = () => {
return (
<Center minH='100vh'>
<VStack spacing={4} textAlign='center'>
<Player
autoplay
loop
src={animate}
style={{
height: '100%',
width: '100%',
maxHeight: '450px',
maxWidth: '450px',
}}
/>
<Heading fontSize='xl'>
{i18next.t(`dry-wash.arm.notFound.title`)}
</Heading>
<Text fontSize='lg'>
{i18next.t(`dry-wash.arm.notFound.description`)}
</Text>
<Button
as={Link}
to='/dry-wash'
colorScheme='teal'
size='lg'
variant='outline'
>
{i18next.t(`dry-wash.arm.notFound.button.back`)}
</Button>
</VStack>
</Center>
);
};
export default NotFound;

View File

@ -3,7 +3,6 @@ import { Routes, Route } from 'react-router-dom';
import { PageSpinner } from './components';
import Arm from './pages/arm';
import { URLs } from './__data__/urls';
import NotFound from './pages/notFound/notFound';
const Landing = lazy(() => import('./pages/landing'));
const OrderForm = lazy(() => import('./pages/order-form'));
@ -16,8 +15,7 @@ const Routers = () => {
<Route path={URLs.landing.url} element={<Landing />} />
<Route path={URLs.orderForm.url} element={<OrderForm />} />
<Route path={URLs.orderView.url} element={<OrderView />} />
<Route path='/dry-wash/arm/*' element={<Arm />}></Route>
<Route path='*' element={<NotFound />} />
<Route path='/dry-wash/arm' element={<Arm />}></Route>
</Routes>
</Suspense>
);