From a5dc5211c97390014f8b98325b14681920266132 Mon Sep 17 00:00:00 2001 From: DmitriyB Date: Wed, 27 Jul 2022 12:20:57 +0500 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BB=D0=BE=D0=BA=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D1=8F=20=D1=84=D1=83=D1=82=D0=B5=D1=80=D0=B0=20?= =?UTF-8?q?=D0=B8=20=D0=BF=D0=BE=D1=87=D1=82=D0=B8=20=D0=B2=D1=81=D0=B5?= =?UTF-8?q?=D1=85=20=D0=BE=D1=81=D0=BD=D0=BE=D0=B2=D0=BD=D1=8B=D1=85=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=BF=D0=BE=D0=BD=D0=B5=D0=BD=D1=82=D0=BE?= =?UTF-8?q?=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/footer/contactsContainer.tsx | 32 +++++++-- src/components/footer/footer.tsx | 15 ++-- src/components/langDict.tsx | 2 +- src/components/mainPart/calendar/calendar.tsx | 68 +++++++++++++++---- src/components/mainPart/legend.tsx | 9 ++- src/components/mainPart/main-part-footer.tsx | 11 +-- src/components/mainPart/mainPart.tsx | 8 +-- .../mainPart/planContentContainer.tsx | 11 ++- 8 files changed, 112 insertions(+), 44 deletions(-) diff --git a/src/components/footer/contactsContainer.tsx b/src/components/footer/contactsContainer.tsx index 9bc5bc7..d1ecd5f 100644 --- a/src/components/footer/contactsContainer.tsx +++ b/src/components/footer/contactsContainer.tsx @@ -1,15 +1,29 @@ -import React from "react"; +import React, { useContext } from "react"; +import { ContextLang } from "../ContextLang"; type TProps = { - title: string + title: { + ru: string, + en: string + } href?: string - pairData: Array<{value1: string, value2?: string}> + pairData: Array<{ + value1: { + ru: string, + en: string + } | string, + value2?: { + ru: string, + en: string + } | string + }> } export const ContactContainer:React.FC = React.memo((props) => { + const {lang} = useContext(ContextLang); return
- {props.title} + {props.title[lang]}
{ @@ -19,14 +33,18 @@ export const ContactContainer:React.FC = React.memo((props) => { }
{props.pairData.map(pair => { - return
+ return
- {pair.value1} + + {typeof(pair.value1) === 'string' ? pair.value1 : pair.value1[lang]} +
{ pair?.value2 ?
- {pair?.value2} + + {typeof(pair?.value2) === 'string' ? pair?.value2 : pair?.value2[lang]} +
: null } diff --git a/src/components/footer/footer.tsx b/src/components/footer/footer.tsx index 845d570..8c6affd 100644 --- a/src/components/footer/footer.tsx +++ b/src/components/footer/footer.tsx @@ -1,4 +1,5 @@ import React from "react"; +import { LangDict } from "../langDict"; import { ContactContainer } from "./contactsContainer"; import './footer.css'; import whiteLogo from './logoWhiteIcon.svg'; @@ -10,28 +11,28 @@ export const Footer:React.FC = React.memo(() => {
-
+
diff --git a/src/components/langDict.tsx b/src/components/langDict.tsx index 7861218..8e1e55e 100644 --- a/src/components/langDict.tsx +++ b/src/components/langDict.tsx @@ -103,7 +103,7 @@ export const LangDict = { ru: 'Россия', en: 'Russia' }, - contactUat: { + contactUae: { ru: 'ОАЭ', en: 'UAE' }, diff --git a/src/components/mainPart/calendar/calendar.tsx b/src/components/mainPart/calendar/calendar.tsx index a4f6f23..d73e70a 100644 --- a/src/components/mainPart/calendar/calendar.tsx +++ b/src/components/mainPart/calendar/calendar.tsx @@ -1,5 +1,6 @@ -import React from "react"; +import React, { useContext } from "react"; import Calendar from "react-calendar"; +import { ContextLang } from "../../ContextLang"; import './calendar.css'; type TProps = { @@ -7,22 +8,59 @@ type TProps = { } export const CalendarComponent:React.FC = React.memo((props) => { + const {lang} = useContext(ContextLang); const months = { - 0: 'Января', - 1: 'Февраля', - 2: 'Марта', - 3: 'Апреля', - 4: 'Мая', - 5: 'Июня', - 6: 'Июля', - 7: 'Августа', - 8: 'Сентября', - 9: 'Октября', - 10: 'Ноября', - 11: 'Декабря' + 0: { + ru: 'Января', + en: 'January' + }, + 1: { + ru: 'Февраля', + en: 'February' + }, + 2: { + ru: 'Марта', + en: 'March' + }, + 3: { + ru: 'Апреля', + en: 'April' + }, + 4: { + ru: 'Мая', + en: 'March' + }, + 5: { + ru: 'Июня', + en: 'June' + }, + 6: { + ru: 'Июля', + en: 'Jule' + }, + 7: { + ru: 'Августа', + en: 'August' + }, + 8: { + ru: 'Сентября', + en: 'September' + }, + 9: { + ru: 'Октября', + en: 'October' + }, + 10: { + ru: 'Ноября', + en: 'November' + }, + 11: { + ru: 'Декабря', + en: 'December' + } } return = React.memo((props) => { // return props.disableDays.includes(a.date.getDate()) // }} minDate={new Date()} - onClickDay={(e) => props.onCLick(`${e.getDate()} ${months[e.getMonth() as keyof typeof months]}`)} + onClickDay={(e) => props.onCLick(`${e.getDate()} ${months[e.getMonth() as keyof typeof months][lang]}`)} /> }) \ No newline at end of file diff --git a/src/components/mainPart/legend.tsx b/src/components/mainPart/legend.tsx index b15348b..221a085 100644 --- a/src/components/mainPart/legend.tsx +++ b/src/components/mainPart/legend.tsx @@ -1,17 +1,20 @@ -import React from "react"; +import React, { useContext } from "react"; +import { LangDict } from "../langDict"; +import { ContextLang } from "../ContextLang"; type TProps = { active: boolean } export const Legend:React.FC = React.memo((props) => { + const {lang} = useContext(ContextLang); return
{ props.active - ? 'Запись есть' - : 'Записи нет' + ? LangDict.legendActive[lang] + : LangDict.legendDisabled[lang] }
diff --git a/src/components/mainPart/main-part-footer.tsx b/src/components/mainPart/main-part-footer.tsx index 67c19f8..d627e8e 100644 --- a/src/components/mainPart/main-part-footer.tsx +++ b/src/components/mainPart/main-part-footer.tsx @@ -1,19 +1,22 @@ -import React from "react"; +import React, { useContext } from "react"; +import { LangDict } from "../langDict"; +import { ContextLang } from "../ContextLang"; export const MainPartFooter:React.FC = React.memo(() => { + const {lang} = useContext(ContextLang); return
- Данная технология находится на стадии разработки. + {LangDict.footNoteTextFirst[lang]} - Если подключиться к демонстрации не удалось, свяжитесь с нами. + {LangDict.footNoteTextSecond[lang]}
- +7 800 770 00 67 (Россия) / +971 50 983 8902 (ОАЭ) + {LangDict.footNoteNumber[lang]}
}) \ No newline at end of file diff --git a/src/components/mainPart/mainPart.tsx b/src/components/mainPart/mainPart.tsx index e78b9e0..9bdcd4c 100644 --- a/src/components/mainPart/mainPart.tsx +++ b/src/components/mainPart/mainPart.tsx @@ -88,7 +88,7 @@ export const MainPart: React.FC = React.memo(() => { enableBackground(); setPlaneContent( onSelectDay(date)} />} isLegend={true} /> @@ -103,7 +103,7 @@ export const MainPart: React.FC = React.memo(() => { function onSelectDay(date: string) { setPlaneContent( { } function onSelectTime(date: string, time: string) { - let dateTime = `${date} в ${time}`; + let dateTime = `${date} ${lang === 'ru' ? 'в' : 'in'} ${time}`; setPlaneContent( = React.memo((props) => { + const {lang} = useContext(ContextLang); return
- {props.title} + {props.title[lang]} { props.date ? {props.date}