--
This commit is contained in:
parent
b09e587220
commit
4469aeb83a
@ -99,6 +99,15 @@ function QuizAnswererInner({
|
|||||||
|
|
||||||
console.log("settings");
|
console.log("settings");
|
||||||
console.log(settings);
|
console.log(settings);
|
||||||
|
console.log("questions");
|
||||||
|
console.log(questions);
|
||||||
|
console.log("error");
|
||||||
|
console.log(error);
|
||||||
|
console.log("isLoading");
|
||||||
|
console.log(isLoading);
|
||||||
|
console.log("quizId");
|
||||||
|
console.log(quizId);
|
||||||
|
|
||||||
if (isLoading && !questions.length) return <LoadingSkeleton />;
|
if (isLoading && !questions.length) return <LoadingSkeleton />;
|
||||||
if (error) return <ApologyPage error={error} />;
|
if (error) return <ApologyPage error={error} />;
|
||||||
|
|
||||||
|
@ -5,8 +5,9 @@ import { useTranslation } from "react-i18next";
|
|||||||
type Props = Partial<FallbackProps>;
|
type Props = Partial<FallbackProps>;
|
||||||
|
|
||||||
export const ApologyPage = ({ error }: Props) => {
|
export const ApologyPage = ({ error }: Props) => {
|
||||||
let message = error.message || error.response?.data;
|
let message = error?.message || error?.response?.data || "default message";
|
||||||
console.log("message");
|
console.log("message");
|
||||||
|
console.log(message);
|
||||||
console.log(message.toLowerCase());
|
console.log(message.toLowerCase());
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
console.log("t");
|
console.log("t");
|
||||||
|
@ -18,11 +18,77 @@ const getLanguageFromURL = (): string => {
|
|||||||
return "ru"; // Жёсткий фолбэк
|
return "ru"; // Жёсткий фолбэк
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const r = {
|
||||||
|
ru: {
|
||||||
|
"quiz is inactive": "Квиз не активирован",
|
||||||
|
"no questions found": "Нет созданных вопросов",
|
||||||
|
"quiz is empty": "Квиз пуст",
|
||||||
|
"quiz already completed": "Вы уже прошли этот опрос",
|
||||||
|
"no quiz id": "Отсутствует id квиза",
|
||||||
|
"quiz data is null": "Не были переданы параметры квиза",
|
||||||
|
"invalid request data": "Такого квиза не существует",
|
||||||
|
"default message": "Что-то пошло не так",
|
||||||
|
"The request could not be sent": "Заявка не может быть отправлена",
|
||||||
|
"The number of points could not be sent": "Количество баллов не может быть отправлено",
|
||||||
|
"Your result": "Ваш результат",
|
||||||
|
"Your points": "Ваши баллы",
|
||||||
|
of: "из",
|
||||||
|
"View answers": "Посмотреть ответы",
|
||||||
|
"Find out more": "Узнать подробнее",
|
||||||
|
"Go to website": "Перейти на сайт",
|
||||||
|
"Question title": "Заголовок вопроса",
|
||||||
|
"Question without a title": "Вопрос без названия",
|
||||||
|
"Your answer": "Ваш ответ",
|
||||||
|
"Add image": "Добавить изображение",
|
||||||
|
"Accepts images": "Принимает изображения",
|
||||||
|
"Add video": "Добавить видео",
|
||||||
|
"Accepts .mp4 and .mov format - maximum 50mb": "Принимает .mp4 и .mov формат — максимум 50мб",
|
||||||
|
"Add audio file": "Добавить аудиофайл",
|
||||||
|
"Accepts audio files": "Принимает аудиофайлы",
|
||||||
|
"Add document": "Добавить документ",
|
||||||
|
"Accepts documents": "Принимает документы",
|
||||||
|
Next: "Далее",
|
||||||
|
Prev: "Назад",
|
||||||
|
From: "От",
|
||||||
|
До: "До",
|
||||||
|
"Enter your answer": "Введите свой ответ",
|
||||||
|
"Incorrect file type selected": "Выбран некорректный тип файла",
|
||||||
|
"File is too big. Maximum size is 50 MB": "Файл слишком большой. Максимальный размер 50 МБ",
|
||||||
|
"Acceptable file extensions": "Допустимые расширения файлов",
|
||||||
|
"You have uploaded": "Вы загрузили",
|
||||||
|
"The answer was not counted": "Ответ не был засчитан",
|
||||||
|
"Select an answer option below": "Выберите вариант ответа ниже",
|
||||||
|
"Select an answer option on the left": "Выберите вариант ответа слева",
|
||||||
|
"Fill out the form to receive your test results": "Заполните форму, чтобы получить результаты теста",
|
||||||
|
Enter: "Введите",
|
||||||
|
Name: "Имя",
|
||||||
|
"Phone number": "Номер телефона",
|
||||||
|
"Last name": "Фамилия",
|
||||||
|
Address: "Адрес",
|
||||||
|
"Incorrect email entered": "Введена некорректная почта",
|
||||||
|
"Please fill in the fields": "Пожалуйста, заполните поля",
|
||||||
|
"Please try again later": "повторите попытку позже",
|
||||||
|
"Regulation on the processing of personal data": "Положением об обработке персональных данных",
|
||||||
|
"Privacy Policy": "Политикой конфиденциальности",
|
||||||
|
familiarized: "ознакомлен",
|
||||||
|
and: "и",
|
||||||
|
"Get results": "Получить результаты",
|
||||||
|
"Data sent successfully": "Данные успешно отправлены",
|
||||||
|
Step: "Шаг",
|
||||||
|
"questions are not ready yet": "Вопросы для аудитории ещё не созданы. Пожалуйста, подождите",
|
||||||
|
"Add your image": "Добавьте своё изображение",
|
||||||
|
"select emoji": "выберите смайлик",
|
||||||
|
"file is too big": "Файл слишком большой",
|
||||||
|
"file type is not supported": "Тип файла не поддерживается",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
// 2. Конфиг с полной отладкой
|
// 2. Конфиг с полной отладкой
|
||||||
i18n
|
i18n
|
||||||
.use(Backend)
|
.use(Backend)
|
||||||
.use(initReactI18next)
|
.use(initReactI18next)
|
||||||
.init({
|
.init({
|
||||||
|
resources: r,
|
||||||
lng: getLanguageFromURL(), // Принудительно из URL
|
lng: getLanguageFromURL(), // Принудительно из URL
|
||||||
fallbackLng: "ru",
|
fallbackLng: "ru",
|
||||||
supportedLngs: ["en", "ru", "uz"],
|
supportedLngs: ["en", "ru", "uz"],
|
||||||
|
@ -2,6 +2,7 @@ import QuizAnswerer from "@/components/QuizAnswerer";
|
|||||||
import { createRoot } from "react-dom/client";
|
import { createRoot } from "react-dom/client";
|
||||||
// eslint-disable-next-line react-refresh/only-export-components
|
// eslint-disable-next-line react-refresh/only-export-components
|
||||||
export * from "./widgets";
|
export * from "./widgets";
|
||||||
|
import "./i18n/i18n";
|
||||||
|
|
||||||
// old widget
|
// old widget
|
||||||
const widget = {
|
const widget = {
|
||||||
@ -14,12 +15,22 @@ const widget = {
|
|||||||
quizId: string;
|
quizId: string;
|
||||||
changeFaviconAndTitle: boolean;
|
changeFaviconAndTitle: boolean;
|
||||||
}) {
|
}) {
|
||||||
|
console.log("Widget create called with:");
|
||||||
|
console.log("selector:", selector);
|
||||||
|
console.log("quizId:", quizId);
|
||||||
|
console.log("changeFaviconAndTitle:", changeFaviconAndTitle);
|
||||||
|
|
||||||
const element = document.getElementById(selector);
|
const element = document.getElementById(selector);
|
||||||
if (!element) throw new Error("Element for widget doesn't exist");
|
if (!element) throw new Error("Element for widget doesn't exist");
|
||||||
|
|
||||||
const root = createRoot(element);
|
const root = createRoot(element);
|
||||||
|
|
||||||
root.render(<QuizAnswerer quizId={quizId} changeFaviconAndTitle={changeFaviconAndTitle} disableGlobalCss />);
|
root.render(
|
||||||
|
<QuizAnswerer
|
||||||
|
quizId={quizId}
|
||||||
|
changeFaviconAndTitle={changeFaviconAndTitle}
|
||||||
|
/>
|
||||||
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -9,12 +9,12 @@ export default defineConfig({
|
|||||||
alias,
|
alias,
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
|
minify: true, // Включаем минификацию как в обычной сборке
|
||||||
|
sourcemap: false, // Отключаем sourcemaps как в обычной сборке
|
||||||
copyPublicDir: false,
|
copyPublicDir: false,
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
input: "src/widget.tsx",
|
input: "src/widget.tsx",
|
||||||
preserveEntrySignatures: "allow-extension",
|
|
||||||
output: {
|
output: {
|
||||||
manualChunks: undefined,
|
|
||||||
entryFileNames: "[name].js",
|
entryFileNames: "[name].js",
|
||||||
chunkFileNames: "[name].js",
|
chunkFileNames: "[name].js",
|
||||||
assetFileNames: "[name].[ext]",
|
assetFileNames: "[name].[ext]",
|
||||||
|
Loading…
Reference in New Issue
Block a user