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 ? ( + + ) : ( + + )} );