From 785e56f9b06c7624d5a0c145f60e48bc3cfd5553 Mon Sep 17 00:00:00 2001 From: Nastya Date: Mon, 11 Aug 2025 18:56:37 +0300 Subject: [PATCH] =?UTF-8?q?fix=20=D1=88=D0=B8=D0=BB=D1=8C=D0=B4=D0=B8?= =?UTF-8?q?=D0=BA=D0=B8=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B0?= =?UTF-8?q?=D1=8E=D1=82=20=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D1=8B=D0=B9=20=D1=86=D0=B2=D0=B5=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/assets/icons/NameplateLogoDark.tsx | 216 ++++++++++++++++++ .../ContactForm/ContactForm.tsx | 8 +- .../ViewPublicationPage/ResultForm.tsx | 8 +- .../StartPageViewPublication/index.tsx | 19 +- 4 files changed, 228 insertions(+), 23 deletions(-) create mode 100644 lib/assets/icons/NameplateLogoDark.tsx diff --git a/lib/assets/icons/NameplateLogoDark.tsx b/lib/assets/icons/NameplateLogoDark.tsx new file mode 100644 index 0000000..bb5da48 --- /dev/null +++ b/lib/assets/icons/NameplateLogoDark.tsx @@ -0,0 +1,216 @@ +import { FC, SVGProps } from "react"; + +// Fallback функция для получения языка, когда React Router недоступен +const getLanguageFromUrlFallback = (): string => { + const path = window.location.pathname; + const langMatch = path.match(/^\/(en|ru|uz)(\/|$)/i); + if (langMatch) { + return langMatch[1].toLowerCase(); + } + return "ru"; +}; + +export const NameplateLogoDark: FC> = () => { + let lang = "ru"; // fallback + + try { + // Пытаемся использовать React Router + const { useLocation } = require("react-router-dom"); + const location = useLocation(); + const pathname = location.pathname; + + const getLanguageFromUrl = () => { + const parts = pathname.split("/"); + if (parts.length >= 2) { + const langSegment = parts[1].toLowerCase(); + if (langSegment === "en") return "en"; + if (langSegment === "uz") return "uz"; + } + return "ru"; + }; + + lang = getLanguageFromUrl(); + } catch (error) { + // Если React Router недоступен (в виджете), используем fallback + lang = getLanguageFromUrlFallback(); + } + + if (lang === "ru") return ; + if (lang === "en") return ; + if (lang === "uz") return ; + + return ; // Fallback +}; + +const UZ: FC> = () => ( + + + + + + + +); +const RU: FC> = () => ( + + + + + + + + + + + + + + + + + + + + + + + +); +const EN: FC> = () => ( + + + + + + + +); diff --git a/lib/components/ViewPublicationPage/ContactForm/ContactForm.tsx b/lib/components/ViewPublicationPage/ContactForm/ContactForm.tsx index 4135659..b79f787 100644 --- a/lib/components/ViewPublicationPage/ContactForm/ContactForm.tsx +++ b/lib/components/ViewPublicationPage/ContactForm/ContactForm.tsx @@ -26,6 +26,7 @@ import type { AnyTypedQuizQuestion } from "@model/questionTypes/shared"; import { isProduction } from "@/utils/defineDomain"; import { useQuizStore } from "@/stores/useQuizStore"; import { useTranslation } from "react-i18next"; +import { NameplateLogoDark } from "@/assets/icons/NameplateLogoDark"; type Props = { currentQuestion: AnyTypedQuizQuestion; @@ -461,12 +462,7 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => { margitTop: "auto", }} > - + {quizThemes[settings.cfg.theme].isLight ? : } )} diff --git a/lib/components/ViewPublicationPage/ResultForm.tsx b/lib/components/ViewPublicationPage/ResultForm.tsx index 1a992b0..670953c 100644 --- a/lib/components/ViewPublicationPage/ResultForm.tsx +++ b/lib/components/ViewPublicationPage/ResultForm.tsx @@ -20,6 +20,7 @@ import { sendFC, sendResult } from "@/api/quizRelase"; import { isProduction } from "@/utils/defineDomain"; import { useQuizStore } from "@/stores/useQuizStore"; import { useTranslation } from "react-i18next"; +import { NameplateLogoDark } from "@/assets/icons/NameplateLogoDark"; type ResultFormProps = { resultQuestion: QuizQuestionResult; @@ -308,12 +309,7 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => { bottom: "90px", }} > - + {quizThemes[settings.cfg.theme].isLight ? : } )} { : undefined, }} > - + {settings.cfg.startpageType === "expanded" ? ( + + ) : quizThemes[settings.cfg.theme].isLight ? ( + + ) : ( + + )} );