Date: Sat, 23 Nov 2024 15:59:21 +0300
Subject: [PATCH 2/5] fix: divide the imports(#37)
---
src/components/Orders/Orders.tsx | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/components/Orders/Orders.tsx b/src/components/Orders/Orders.tsx
index 5c55417..10831e7 100644
--- a/src/components/Orders/Orders.tsx
+++ b/src/components/Orders/Orders.tsx
@@ -1,6 +1,7 @@
import React from 'react';
import { Box, Heading, Table, Thead, Tbody, Tr, Th } from '@chakra-ui/react';
import { useTranslation } from 'react-i18next';
+
import OrderItem from '../OrderItem';
import { OrderProps } from '../OrderItem/OrderItem';
import data from '../../../stubs/json/arm-orders/success.json';
From acd39b1e32533445613d1a96895664742168bfec Mon Sep 17 00:00:00 2001
From: ilnaz <237x237@gmail.com>
Date: Sun, 24 Nov 2024 12:08:45 +0300
Subject: [PATCH 3/5] feat: add format date(#40)
---
locales/ru.json | 3 ++-
package-lock.json | 6 ++++++
package.json | 1 +
src/components/MasterItem/MasterItem.tsx | 6 +++---
src/components/OrderItem/OrderItem.tsx | 12 ++++++++----
src/lib/date-helpers.ts | 12 ++++++++++++
stubs/json/arm-masters/success.json | 22 +++++++++++++++++++--
stubs/json/arm-orders/success.json | 25 +++++++++---------------
8 files changed, 61 insertions(+), 26 deletions(-)
create mode 100644 src/lib/date-helpers.ts
diff --git a/locales/ru.json b/locales/ru.json
index 3511bb3..5c9d91c 100644
--- a/locales/ru.json
+++ b/locales/ru.json
@@ -49,5 +49,6 @@
"dry-wash.notFound.button.back": "Вернуться на главную",
"dry-wash.errorBoundary.title":"Что-то пошло не так",
"dry-wash.errorBoundary.description": "Мы уже работаем над исправлением проблемы",
- "dry-wash.errorBoundary.button.reload": "Перезагрузить страницу"
+ "dry-wash.errorBoundary.button.reload": "Перезагрузить страницу",
+ "dry-wash.washTime.timeSlot": "{{start}} - {{end}}"
}
diff --git a/package-lock.json b/package-lock.json
index 93317ed..b24108c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -17,6 +17,7 @@
"@fontsource/open-sans": "^5.1.0",
"@lottiefiles/react-lottie-player": "^3.5.4",
"@types/react": "^18.3.12",
+ "dayjs": "^1.11.13",
"express": "^4.21.1",
"framer-motion": "^6.2.8",
"i18next": "^23.16.4",
@@ -5304,6 +5305,11 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/dayjs": {
+ "version": "1.11.13",
+ "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz",
+ "integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg=="
+ },
"node_modules/debug": {
"version": "4.3.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz",
diff --git a/package.json b/package.json
index 5b5ff92..13e8c31 100644
--- a/package.json
+++ b/package.json
@@ -25,6 +25,7 @@
"@fontsource/open-sans": "^5.1.0",
"@lottiefiles/react-lottie-player": "^3.5.4",
"@types/react": "^18.3.12",
+ "dayjs": "^1.11.13",
"express": "^4.21.1",
"framer-motion": "^6.2.8",
"i18next": "^23.16.4",
diff --git a/src/components/MasterItem/MasterItem.tsx b/src/components/MasterItem/MasterItem.tsx
index a98b8ae..05f4546 100644
--- a/src/components/MasterItem/MasterItem.tsx
+++ b/src/components/MasterItem/MasterItem.tsx
@@ -1,7 +1,7 @@
import React from 'react';
import { Badge, Link, Stack, Td, Tr } from '@chakra-ui/react';
-
import MasterActionsMenu from '../MasterActionsMenu';
+import { getTimeSlot } from '../../lib/date-helpers';
const MasterItem = ({ name, schedule, phone }) => {
return (
@@ -9,9 +9,9 @@ const MasterItem = ({ name, schedule, phone }) => {
{name} |
- {schedule.map((time, index) => (
+ {schedule.map(({ startWashTime, endWashTime }, index) => (
- {time}
+ {getTimeSlot(startWashTime, endWashTime)}
))}
diff --git a/src/components/OrderItem/OrderItem.tsx b/src/components/OrderItem/OrderItem.tsx
index 72be7e2..d4e86d8 100644
--- a/src/components/OrderItem/OrderItem.tsx
+++ b/src/components/OrderItem/OrderItem.tsx
@@ -1,6 +1,8 @@
import React, { useState } from 'react';
import { Td, Tr, Link, Select } from '@chakra-ui/react';
import { useTranslation } from 'react-i18next';
+import dayjs from 'dayjs';
+import { getTimeSlot } from '../../lib/date-helpers';
const statuses = [
'pending' as const,
@@ -15,7 +17,8 @@ type GetArrItemType =
export type OrderProps = {
carNumber?: string;
- washTime?: string;
+ startWashTime?: string;
+ endWashTime?: string;
orderDate?: string;
status?: GetArrItemType;
phone?: string;
@@ -24,7 +27,8 @@ export type OrderProps = {
const OrderItem = ({
carNumber,
- washTime,
+ startWashTime,
+ endWashTime,
orderDate,
status,
phone,
@@ -39,8 +43,8 @@ const OrderItem = ({
return (
{carNumber} |
- {washTime} |
- {orderDate} |
+ {getTimeSlot(startWashTime, endWashTime)} |
+ {dayjs(orderDate).format('DD.MM.YYYY')} |
| |