Compare commits
4 Commits
feature/es
...
116e883e91
| Author | SHA1 | Date | |
|---|---|---|---|
| 116e883e91 | |||
| 9b3a204657 | |||
| 9a490bd993 | |||
| 7ff8a99505 |
5
locales/ru.json
Normal file
5
locales/ru.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"dry-wash.arm.masters.add": "Добавить",
|
||||||
|
"dry-wash.order.status.progress": "Выполняется",
|
||||||
|
"dry-wash.order.status.complete": "Завершено"
|
||||||
|
}
|
||||||
26
package-lock.json
generated
26
package-lock.json
generated
@@ -10,6 +10,7 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@brojs/cli": "^1.3.0",
|
"@brojs/cli": "^1.3.0",
|
||||||
|
"@brojs/i18nextreactconfig": "^1.3.3",
|
||||||
"@chakra-ui/icons": "^2.2.4",
|
"@chakra-ui/icons": "^2.2.4",
|
||||||
"@chakra-ui/react": "^2.4.2",
|
"@chakra-ui/react": "^2.4.2",
|
||||||
"@emotion/react": "^11.4.1",
|
"@emotion/react": "^11.4.1",
|
||||||
@@ -17,6 +18,7 @@
|
|||||||
"@types/react": "^18.3.12",
|
"@types/react": "^18.3.12",
|
||||||
"express": "^4.21.1",
|
"express": "^4.21.1",
|
||||||
"framer-motion": "^6.2.8",
|
"framer-motion": "^6.2.8",
|
||||||
|
"i18next": "^23.16.4",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-dom": "^18.3.1",
|
"react-dom": "^18.3.1",
|
||||||
"react-router-dom": "^6.27.0"
|
"react-router-dom": "^6.27.0"
|
||||||
@@ -1665,6 +1667,14 @@
|
|||||||
"resolved": "https://git.bro-js.ru/api/packages/bro-js/npm/%40brojs%2Ffire.app/-/1.3.0/fire.app-1.3.0.tgz",
|
"resolved": "https://git.bro-js.ru/api/packages/bro-js/npm/%40brojs%2Ffire.app/-/1.3.0/fire.app-1.3.0.tgz",
|
||||||
"integrity": "sha512-4jt/o944FttMUDU5fnGknaa8alz/0FaFATtgc5lVcsJ1Us4TKamHXtx4aj1hw6Pe89aBu61KLy8aCwNE24O0Mg=="
|
"integrity": "sha512-4jt/o944FttMUDU5fnGknaa8alz/0FaFATtgc5lVcsJ1Us4TKamHXtx4aj1hw6Pe89aBu61KLy8aCwNE24O0Mg=="
|
||||||
},
|
},
|
||||||
|
"node_modules/@brojs/i18nextreactconfig": {
|
||||||
|
"version": "1.3.3",
|
||||||
|
"resolved": "https://git.bro-js.ru/api/packages/bro-js/npm/%40brojs%2Fi18nextreactconfig/-/1.3.3/i18nextreactconfig-1.3.3.tgz",
|
||||||
|
"integrity": "sha512-zdSjXTyXUXFjVYl/yHtHYfZBW3Tkawg9d5JbKdKwJOzDBvIA8b1P6yEAzNIwP/LBn4D/bFI2EuQzw1XIJYXjZQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"i18next-xhr-backend": "^3.2.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@brojs/templates": {
|
"node_modules/@brojs/templates": {
|
||||||
"version": "1.3.0",
|
"version": "1.3.0",
|
||||||
"resolved": "https://git.bro-js.ru/api/packages/bro-js/npm/%40brojs%2Ftemplates/-/1.3.0/templates-1.3.0.tgz",
|
"resolved": "https://git.bro-js.ru/api/packages/bro-js/npm/%40brojs%2Ftemplates/-/1.3.0/templates-1.3.0.tgz",
|
||||||
@@ -7003,9 +7013,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/i18next": {
|
"node_modules/i18next": {
|
||||||
"version": "23.16.0",
|
"version": "23.16.4",
|
||||||
"resolved": "https://registry.npmjs.org/i18next/-/i18next-23.16.0.tgz",
|
"resolved": "https://registry.npmjs.org/i18next/-/i18next-23.16.4.tgz",
|
||||||
"integrity": "sha512-Ni3CG6c14teOogY19YNRl+kYaE/Rb59khy0VyHVn4uOZ97E2E/Yziyi6r3C3s9+wacjdLZiq/LLYyx+Cgd+FCw==",
|
"integrity": "sha512-9NIYBVy9cs4wIqzurf7nLXPyf3R78xYbxExVqHLK9od3038rjpyOEzW+XB130kZ1N4PZ9inTtJ471CRJ4Ituyg==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "individual",
|
"type": "individual",
|
||||||
@@ -7020,7 +7030,6 @@
|
|||||||
"url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project"
|
"url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.23.2"
|
"@babel/runtime": "^7.23.2"
|
||||||
}
|
}
|
||||||
@@ -7041,6 +7050,15 @@
|
|||||||
"cross-fetch": "4.0.0"
|
"cross-fetch": "4.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/i18next-xhr-backend": {
|
||||||
|
"version": "3.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/i18next-xhr-backend/-/i18next-xhr-backend-3.2.2.tgz",
|
||||||
|
"integrity": "sha512-OtRf2Vo3IqAxsttQbpjYnmMML12IMB5e0fc5B7qKJFLScitYaXa1OhMX0n0X/3vrfFlpHL9Ro/H+ps4Ej2j7QQ==",
|
||||||
|
"deprecated": "replaced by i18next-http-backend",
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/runtime": "^7.5.5"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/iconv-lite": {
|
"node_modules/iconv-lite": {
|
||||||
"version": "0.4.24",
|
"version": "0.4.24",
|
||||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@brojs/cli": "^1.3.0",
|
"@brojs/cli": "^1.3.0",
|
||||||
|
"@brojs/i18nextreactconfig": "^1.3.3",
|
||||||
"@chakra-ui/icons": "^2.2.4",
|
"@chakra-ui/icons": "^2.2.4",
|
||||||
"@chakra-ui/react": "^2.4.2",
|
"@chakra-ui/react": "^2.4.2",
|
||||||
"@emotion/react": "^11.4.1",
|
"@emotion/react": "^11.4.1",
|
||||||
@@ -25,6 +26,7 @@
|
|||||||
"@types/react": "^18.3.12",
|
"@types/react": "^18.3.12",
|
||||||
"express": "^4.21.1",
|
"express": "^4.21.1",
|
||||||
"framer-motion": "^6.2.8",
|
"framer-motion": "^6.2.8",
|
||||||
|
"i18next": "^23.16.4",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-dom": "^18.3.1",
|
"react-dom": "^18.3.1",
|
||||||
"react-router-dom": "^6.27.0"
|
"react-router-dom": "^6.27.0"
|
||||||
|
|||||||
@@ -3,13 +3,19 @@ import Sidebar from '../Sidebar';
|
|||||||
import Orders from '../Orders';
|
import Orders from '../Orders';
|
||||||
import Masters from '../Masters';
|
import Masters from '../Masters';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { Navigate, Route, Routes } from 'react-router-dom';
|
||||||
|
|
||||||
const LayoutArm = ({ currentPage, onSelectPage }) => (
|
const LayoutArm = () => (
|
||||||
<Flex h='100vh'>
|
<Flex h='100vh'>
|
||||||
<Sidebar onSelectPage={onSelectPage} />
|
<Sidebar />
|
||||||
<Box flex='1' bg='gray.50'>
|
<Box flex='1' bg='gray.50'>
|
||||||
{currentPage === 'orders' && <Orders />}
|
<Routes>
|
||||||
{currentPage === 'masters' && <Masters />}
|
<Route>
|
||||||
|
<Route index element={<Navigate to='orders' replace />} />
|
||||||
|
<Route path='orders' element={<Orders />} />
|
||||||
|
<Route path='masters' element={<Masters />} />
|
||||||
|
</Route>
|
||||||
|
</Routes>
|
||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
import { mastersData } from '../../mocks';
|
import { mastersData } from '../../mocks';
|
||||||
import MasterItem from '../MasterItem';
|
import MasterItem from '../MasterItem';
|
||||||
import MasterDrawer from '../MasterModal';
|
import MasterDrawer from '../MasterModal';
|
||||||
|
import i18next from 'i18next';
|
||||||
|
|
||||||
const TABLE_HEADERS = ['Имя', 'Актуальная занятость', 'Телефон', 'Действия'];
|
const TABLE_HEADERS = ['Имя', 'Актуальная занятость', 'Телефон', 'Действия'];
|
||||||
|
|
||||||
@@ -25,7 +26,7 @@ const Masters = () => {
|
|||||||
<Flex justifyContent='space-between' alignItems='center' mb='5'>
|
<Flex justifyContent='space-between' alignItems='center' mb='5'>
|
||||||
<Heading size='lg'>Мастера</Heading>
|
<Heading size='lg'>Мастера</Heading>
|
||||||
<Button colorScheme='green' onClick={onOpen}>
|
<Button colorScheme='green' onClick={onOpen}>
|
||||||
+ Добавить
|
+ {i18next.t('dry-wash.arm.masters.add')}
|
||||||
</Button>
|
</Button>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Table variant='simple' colorScheme='blackAlpha'>
|
<Table variant='simple' colorScheme='blackAlpha'>
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { Td, Tr, Link, Select } from '@chakra-ui/react';
|
import { Td, Tr, Link, Select } from '@chakra-ui/react';
|
||||||
|
import i18next from 'i18next';
|
||||||
|
|
||||||
|
const statuses = ['pending', 'progress', 'working', 'canceled', 'complete'];
|
||||||
|
|
||||||
const OrderItem = ({
|
const OrderItem = ({
|
||||||
carNumber,
|
carNumber,
|
||||||
@@ -22,11 +25,11 @@ const OrderItem = ({
|
|||||||
onChange={(e) => setStatus(e.target.value)}
|
onChange={(e) => setStatus(e.target.value)}
|
||||||
placeholder='Выберите статус'
|
placeholder='Выберите статус'
|
||||||
>
|
>
|
||||||
<option value='в ожидании'>в ожидании</option>
|
{statuses.map((status) => (
|
||||||
<option value='В процессе'>в процессе</option>
|
<option key={status} value={status}>
|
||||||
<option value='в работе'>в работе</option>
|
{i18next.t(`dry-wash.order.status.${status}`)}
|
||||||
<option value='отменил'>отменил</option>
|
</option>
|
||||||
<option value='Завершено'>Завершено</option>
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
</Td>
|
</Td>
|
||||||
<Td>
|
<Td>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { Box, Button, Heading, VStack } from '@chakra-ui/react';
|
import { Box, Button, Heading, VStack } from '@chakra-ui/react';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Divider } from '@chakra-ui/react';
|
import { Divider } from '@chakra-ui/react';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
const Sidebar = ({ onSelectPage }) => (
|
const Sidebar = () => (
|
||||||
<Box
|
<Box
|
||||||
borderRight='1px solid black'
|
borderRight='1px solid black'
|
||||||
bg='gray.50'
|
bg='gray.50'
|
||||||
@@ -17,23 +17,17 @@ const Sidebar = ({ onSelectPage }) => (
|
|||||||
|
|
||||||
<VStack align='start' spacing='4'>
|
<VStack align='start' spacing='4'>
|
||||||
<Divider />
|
<Divider />
|
||||||
<Button
|
<Link to='orders'>
|
||||||
onClick={() => onSelectPage('orders')}
|
<Button w='100%' colorScheme='green' variant='ghost'>
|
||||||
w='100%'
|
|
||||||
colorScheme='green'
|
|
||||||
variant='ghost'
|
|
||||||
>
|
|
||||||
Заказы
|
Заказы
|
||||||
</Button>
|
</Button>
|
||||||
|
</Link>
|
||||||
<Divider />
|
<Divider />
|
||||||
<Button
|
<Link to='masters'>
|
||||||
onClick={() => onSelectPage('masters')}
|
<Button w='100%' colorScheme='green' variant='ghost'>
|
||||||
w='100%'
|
|
||||||
colorScheme='green'
|
|
||||||
variant='ghost'
|
|
||||||
>
|
|
||||||
Мастера
|
Мастера
|
||||||
</Button>
|
</Button>
|
||||||
|
</Link>
|
||||||
<Divider />
|
<Divider />
|
||||||
</VStack>
|
</VStack>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -1,19 +1,26 @@
|
|||||||
|
|
||||||
/* eslint-disable react/display-name */
|
/* eslint-disable react/display-name */
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactDOM from 'react-dom/client';
|
import ReactDOM from 'react-dom/client';
|
||||||
|
import { i18nextReactInitConfig } from '@brojs/i18nextreactconfig';
|
||||||
import App from './app';
|
import App from './app';
|
||||||
|
import i18next from 'i18next';
|
||||||
|
|
||||||
|
i18next.t = i18next.t.bind(i18next);
|
||||||
|
const i18nextPromise = i18nextReactInitConfig(i18next);
|
||||||
export default () => <App />;
|
export default () => <App />;
|
||||||
|
|
||||||
let rootElement: ReactDOM.Root;
|
let rootElement: ReactDOM.Root;
|
||||||
|
|
||||||
export const mount = (Component, element = document.getElementById('app')) => {
|
export const mount = async (
|
||||||
|
Component,
|
||||||
|
element = document.getElementById('app'),
|
||||||
|
) => {
|
||||||
const rootElement = ReactDOM.createRoot(element);
|
const rootElement = ReactDOM.createRoot(element);
|
||||||
|
await i18nextPromise;
|
||||||
rootElement.render(<Component />);
|
rootElement.render(<Component />);
|
||||||
if (module.hot) {
|
if (module.hot) {
|
||||||
module.hot.accept('./app', () => {
|
module.hot.accept('./app', async () => {
|
||||||
|
await i18next.reloadResources();
|
||||||
rootElement.render(<Component />);
|
rootElement.render(<Component />);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ import React, { useState } from 'react';
|
|||||||
import LayoutArm from '../../components/LayoutArm';
|
import LayoutArm from '../../components/LayoutArm';
|
||||||
|
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
const [currentPage, setCurrentPage] = useState('orders');
|
return <LayoutArm />;
|
||||||
|
|
||||||
return <LayoutArm currentPage={currentPage} onSelectPage={setCurrentPage} />;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const Routers = () => {
|
|||||||
<Routes>
|
<Routes>
|
||||||
<Route path='/dry-wash' element={<Landing />}></Route>
|
<Route path='/dry-wash' element={<Landing />}></Route>
|
||||||
<Route path='/dry-wash/order' element={<Order />}></Route>
|
<Route path='/dry-wash/order' element={<Order />}></Route>
|
||||||
<Route path='/dry-wash/arm' element={<Arm />}></Route>
|
<Route path='/dry-wash/arm/*' element={<Arm />}></Route>
|
||||||
</Routes>
|
</Routes>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user