feat: add stub success(#37)
Some checks failed
it-academy/dry-wash-pl/pipeline/head There was a failure building this commit
it-academy/dry-wash-pl/pipeline/pr-main There was a failure building this commit

This commit is contained in:
Ильназ 2024-11-23 15:56:40 +03:00
parent 0b30ce6571
commit e374cbfdd3
5 changed files with 53 additions and 40 deletions

View File

@ -13,9 +13,9 @@ import {
} from '@chakra-ui/react'; } from '@chakra-ui/react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { mastersData } from '../../mocks';
import MasterItem from '../MasterItem'; import MasterItem from '../MasterItem';
import MasterDrawer from '../MasterDrawer'; import MasterDrawer from '../MasterDrawer';
import data from '../../../stubs/json/arm-masters/success.json';
const TABLE_HEADERS = [ const TABLE_HEADERS = [
'name' as const, 'name' as const,
@ -48,7 +48,7 @@ const Masters = () => {
</Tr> </Tr>
</Thead> </Thead>
<Tbody> <Tbody>
{mastersData.map((master, index) => ( {data.body.map((master, index) => (
<MasterItem key={index} {...master} /> <MasterItem key={index} {...master} />
))} ))}
</Tbody> </Tbody>

View File

@ -1,10 +1,9 @@
import React from 'react'; import React from 'react';
import { Box, Heading, Table, Thead, Tbody, Tr, Th } from '@chakra-ui/react'; import { Box, Heading, Table, Thead, Tbody, Tr, Th } from '@chakra-ui/react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { ordersData } from '../../mocks';
import OrderItem from '../OrderItem'; import OrderItem from '../OrderItem';
import { OrderProps } from '../OrderItem/OrderItem'; import { OrderProps } from '../OrderItem/OrderItem';
import data from '../../../stubs/json/arm-orders/success.json';
const Orders = () => { const Orders = () => {
const { t } = useTranslation('~', { const { t } = useTranslation('~', {
@ -34,7 +33,7 @@ const Orders = () => {
</Tr> </Tr>
</Thead> </Thead>
<Tbody> <Tbody>
{ordersData.map((order, index) => ( {data.body.map((order, index) => (
<OrderItem <OrderItem
key={index} key={index}
{...order} {...order}

View File

@ -1,35 +0,0 @@
export const mastersData = [
{
id: 'masters1',
name: 'Иван Иванов',
schedule: ['15:00 - 16:30', '17:00 - 18:00'],
phone: '+7 900 123 45 67',
},
{
id: 'masters2',
name: 'Сергей Петров',
schedule: ['10:00 - 12:30', '14:00 - 15:30', '16:00 - 17:00'],
phone: '+7 900 234 56 78',
},
];
export const ordersData = [
{
id: 'order1',
carNumber: 'A123BC',
washTime: '10:30',
orderDate: '2024-10-31',
status: 'progress',
phone: '79001234567',
location: 'Казань, ул. Баумана, 1',
},
{
id: 'order2',
carNumber: 'B456CD',
washTime: '11:00',
orderDate: '2024-10-31',
status: 'complete',
phone: '79002345678',
location: 'Казань, ул. Кремлёвская, 3',
},
];

View File

@ -0,0 +1,17 @@
{
"success": true,
"body": [
{
"id": "masters1",
"name": "Иван Иванов",
"schedule": ["15:00 - 16:30", "17:00 - 18:00"],
"phone": "+7 900 123 45 67"
},
{
"id": "masters12",
"name": "Иван Иванов",
"schedule": ["15:00 - 16:30", "17:00 - 18:00"],
"phone": "+7 900 123 45 67"
}
]
}

View File

@ -0,0 +1,32 @@
{
"success": true,
"body": [
{
"id": "order1",
"carNumber": "A123BC",
"washTime": "10:30",
"orderDate": "2024-10-31",
"status": "progress",
"phone": "79001234563",
"location": "Казань, ул. Баумана, 1"
},
{
"id": "order2",
"carNumber": "A123BC",
"washTime": "10:30",
"orderDate": "2024-10-31",
"status": "progress",
"phone": "79001234568",
"location": "Казань, ул. Баумана, 1"
},
{
"id": "order3",
"carNumber": "A123BC",
"washTime": "10:30",
"orderDate": "2024-10-31",
"status": "progress",
"phone": "79001234569",
"location": "Казань, ул. Баумана, 1"
}
]
}