diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..0bfacb3
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,5 @@
+/build
+Makefile
+README.md
+compose.yml
+/.git
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..72a3692
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,38 @@
+include:
+ - project: "devops/pena-continuous-integration"
+ file: "/templates/docker/build-template.gitlab-ci.yml"
+ - project: "devops/pena-continuous-integration"
+ file: "/templates/docker/clean-template.gitlab-ci.yml"
+ - project: "devops/pena-continuous-integration"
+ file: "/templates/docker/deploy-template.gitlab-ci.yml"
+stages:
+ - clean
+ - build
+ - deploy
+
+clear-old-images:
+ extends: .clean_template
+ variables:
+ STAGING_BRANCH: "main"
+ PRODUCTION_BRANCH: "main"
+ image:
+ name: docker/compose:1.28.0
+ entrypoint: [""]
+ before_script:
+ - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
+ - docker images
+ script:
+ - docker system prune -af
+build-app:
+ extends: .build_template
+ variables:
+ DOCKER_BUILD_PATH: "./Dockerfile"
+ STAGING_BRANCH: "main"
+ PRODUCTION_BRANCH: "main"
+
+deploy-to-staging:
+ extends: .deploy_template
+ variables:
+ DEPLOY_TO: "staging"
+ BRANCH: "main"
+
diff --git a/.vscode/settings.json b/.vscode/settings.json
deleted file mode 100644
index 842b505..0000000
--- a/.vscode/settings.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "typescript.enablePromptUseWorkspaceTsdk": true,
- "typescript.tsdk": "node_modules/typescript/lib"
- }
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..9a55e55
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,14 @@
+FROM node:20.10-alpine3.18 as build
+
+RUN apk update && rm -rf /var/cache/apk/*
+WORKDIR /usr/app
+COPY . .
+
+RUN yarn install --ignore-scripts --non-interactive --frozen-lockfile && yarn cache clean
+RUN yarn build
+
+
+FROM nginx:latest as result
+WORKDIR /usr/share/nginx/html
+COPY --from=build /usr/app/build/ /usr/share/nginx/html
+COPY hub.conf /etc/nginx/conf.d/default.conf
diff --git a/README.md b/README.md
deleted file mode 100644
index c55262d..0000000
--- a/README.md
+++ /dev/null
@@ -1,93 +0,0 @@
-# SquzAnswerer
-
-
-
-## Getting started
-
-To make it easy for you to get started with GitLab, here's a list of recommended next steps.
-
-Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
-
-## Add your files
-
-- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
-- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
-
-```
-cd existing_repo
-git remote add origin https://penahub.gitlab.yandexcloud.net/frontend/squzanswerer.git
-git branch -M main
-git push -uf origin main
-```
-
-## Integrate with your tools
-
-- [ ] [Set up project integrations](https://penahub.gitlab.yandexcloud.net/frontend/squzanswerer/-/settings/integrations)
-
-## Collaborate with your team
-
-- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
-- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
-- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
-- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
-- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
-
-## Test and Deploy
-
-Use the built-in continuous integration in GitLab.
-
-- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
-- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
-- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
-- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
-- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
-
-***
-
-# Editing this README
-
-When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
-
-## Suggestions for a good README
-
-Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
-
-## Name
-Choose a self-explaining name for your project.
-
-## Description
-Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
-
-## Badges
-On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
-
-## Visuals
-Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
-
-## Installation
-Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
-
-## Usage
-Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
-
-## Support
-Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
-
-## Roadmap
-If you have ideas for releases in the future, it is a good idea to list them in the README.
-
-## Contributing
-State if you are open to contributions and what your requirements are for accepting them.
-
-For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
-
-You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
-
-## Authors and acknowledgment
-Show your appreciation to those who have contributed to the project.
-
-## License
-For open source projects, say how it is licensed.
-
-## Project status
-If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
diff --git a/craco.config.js b/craco.config.js
old mode 100644
new mode 100755
diff --git a/cypress.config.ts b/cypress.config.ts
new file mode 100644
index 0000000..87067ad
--- /dev/null
+++ b/cypress.config.ts
@@ -0,0 +1,10 @@
+import { defineConfig } from "cypress";
+
+export default defineConfig({
+ e2e: {
+ baseUrl: 'http://localhost:3000',
+ viewportWidth: 1440,
+ viewportHeight: 900,
+ supportFile: false,
+ },
+});
diff --git a/deployments/staging/docker-compose.yaml b/deployments/staging/docker-compose.yaml
new file mode 100644
index 0000000..4a851e2
--- /dev/null
+++ b/deployments/staging/docker-compose.yaml
@@ -0,0 +1,13 @@
+services:
+ squiz:
+ container_name: squiz
+ restart: unless-stopped
+ image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG.$CI_PIPELINE_ID
+ networks:
+ - marketplace_penahub_frontend
+ hostname: squiz
+ tty: true
+networks:
+ marketplace_penahub_frontend:
+ external: true
+
diff --git a/hub.conf b/hub.conf
new file mode 100644
index 0000000..a3a8e51
--- /dev/null
+++ b/hub.conf
@@ -0,0 +1,12 @@
+server {
+ listen 80;
+ server_name _;
+
+ location / {
+ root /usr/share/nginx/html;
+ index index.html index.htm;
+ try_files $uri $uri/ /index.html;
+ }
+
+ root /usr/share/nginx/html;
+}
diff --git a/package.json b/package.json
old mode 100644
new mode 100755
index 01e7eea..a650129
--- a/package.json
+++ b/package.json
@@ -1,53 +1,63 @@
{
- "name": "squzanswerer",
- "version": "1.0.0",
- "private": true,
- "repository": "git@penahub.gitlab.yandexcloud.net:frontend/squzanswerer.git",
- "author": "ryletd",
- "license": "MIT",
- "dependencies": {
- "@craco/craco": "^7.1.0",
- "@emotion/react": "^11.11.1",
- "@emotion/styled": "^11.11.0",
- "@frontend/kitui": "^1.0.54",
- "@mui/icons-material": "^5.15.0",
- "@mui/material": "^5.15.0",
- "@mui/x-date-pickers": "^6.18.4",
- "axios": "^1.6.2",
- "dayjs": "^1.11.10",
- "notistack": "^3.0.1",
- "react": "^18.2.0",
- "react-dom": "^18.2.0",
- "react-rnd": "^10.4.1",
- "react-router-dom": "^6.21.0",
- "react-scripts": "^5.0.1",
- "swr": "^2.2.4",
- "typescript": "^5.3.3",
- "use-debounce": "^10.0.0",
- "zustand": "^4.4.7"
- },
- "devDependencies": {
- "@emoji-mart/data": "^1.1.2",
- "@emoji-mart/react": "^1.1.1",
- "@types/node": "^20.10.4",
- "@types/react": "^18.2.45",
- "@types/react-dom": "^18.2.18",
- "craco-alias": "^3.0.1"
- },
- "scripts": {
- "start": "craco start",
- "build": "craco build"
- },
- "browserslist": {
- "production": [
- ">0.2%",
- "not dead",
- "not op_mini all"
- ],
- "development": [
- "last 1 chrome version",
- "last 1 firefox version",
- "last 1 safari version"
- ]
- }
+ "name": "squidward",
+ "version": "0.1.0",
+ "private": true,
+ "dependencies": {
+ "@craco/craco": "^7.0.0",
+ "@emotion/react": "^11.10.5",
+ "@emotion/styled": "^11.10.5",
+ "@frontend/kitui": "^1.0.54",
+ "@mui/icons-material": "^5.10.14",
+ "@mui/material": "^5.10.14",
+ "@mui/x-date-pickers": "^6.16.1",
+ "@types/node": "^16.7.13",
+ "@types/react": "^18.0.0",
+ "@types/react-dom": "^18.0.0",
+ "axios": "^1.5.1",
+ "dayjs": "^1.11.10",
+ "emoji-mart": "^5.5.2",
+ "formik": "^2.4.5",
+ "immer": "^10.0.3",
+ "nanoid": "^5.0.3",
+ "notistack": "^3.0.1",
+ "react": "^18.2.0",
+ "react-dom": "^18.2.0",
+ "react-error-boundary": "^4.0.11",
+ "react-router-dom": "^6.6.2",
+ "react-scripts": "5.0.1",
+ "swr": "^2.2.4",
+ "typescript": "^5.2.2",
+ "use-debounce": "^9.0.4",
+ "web-vitals": "^2.1.0",
+ "yup": "^1.3.2",
+ "zustand": "^4.3.8"
+ },
+ "scripts": {
+ "start": "craco start",
+ "build": "craco build",
+ "test": "craco test",
+ "eject": "craco eject",
+ "cypress:open": "cypress open"
+ },
+ "browserslist": {
+ "production": [
+ ">0.2%",
+ "not dead",
+ "not op_mini all"
+ ],
+ "development": [
+ "last 1 chrome version",
+ "last 1 firefox version",
+ "last 1 safari version"
+ ]
+ },
+ "devDependencies": {
+ "@emoji-mart/data": "^1.1.2",
+ "@emoji-mart/react": "^1.1.1",
+ "@types/cytoscape-popper": "^2.0.4",
+ "@types/react-beautiful-dnd": "^13.1.4",
+ "@types/react-cytoscapejs": "^1.2.4",
+ "craco-alias": "^3.0.1",
+ "cypress": "^13.6.1"
+ }
}
diff --git a/public/android-chrome-192x192.png b/public/android-chrome-192x192.png
new file mode 100644
index 0000000..acfcce7
Binary files /dev/null and b/public/android-chrome-192x192.png differ
diff --git a/public/android-chrome-512x512.png b/public/android-chrome-512x512.png
new file mode 100644
index 0000000..4c931fd
Binary files /dev/null and b/public/android-chrome-512x512.png differ
diff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.png
new file mode 100644
index 0000000..90e31de
Binary files /dev/null and b/public/apple-touch-icon.png differ
diff --git a/public/browserconfig.xml b/public/browserconfig.xml
new file mode 100644
index 0000000..b3930d0
--- /dev/null
+++ b/public/browserconfig.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+ #da532c
+
+
+
diff --git a/public/favicon-16x16.png b/public/favicon-16x16.png
new file mode 100644
index 0000000..5aae9e7
Binary files /dev/null and b/public/favicon-16x16.png differ
diff --git a/public/favicon-32x32.png b/public/favicon-32x32.png
new file mode 100644
index 0000000..8e6907d
Binary files /dev/null and b/public/favicon-32x32.png differ
diff --git a/public/index.html b/public/index.html
old mode 100644
new mode 100755
diff --git a/public/manifest.json b/public/manifest.json
old mode 100644
new mode 100755
diff --git a/public/mstile-150x150.png b/public/mstile-150x150.png
new file mode 100644
index 0000000..2db962c
Binary files /dev/null and b/public/mstile-150x150.png differ
diff --git a/public/robots.txt b/public/robots.txt
old mode 100644
new mode 100755
diff --git a/public/safari-pinned-tab.svg b/public/safari-pinned-tab.svg
new file mode 100644
index 0000000..d2af8af
--- /dev/null
+++ b/public/safari-pinned-tab.svg
@@ -0,0 +1,48 @@
+
+
+
diff --git a/src/App.tsx b/src/App.tsx
index adb64bf..f3b5172 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,43 +1,10 @@
-import dayjs from "dayjs";
-import "dayjs/locale/ru";
import { ViewPage } from "./pages/ViewPublicationPage";
-import { BrowserRouter, Route, Routes } from "react-router-dom";
-import "./index.css";
-
-import {
- clearAuthToken,
- getMessageFromFetchError,
- useUserFetcher,
-} from "@frontend/kitui";
-import { clearUserData, setUser, useUserStore } from "@root/user";
-import { enqueueSnackbar } from "notistack";
+import dayjs from "dayjs";
dayjs.locale("ru");
+
export default function App() {
- const userId = useUserStore((state) => state.userId);
- useUserFetcher({
- url: `https://hub.pena.digital/user/${userId}`,
- userId,
- onNewUser: setUser,
- onError: (error) => {
- const errorMessage = getMessageFromFetchError(error);
- if (errorMessage) {
- enqueueSnackbar(errorMessage);
- clearUserData();
- clearAuthToken();
- }
- },
- });
-
- return (
- <>
-
-
- } />
-
-
- >
- );
+ return ;
}
diff --git a/src/api/contactForm.ts b/src/api/contactForm.ts
deleted file mode 100644
index 463bdaa..0000000
--- a/src/api/contactForm.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import axios from "axios";
-
-const domen = window.location.hostname === "localhost" ? "squiz.pena.digital" : window.location.hostname
-
-export function sendContactFormRequest(body: {
-
- contact: string;
- whoami: string;
-}) {
- return axios(`https://${domen}/feedback/callme`, {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- },
- data: body,
- });
-}
\ No newline at end of file
diff --git a/src/api/question.ts b/src/api/question.ts
deleted file mode 100644
index e70b4cc..0000000
--- a/src/api/question.ts
+++ /dev/null
@@ -1,71 +0,0 @@
-import { makeRequest } from "@frontend/kitui";
-import { CreateQuestionRequest } from "model/question/create";
-import { RawQuestion } from "model/question/question";
-import { GetQuestionListRequest, GetQuestionListResponse } from "@model/question/getList";
-import { EditQuestionRequest, EditQuestionResponse } from "@model/question/edit";
-import { DeleteQuestionRequest, DeleteQuestionResponse } from "@model/question/delete";
-import { CopyQuestionRequest, CopyQuestionResponse } from "@model/question/copy";
-
-
-const baseUrl = process.env.NODE_ENV === "production" ? "/squiz" : "https://squiz.pena.digital/squiz";
-
-function createQuestion(body: CreateQuestionRequest) {
- return makeRequest({
- url: `${baseUrl}/question/create`,
- body,
- method: "POST",
- });
-}
-
-async function getQuestionList(body?: Partial) {
- console.log("body" , body)
- if (!body?.quiz_id) return null;
-
- const response = await makeRequest({
- url: `${baseUrl}/question/getList`,
- body: { ...defaultGetQuestionListBody, ...body },
- method: "POST",
- });
-
- return response.items;
-}
-
-function editQuestion(body: EditQuestionRequest, signal?: AbortSignal) {
- return makeRequest({
- url: `${baseUrl}/question/edit`,
- body,
- method: "PATCH",
- signal,
- });
-}
-
-function copyQuestion(questionId: number, quizId: number) {
- return makeRequest({
- url: `${baseUrl}/question/copy`,
- body: { id: questionId, quiz_id: quizId },
- method: "POST",
- });
-}
-
-function deleteQuestion(id: number) {
- return makeRequest({
- url: `${baseUrl}/question/delete`,
- body: { id },
- method: "DELETE",
- });
-}
-
-export const questionApi = {
- create: createQuestion,
- getList: getQuestionList,
- edit: editQuestion,
- copy: copyQuestion,
- delete: deleteQuestion,
-};
-
-
-const defaultGetQuestionListBody: GetQuestionListRequest = {
- "limit": 100,
- "offset": 0,
- "type": "",
-};
diff --git a/src/api/quiz.ts b/src/api/quiz.ts
deleted file mode 100644
index 140aab1..0000000
--- a/src/api/quiz.ts
+++ /dev/null
@@ -1,118 +0,0 @@
-import { makeRequest } from "@frontend/kitui";
-import { defaultQuizConfig } from "@model/quizSettings";
-import { CopyQuizRequest, CopyQuizResponse } from "model/quiz/copy";
-import { CreateQuizRequest } from "model/quiz/create";
-import { DeleteQuizRequest, DeleteQuizResponse } from "model/quiz/delete";
-import { EditQuizRequest, EditQuizResponse } from "model/quiz/edit";
-import { GetQuizRequest, GetQuizResponse } from "model/quiz/get";
-import { GetQuizListRequest, GetQuizListResponse } from "model/quiz/getList";
-import { RawQuiz } from "model/quiz/quiz";
-
-
-const baseUrl = process.env.NODE_ENV === "production" ? "/squiz" : "https://squiz.pena.digital/squiz";
-const imagesUrl = process.env.NODE_ENV === "production" ? "/squizstorer" : "https://squiz.pena.digital/squizstorer";
-
-function createQuiz(body?: Partial) {
- return makeRequest({
- url: `${baseUrl}/quiz/create`,
- body: { ...defaultCreateQuizBody, ...body },
- method: "POST",
- });
-}
-
-async function getQuizList(body?: Partial) {
- const response = await makeRequest({
- url: `${baseUrl}/quiz/getList`,
- body: { ...defaultGetQuizListBody, ...body },
- method: "POST",
- });
-
- return response.items;
-}
-
-function getQuiz(body?: Partial) {
- return makeRequest({
- url: `${baseUrl}/quiz/get`,
- body: { ...defaultGetQuizBody, ...body },
- method: "GET",
- });
-}
-
-async function editQuiz(body: EditQuizRequest, signal?: AbortSignal) {
- return makeRequest({
- url: `${baseUrl}/quiz/edit`,
- body,
- method: "PATCH",
- signal,
- });
-}
-
-function copyQuiz(id: number) {
- return makeRequest({
- url: `${baseUrl}/quiz/copy`,
- body: { id },
- method: "POST",
- });
-}
-
-function deleteQuiz(id: number) {
- return makeRequest({
- url: `${baseUrl}/quiz/delete`,
- body: { id },
- method: "DELETE",
- });
-}
-
-function addQuizImages(quizId: number, image: Blob) {
- const formData = new FormData();
-
- formData.append("quiz", quizId.toString());
- formData.append("image", image);
-
- return makeRequest({
- url: `${imagesUrl}/quiz/putImages`,
- body: formData,
- method: "PUT",
- });
-}
-
-export const quizApi = {
- create: createQuiz,
- getList: getQuizList,
- get: getQuiz,
- edit: editQuiz,
- copy: copyQuiz,
- delete: deleteQuiz,
- addImages: addQuizImages,
-};
-
-
-const defaultCreateQuizBody: CreateQuizRequest = {
- "fingerprinting": true,
- "repeatable": true,
- "note_prevented": true,
- "mail_notifications": false,
- "unique_answers": true,
- "name": "",
- "description": "",
- "config": JSON.stringify(defaultQuizConfig),
- "status": "stop",
- "limit": 0,
- "due_to": 0,
- "time_of_passing": 0,
- "pausable": false,
- "super": false,
- "group_id": 0,
-};
-
-const defaultGetQuizBody: GetQuizRequest = {
- "quiz_id": "string",
- "limit": 0,
- "page": 0,
- "need_config": true,
-};
-
-const defaultGetQuizListBody: GetQuizListRequest = {
- "limit": 100,
- "offset": 0,
-};
diff --git a/src/assets/card-1.png b/src/assets/card-1.png
old mode 100644
new mode 100755
diff --git a/src/assets/card-2.png b/src/assets/card-2.png
old mode 100644
new mode 100755
diff --git a/src/assets/card-3.png b/src/assets/card-3.png
old mode 100644
new mode 100755
diff --git a/src/assets/icons/AlignLeftIcon.tsx b/src/assets/icons/AlignLeftIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/AlignRightIcon.tsx b/src/assets/icons/AlignRightIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/ArrowDownIcon.tsx b/src/assets/icons/ArrowDownIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/BackArrowIcon.tsx b/src/assets/icons/BackArrowIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/ChartIcon.tsx b/src/assets/icons/ChartIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/ChartPieIcon.tsx b/src/assets/icons/ChartPieIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/CollapseMenuIcon.tsx b/src/assets/icons/CollapseMenuIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/ContactBookIcon.tsx b/src/assets/icons/ContactBookIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/ExpandIcon.tsx b/src/assets/icons/ExpandIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/EyeIcon.tsx b/src/assets/icons/EyeIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/FlowArrowIcon.tsx b/src/assets/icons/FlowArrowIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/GearIcon.tsx b/src/assets/icons/GearIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/InfoIcon.tsx b/src/assets/icons/InfoIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/LayoutCenteredIcon.tsx b/src/assets/icons/LayoutCenteredIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/LayoutExpandedIcon.tsx b/src/assets/icons/LayoutExpandedIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/LayoutIcon.tsx b/src/assets/icons/LayoutIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/LayoutIconBig.tsx b/src/assets/icons/LayoutIconBig.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/LayoutStandartIcon.tsx b/src/assets/icons/LayoutStandartIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/LinkIcon.tsx b/src/assets/icons/LinkIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/LogoutIcon.tsx b/src/assets/icons/LogoutIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/MegaphoneIcon.tsx b/src/assets/icons/MegaphoneIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/MobilePhoneIcon.tsx b/src/assets/icons/MobilePhoneIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/PencilCircleIcon.tsx b/src/assets/icons/PencilCircleIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/PencilIcon.tsx b/src/assets/icons/PencilIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/PuzzlePieceIcon.tsx b/src/assets/icons/PuzzlePieceIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/QuestionIcon.tsx b/src/assets/icons/QuestionIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/SearchIcon.tsx b/src/assets/icons/SearchIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/SendIcon.tsx b/src/assets/icons/SendIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/TagIcon.tsx b/src/assets/icons/TagIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/UploadIcon.tsx b/src/assets/icons/UploadIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/WalletIcon.tsx b/src/assets/icons/WalletIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/questionsPage/CopyIcon.tsx b/src/assets/icons/questionsPage/CopyIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/questionsPage/OneIcon.tsx b/src/assets/icons/questionsPage/OneIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/questionsPage/PointsIcon.tsx b/src/assets/icons/questionsPage/PointsIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/questionsPage/addPlus.tsx b/src/assets/icons/questionsPage/addPlus.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/questionsPage/answer.tsx b/src/assets/icons/questionsPage/answer.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/questionsPage/arrowLeft.tsx b/src/assets/icons/questionsPage/arrowLeft.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/questionsPage/branching.tsx b/src/assets/icons/questionsPage/branching.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/questionsPage/clue.tsx b/src/assets/icons/questionsPage/clue.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/questionsPage/date.tsx b/src/assets/icons/questionsPage/date.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/questionsPage/deleteIcon.tsx b/src/assets/icons/questionsPage/deleteIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/questionsPage/download.tsx b/src/assets/icons/questionsPage/download.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/questionsPage/drop_down.tsx b/src/assets/icons/questionsPage/drop_down.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/questionsPage/emoji.tsx b/src/assets/icons/questionsPage/emoji.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/questionsPage/enterIcon.tsx b/src/assets/icons/questionsPage/enterIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/questionsPage/hideIcon.tsx b/src/assets/icons/questionsPage/hideIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/questionsPage/imgIcon.tsx b/src/assets/icons/questionsPage/imgIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/questionsPage/input.tsx b/src/assets/icons/questionsPage/input.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/questionsPage/options_and_pict.tsx b/src/assets/icons/questionsPage/options_and_pict.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/questionsPage/options_pict.tsx b/src/assets/icons/questionsPage/options_pict.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/questionsPage/page.tsx b/src/assets/icons/questionsPage/page.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/questionsPage/rating.tsx b/src/assets/icons/questionsPage/rating.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/questionsPage/settingIcon.tsx b/src/assets/icons/questionsPage/settingIcon.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/icons/questionsPage/slider.tsx b/src/assets/icons/questionsPage/slider.tsx
old mode 100644
new mode 100755
diff --git a/src/assets/quiz-creation-1.png b/src/assets/quiz-creation-1.png
old mode 100644
new mode 100755
diff --git a/src/assets/quiz-creation-2.png b/src/assets/quiz-creation-2.png
old mode 100644
new mode 100755
diff --git a/src/assets/quiz-template-1.png b/src/assets/quiz-template-1.png
old mode 100644
new mode 100755
diff --git a/src/assets/quiz-template-2.png b/src/assets/quiz-template-2.png
old mode 100644
new mode 100755
diff --git a/src/assets/quiz-template-3.png b/src/assets/quiz-template-3.png
old mode 100644
new mode 100755
diff --git a/src/assets/quiz-template-4.png b/src/assets/quiz-template-4.png
old mode 100644
new mode 100755
diff --git a/src/assets/quiz-template-5.png b/src/assets/quiz-template-5.png
old mode 100644
new mode 100755
diff --git a/src/assets/quiz-template-6.png b/src/assets/quiz-template-6.png
old mode 100644
new mode 100755
diff --git a/src/constants/base.ts b/src/constants/base.ts
deleted file mode 100644
index 77feb97..0000000
--- a/src/constants/base.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import type { QuizQuestionBase, QuestionBranchingRuleMain } from "../model/questionTypes/shared";
-
-
-export const QUIZ_QUESTION_BASE: Omit = {
- quizId: 0,
- description: "",
- page: 0,
- title: "",
- expanded: true,
- openedModalSettings: false,
- deleted: false,
- deleteTimeoutId: 0,
- content: {
- id: "",
- hint: {
- text: "",
- video: "",
- },
- rule: {
- children: [],
- main: [] as QuestionBranchingRuleMain[],
- parentId: "",
- default: ""
- },
- back: "",
- originalBack: "",
- autofill: false,
- },
-};
diff --git a/src/constants/date.ts b/src/constants/date.ts
deleted file mode 100644
index 6455fac..0000000
--- a/src/constants/date.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import { QUIZ_QUESTION_BASE } from "./base";
-
-import type { QuizQuestionDate } from "../model/questionTypes/date";
-
-export const QUIZ_QUESTION_DATE: Omit = {
- ...QUIZ_QUESTION_BASE,
- type: "date",
- content: {
- ...QUIZ_QUESTION_BASE.content,
- required: false,
- innerNameCheck: false,
- innerName: "",
- dateRange: false,
- time: false,
- },
-};
diff --git a/src/constants/default.ts b/src/constants/default.ts
deleted file mode 100644
index f3bcd48..0000000
--- a/src/constants/default.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import { QuestionType } from "@model/question/question";
-import { AnyTypedQuizQuestion } from "@model/questionTypes/shared";
-import { QUIZ_QUESTION_DATE } from "./date";
-import { QUIZ_QUESTION_EMOJI } from "./emoji";
-import { QUIZ_QUESTION_FILE } from "./file";
-import { QUIZ_QUESTION_IMAGES } from "./images";
-import { QUIZ_QUESTION_NUMBER } from "./number";
-import { QUIZ_QUESTION_PAGE } from "./page";
-import { QUIZ_QUESTION_RATING } from "./rating";
-import { QUIZ_QUESTION_SELECT } from "./select";
-import { QUIZ_QUESTION_TEXT } from "./text";
-import { QUIZ_QUESTION_VARIANT } from "./variant";
-import { QUIZ_QUESTION_VARIMG } from "./varimg";
-import { QUIZ_QUESTION_RESULT } from "./result";
-
-
-export const defaultQuestionByType: Record> = {
- "date": QUIZ_QUESTION_DATE,
- "emoji": QUIZ_QUESTION_EMOJI,
- "file": QUIZ_QUESTION_FILE,
- "images": QUIZ_QUESTION_IMAGES,
- "number": QUIZ_QUESTION_NUMBER,
- "page": QUIZ_QUESTION_PAGE,
- "rating": QUIZ_QUESTION_RATING,
- "select": QUIZ_QUESTION_SELECT,
- "text": QUIZ_QUESTION_TEXT,
- "variant": QUIZ_QUESTION_VARIANT,
- "varimg": QUIZ_QUESTION_VARIMG,
- "result": QUIZ_QUESTION_RESULT,
-} as const;
diff --git a/src/constants/emoji.ts b/src/constants/emoji.ts
deleted file mode 100644
index fea13ba..0000000
--- a/src/constants/emoji.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { QUIZ_QUESTION_BASE } from "./base";
-
-import type { QuizQuestionEmoji } from "../model/questionTypes/emoji";
-import { nanoid } from "nanoid";
-
-export const QUIZ_QUESTION_EMOJI: Omit = {
- ...QUIZ_QUESTION_BASE,
- type: "emoji",
- content: {
- ...QUIZ_QUESTION_BASE.content,
- multi: false,
- own: false,
- innerNameCheck: false,
- innerName: "",
- required: false,
- variants: [
- {
- id: nanoid(),
- answer: "",
- extendedText: "",
- hints: "",
- originalImageUrl: "",
- },
- ],
- },
-};
diff --git a/src/constants/file.ts b/src/constants/file.ts
deleted file mode 100644
index 8e36b23..0000000
--- a/src/constants/file.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { QUIZ_QUESTION_BASE } from "./base";
-
-import type { QuizQuestionFile } from "../model/questionTypes/file";
-
-export const QUIZ_QUESTION_FILE: Omit = {
- ...QUIZ_QUESTION_BASE,
- type: "file",
- content: {
- ...QUIZ_QUESTION_BASE.content,
- required: false,
- innerNameCheck: false,
- innerName: "",
- type: "picture",
- },
-};
diff --git a/src/constants/images.ts b/src/constants/images.ts
deleted file mode 100644
index dd92dc9..0000000
--- a/src/constants/images.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import { QUIZ_QUESTION_BASE } from "./base";
-
-import type { QuizQuestionImages } from "../model/questionTypes/images";
-import { nanoid } from "nanoid";
-
-export const QUIZ_QUESTION_IMAGES: Omit = {
- ...QUIZ_QUESTION_BASE,
- type: "images",
- content: {
- ...QUIZ_QUESTION_BASE.content,
- own: false,
- multi: false,
- xy: "1:1",
- innerNameCheck: false,
- innerName: "",
- large: false,
- format: "carousel",
- required: false,
- variants: [
- {
- id: nanoid(),
- answer: "",
- extendedText: "",
- originalImageUrl: "",
- hints: ""
- },
- ],
- largeCheck: false,
- },
-};
diff --git a/src/constants/number.ts b/src/constants/number.ts
deleted file mode 100644
index 96cbd5a..0000000
--- a/src/constants/number.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import { QUIZ_QUESTION_BASE } from "./base";
-
-import type { QuizQuestionNumber } from "../model/questionTypes/number";
-
-export const QUIZ_QUESTION_NUMBER: Omit = {
- ...QUIZ_QUESTION_BASE,
- type: "number",
- content: {
- ...QUIZ_QUESTION_BASE.content,
- required: false,
- innerNameCheck: false,
- innerName: "",
- range: "1—100",
- defaultValue: 0,
- step: 1,
- steps: 5,
- start: 50,
- chooseRange: false,
- form: "star",
- },
-};
diff --git a/src/constants/page.ts b/src/constants/page.ts
deleted file mode 100644
index 5fbb296..0000000
--- a/src/constants/page.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { QUIZ_QUESTION_BASE } from "./base";
-
-import type { QuizQuestionPage } from "../model/questionTypes/page";
-
-export const QUIZ_QUESTION_PAGE: Omit = {
- ...QUIZ_QUESTION_BASE,
- type: "page",
- content: {
- ...QUIZ_QUESTION_BASE.content,
- innerNameCheck: false,
- innerName: "",
- text: "",
- picture: "",
- originalPicture: "",
- video: "",
- },
-};
diff --git a/src/constants/rating.ts b/src/constants/rating.ts
deleted file mode 100644
index cef8bc2..0000000
--- a/src/constants/rating.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { QUIZ_QUESTION_BASE } from "./base";
-
-import type { QuizQuestionRating } from "../model/questionTypes/rating";
-
-export const QUIZ_QUESTION_RATING: Omit = {
- ...QUIZ_QUESTION_BASE,
- type: "rating",
- content: {
- ...QUIZ_QUESTION_BASE.content,
- required: false,
- innerNameCheck: false,
- innerName: "",
- steps: 5,
- ratingExpanded: false,
- form: "star",
- ratingNegativeDescription: "",
- ratingPositiveDescription: "",
- },
-};
diff --git a/src/constants/result.ts b/src/constants/result.ts
deleted file mode 100644
index b9f4015..0000000
--- a/src/constants/result.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { QUIZ_QUESTION_BASE } from "./base";
-
-import type { QuizQuestionResult } from "../model/questionTypes/result";
-import { nanoid } from "nanoid";
-
-export const QUIZ_QUESTION_RESULT: Omit = {
- ...QUIZ_QUESTION_BASE,
- type: "result",
- content: {
- ...QUIZ_QUESTION_BASE.content,
- video: "",
- innerName: "",
- text: "",
- price: [0],
- useImage: true
- },
-};
diff --git a/src/constants/select.ts b/src/constants/select.ts
deleted file mode 100644
index ff8de24..0000000
--- a/src/constants/select.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { QUIZ_QUESTION_BASE } from "./base";
-
-import type { QuizQuestionSelect } from "../model/questionTypes/select";
-import { nanoid } from "nanoid";
-
-export const QUIZ_QUESTION_SELECT: Omit = {
- ...QUIZ_QUESTION_BASE,
- type: "select",
- content: {
- ...QUIZ_QUESTION_BASE.content,
- multi: false,
- required: false,
- innerNameCheck: false,
- innerName: "",
- default: "",
- variants: [{ id: nanoid(), answer: "", extendedText: "", hints: "", originalImageUrl: "" }],
- },
-};
diff --git a/src/constants/text.ts b/src/constants/text.ts
deleted file mode 100644
index a64c4f9..0000000
--- a/src/constants/text.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { QUIZ_QUESTION_BASE } from "./base";
-
-import type { QuizQuestionText } from "../model/questionTypes/text";
-
-export const QUIZ_QUESTION_TEXT: Omit = {
- ...QUIZ_QUESTION_BASE,
- type: "text",
- content: {
- ...QUIZ_QUESTION_BASE.content,
- placeholder: "",
- innerNameCheck: false,
- innerName: "",
- required: false,
- answerType: "single",
- onlyNumbers: false,
- },
-};
diff --git a/src/constants/variant.ts b/src/constants/variant.ts
deleted file mode 100644
index eaca719..0000000
--- a/src/constants/variant.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { QUIZ_QUESTION_BASE } from "./base";
-
-import type { QuizQuestionVariant } from "../model/questionTypes/variant";
-import { nanoid } from "nanoid";
-
-export const QUIZ_QUESTION_VARIANT: Omit = {
- ...QUIZ_QUESTION_BASE,
- type: "variant",
- content: {
- ...QUIZ_QUESTION_BASE.content,
- largeCheck: false,
- multi: false,
- own: false,
- innerNameCheck: false,
- required: false,
- innerName: "",
- variants: [{ id: nanoid(), answer: "", extendedText: "", hints: "", originalImageUrl: "" }],
- },
-};
diff --git a/src/constants/varimg.ts b/src/constants/varimg.ts
deleted file mode 100644
index ef97133..0000000
--- a/src/constants/varimg.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { QUIZ_QUESTION_BASE } from "./base";
-
-import type { QuizQuestionVarImg } from "../model/questionTypes/varimg";
-import { nanoid } from "nanoid";
-
-export const QUIZ_QUESTION_VARIMG: Omit = {
- ...QUIZ_QUESTION_BASE,
- type: "varimg",
- content: {
- ...QUIZ_QUESTION_BASE.content,
- own: false,
- innerNameCheck: false,
- innerName: "",
- required: false,
- variants: [{ id: nanoid(), answer: "", hints: "", extendedText: "", originalImageUrl: "" }],
- largeCheck: false,
- replText: "",
- },
-};
diff --git a/src/index.css b/src/index.css
old mode 100644
new mode 100755
diff --git a/src/index.tsx b/src/index.tsx
old mode 100644
new mode 100755
index 604a3d2..20b0030
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -1,44 +1,43 @@
import { CssBaseline, ThemeProvider } from "@mui/material";
import { LocalizationProvider } from "@mui/x-date-pickers";
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
-import { ruRU } from "@mui/x-date-pickers/locales";
+import { ruRU } from '@mui/x-date-pickers/locales';
import App from "./App";
import dayjs from "dayjs";
import "dayjs/locale/ru";
-import { SnackbarProvider } from "notistack";
+import { SnackbarProvider } from 'notistack';
import { createRoot } from "react-dom/client";
import "./index.css";
import lightTheme from "./utils/themes/light";
import { SWRConfig } from "swr";
+import {BrowserRouter} from "react-router-dom";
+
+
dayjs.locale("ru");
-const localeText =
- ruRU.components.MuiLocalizationProvider.defaultProps.localeText;
+const localeText = ruRU.components.MuiLocalizationProvider.defaultProps.localeText;
const root = createRoot(document.getElementById("root")!);
root.render(
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
);
diff --git a/src/model/question/copy.ts b/src/model/question/copy.ts
deleted file mode 100644
index 834f245..0000000
--- a/src/model/question/copy.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-export interface CopyQuestionRequest {
- id: number;
- quiz_id: number;
-}
-
-export interface CopyQuestionResponse {
- updated: number;
-}
diff --git a/src/model/question/create.ts b/src/model/question/create.ts
deleted file mode 100644
index 89190b6..0000000
--- a/src/model/question/create.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { QuestionType } from "./question";
-
-
-export interface CreateQuestionRequest {
- /** id of quiz for what question is creating */
- quiz_id: number;
- /** title of question. max length 512 */
- title: string;
- /** description of question. html/text */
- description: string;
- /** type of question. allow only text, select, file, variant, images, varimg, emoji, date, number, page, rating */
- type: QuestionType;
- /** set true if user MUST answer this question */
- required: boolean;
- /** page of question */
- page: number;
- /** json serialized of question content settings */
- content: string;
-}
diff --git a/src/model/question/delete.ts b/src/model/question/delete.ts
deleted file mode 100644
index 441bacf..0000000
--- a/src/model/question/delete.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-export interface DeleteQuestionRequest {
- id: number;
-}
-
-export interface DeleteQuestionResponse {
- deactivated: number;
-}
diff --git a/src/model/question/edit.ts b/src/model/question/edit.ts
deleted file mode 100644
index 498e652..0000000
--- a/src/model/question/edit.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { AnyTypedQuizQuestion } from "@model/questionTypes/shared";
-import { QuestionType } from "./question";
-
-
-export interface EditQuestionRequest {
- id: number;
- title?: string;
- desc?: string;
- type?: QuestionType;
- required?: boolean;
- page?: number;
- content: string;
-}
-
-export interface EditQuestionResponse {
- updated: number;
-}
-
-export function questionToEditQuestionRequest(question: AnyTypedQuizQuestion): EditQuestionRequest {
- return {
- id: question.backendId,
- title: question.title,
- desc: question.description,
- type: question.type,
- required: "required" in question.content ? question.content.required : false,
- page: question.page,
- content: JSON.stringify(question.content),
- };
-}
diff --git a/src/model/question/getList.ts b/src/model/question/getList.ts
deleted file mode 100644
index a0af41b..0000000
--- a/src/model/question/getList.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import { QuestionType, RawQuestion } from "./question";
-
-
-export interface GetQuestionListRequest {
- /** max items on page */
- limit?: number;
- /** page number */
- offset?: number;
- /** start time of time period. timestamp in seconds */
- from?: number;
- /** end time of time period. timestamp in seconds */
- to?: number;
- /** string for fulltext search in titles of questions */
- search?: string;
- /** allow only - text, select, file, variant, images, varimg, emoji, date, number, page, rating or empty string */
- type: "" | QuestionType;
- /** get deleted quizes */
- deleted?: boolean;
- /** get only require questions */
- required?: boolean;
- /** relation to quiz */
- quiz_id?: number;
-}
-
-export interface GetQuestionListResponse {
- count: number;
- items: RawQuestion[] | null;
-}
diff --git a/src/model/question/question.ts b/src/model/question/question.ts
deleted file mode 100644
index 0a61942..0000000
--- a/src/model/question/question.ts
+++ /dev/null
@@ -1,74 +0,0 @@
-import { AnyTypedQuizQuestion } from "@model/questionTypes/shared";
-import { defaultQuestionByType } from "../../constants/default";
-import { nanoid } from "nanoid";
-
-
-export type QuestionType =
- | "variant"
- | "images"
- | "varimg"
- | "emoji"
- | "text"
- | "select"
- | "date"
- | "number"
- | "file"
- | "page"
- | "rating"
- | "result";
-
-/** Type that comes from server */
-export interface RawQuestion {
- /** Id of created question */
- id: number;
- /** relation to quiz */
- quiz_id: number;
- /** title of question. max 512 length */
- title: string;
- /** description of question */
- description: string;
- /** status of question. allow only text, select, file, variant, images, varimg, emoji, date, number, page, rating */
- type: QuestionType;
- /** user must pass this question */
- required: boolean;
- /** true if question is deleted */
- deleted: boolean;
- /** page if question */
- page: number;
- /** serialized json of created question */
- content: string;
- /** version of quiz */
- version: number;
- /** array of previous versions of quiz */
- parent_ids: number[];
- created_at: string;
- updated_at: string;
-}
-
-export function rawQuestionToQuestion(rawQuestion: RawQuestion): AnyTypedQuizQuestion {
- let content = defaultQuestionByType[rawQuestion.type].content;
- const frontId = nanoid()
-
- try {
- content = JSON.parse(rawQuestion.content);
- if (content.id.length === 0 || content.id.length === undefined) content.id = frontId
- } catch (error) {
- console.warn("Cannot parse question content from string, using default content", error);
- }
-
- return {
- backendId: rawQuestion.id,
- id: frontId,
- description: rawQuestion.description,
- page: rawQuestion.page,
- quizId: rawQuestion.quiz_id,
- required: rawQuestion.required,
- title: rawQuestion.title,
- type: rawQuestion.type,
- expanded: true,
- openedModalSettings: false,
- deleted: false,
- deleteTimeoutId: 0,
- content,
- } as AnyTypedQuizQuestion;
-}
diff --git a/src/model/questionTypes/date.ts b/src/model/questionTypes/date.ts
index 651550e..2b905e8 100644
--- a/src/model/questionTypes/date.ts
+++ b/src/model/questionTypes/date.ts
@@ -7,7 +7,6 @@ import type {
export interface QuizQuestionDate extends QuizQuestionBase {
type: "date";
content: {
- id: string;
/** Чекбокс "Необязательный вопрос" */
required: boolean;
/** Чекбокс "Внутреннее название вопроса" */
diff --git a/src/model/questionTypes/emoji.ts b/src/model/questionTypes/emoji.ts
index 7fa34a1..4a9f7ef 100644
--- a/src/model/questionTypes/emoji.ts
+++ b/src/model/questionTypes/emoji.ts
@@ -8,7 +8,6 @@ import type {
export interface QuizQuestionEmoji extends QuizQuestionBase {
type: "emoji";
content: {
- id: string;
/** Чекбокс "Можно несколько" */
multi: boolean;
/** Чекбокс "Вариант "свой ответ"" */
diff --git a/src/model/questionTypes/file.ts b/src/model/questionTypes/file.ts
index 51a748a..d1a6981 100644
--- a/src/model/questionTypes/file.ts
+++ b/src/model/questionTypes/file.ts
@@ -17,7 +17,6 @@ export type UploadFileType = keyof typeof UPLOAD_FILE_TYPES_MAP;
export interface QuizQuestionFile extends QuizQuestionBase {
type: "file";
content: {
- id: string;
/** Чекбокс "Необязательный вопрос" */
required: boolean;
/** Чекбокс "Внутреннее название вопроса" */
diff --git a/src/model/questionTypes/images.ts b/src/model/questionTypes/images.ts
index 8ed2a33..a65f6ba 100644
--- a/src/model/questionTypes/images.ts
+++ b/src/model/questionTypes/images.ts
@@ -6,32 +6,31 @@ import type {
} from "./shared";
export interface QuizQuestionImages extends QuizQuestionBase {
- type: "images";
- content: {
- id: string;
- /** Чекбокс "Вариант "свой ответ"" */
- own: boolean;
- /** Чекбокс "Можно несколько" */
- multi: boolean;
- /** Пропорции */
- xy: "1:1" | "1:2" | "2:1";
- /** Чекбокс "Внутреннее название вопроса" */
- innerNameCheck: boolean;
- /** Поле "Внутреннее название вопроса" */
- innerName: string;
- /** Чекбокс "Большие картинки" */
- large: boolean;
- /** Форма */
- format: "carousel" | "masonry";
- /** Чекбокс "Необязательный вопрос" */
- required: boolean;
- /** Варианты (картинки) */
- variants: QuestionVariant[];
- hint: QuestionHint;
- rule: QuestionBranchingRule;
- back: string;
- originalBack: string;
- autofill: boolean;
- largeCheck: boolean;
- };
+ type: "images";
+ content: {
+ /** Чекбокс "Вариант "свой ответ"" */
+ own: boolean;
+ /** Чекбокс "Можно несколько" */
+ multi: boolean;
+ /** Пропорции */
+ xy: "1:1" | "1:2" | "2:1";
+ /** Чекбокс "Внутреннее название вопроса" */
+ innerNameCheck: boolean;
+ /** Поле "Внутреннее название вопроса" */
+ innerName: string;
+ /** Чекбокс "Большие картинки" */
+ large: boolean;
+ /** Форма */
+ format: "carousel" | "masonry";
+ /** Чекбокс "Необязательный вопрос" */
+ required: boolean;
+ /** Варианты (картинки) */
+ variants: QuestionVariant[];
+ hint: QuestionHint;
+ rule: QuestionBranchingRule;
+ back: string;
+ originalBack: string;
+ autofill: boolean;
+ largeCheck: boolean;
+ };
}
diff --git a/src/model/questionTypes/number.ts b/src/model/questionTypes/number.ts
index 530db03..68f1370 100644
--- a/src/model/questionTypes/number.ts
+++ b/src/model/questionTypes/number.ts
@@ -7,7 +7,6 @@ import type {
export interface QuizQuestionNumber extends QuizQuestionBase {
type: "number";
content: {
- id: string;
/** Чекбокс "Необязательный вопрос" */
required: boolean;
/** Чекбокс "Внутреннее название вопроса" */
diff --git a/src/model/questionTypes/page.ts b/src/model/questionTypes/page.ts
index 6b1d559..9f829c8 100644
--- a/src/model/questionTypes/page.ts
+++ b/src/model/questionTypes/page.ts
@@ -7,7 +7,6 @@ import type {
export interface QuizQuestionPage extends QuizQuestionBase {
type: "page";
content: {
- id: string;
/** Чекбокс "Внутреннее название вопроса" */
innerNameCheck: boolean;
/** Поле "Внутреннее название вопроса" */
diff --git a/src/model/questionTypes/rating.ts b/src/model/questionTypes/rating.ts
index 2626077..2f73ef1 100644
--- a/src/model/questionTypes/rating.ts
+++ b/src/model/questionTypes/rating.ts
@@ -7,7 +7,6 @@ import type {
export interface QuizQuestionRating extends QuizQuestionBase {
type: "rating";
content: {
- id: string;
/** Чекбокс "Необязательный вопрос" */
required: boolean;
/** Чекбокс "Внутреннее название вопроса" */
diff --git a/src/model/questionTypes/result.ts b/src/model/questionTypes/result.ts
index 7636bd3..782ed0d 100644
--- a/src/model/questionTypes/result.ts
+++ b/src/model/questionTypes/result.ts
@@ -7,7 +7,6 @@ import type {
export interface QuizQuestionResult extends QuizQuestionBase {
type: "result";
content: {
- id: string;
back: string;
originalBack: string;
video: string;
diff --git a/src/model/questionTypes/select.ts b/src/model/questionTypes/select.ts
index 3145b80..f74cfdb 100644
--- a/src/model/questionTypes/select.ts
+++ b/src/model/questionTypes/select.ts
@@ -8,7 +8,6 @@ import type {
export interface QuizQuestionSelect extends QuizQuestionBase {
type: "select";
content: {
- id: string;
/** Чекбокс "Можно несколько" */
multi: boolean;
/** Чекбокс "Необязательный вопрос" */
diff --git a/src/model/questionTypes/shared.ts b/src/model/questionTypes/shared.ts
index 2d95ac3..85b563e 100644
--- a/src/model/questionTypes/shared.ts
+++ b/src/model/questionTypes/shared.ts
@@ -1,4 +1,3 @@
-import { QuestionType } from "@model/question/question";
import type { QuizQuestionDate } from "./date";
import type { QuizQuestionEmoji } from "./emoji";
import type { QuizQuestionFile } from "./file";
@@ -49,8 +48,21 @@ export type QuestionVariant = {
originalImageUrl: string;
};
+export type QuestionType =
+ | "variant"
+ | "images"
+ | "varimg"
+ | "emoji"
+ | "text"
+ | "select"
+ | "date"
+ | "number"
+ | "file"
+ | "page"
+ | "rating"
+ | "result";
+
export interface QuizQuestionBase {
- backendId: number;
/** Stable id, generated on client */
id: string;
quizId: number;
@@ -61,9 +73,9 @@ export interface QuizQuestionBase {
expanded: boolean;
openedModalSettings: boolean;
deleted: boolean;
+ required: boolean;
deleteTimeoutId: number;
content: {
- id: string;
hint: QuestionHint;
rule: QuestionBranchingRule;
back: string;
@@ -72,15 +84,6 @@ export interface QuizQuestionBase {
};
}
-export interface UntypedQuizQuestion {
- type: null;
- id: string;
- quizId: number;
- title: string;
- description: string;
- expanded: boolean;
- deleted: boolean;
-}
export type AnyTypedQuizQuestion =
| QuizQuestionVariant
@@ -96,6 +99,8 @@ export type AnyTypedQuizQuestion =
| QuizQuestionRating
| QuizQuestionResult;
+
+
type FilterQuestionsWithVariants = T extends {
content: { variants: QuestionVariant[]; };
} ? T : never;
diff --git a/src/model/questionTypes/text.ts b/src/model/questionTypes/text.ts
index 610bad5..351f732 100644
--- a/src/model/questionTypes/text.ts
+++ b/src/model/questionTypes/text.ts
@@ -7,7 +7,7 @@ import type {
export interface QuizQuestionText extends QuizQuestionBase {
type: "text";
content: {
- id: string;
+ id: number;
placeholder: string;
/** Чекбокс "Внутреннее название вопроса" */
innerNameCheck: boolean;
diff --git a/src/model/questionTypes/variant.ts b/src/model/questionTypes/variant.ts
index 54f457d..32c0c4b 100644
--- a/src/model/questionTypes/variant.ts
+++ b/src/model/questionTypes/variant.ts
@@ -8,7 +8,6 @@ import type {
export interface QuizQuestionVariant extends QuizQuestionBase {
type: "variant";
content: {
- id: string;
/** Чекбокс "Длинный текстовый ответ" */
largeCheck: boolean;
/** Чекбокс "Можно несколько" */
diff --git a/src/model/questionTypes/varimg.ts b/src/model/questionTypes/varimg.ts
index 6d274d3..dd51c8d 100644
--- a/src/model/questionTypes/varimg.ts
+++ b/src/model/questionTypes/varimg.ts
@@ -8,7 +8,6 @@ import type {
export interface QuizQuestionVarImg extends QuizQuestionBase {
type: "varimg";
content: {
- id: string;
/** Чекбокс "Вариант "свой ответ"" */
own: boolean;
/** Чекбокс "Внутреннее название вопроса" */
diff --git a/src/model/quiz/copy.ts b/src/model/quiz/copy.ts
deleted file mode 100644
index 804777c..0000000
--- a/src/model/quiz/copy.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-export interface CopyQuizRequest {
- id: number;
-}
-
-export interface CopyQuizResponse {
- updated: number;
-}
diff --git a/src/model/quiz/create.ts b/src/model/quiz/create.ts
deleted file mode 100644
index c4271a7..0000000
--- a/src/model/quiz/create.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-export interface CreateQuizRequest {
- /** set true for save deviceId */
- fingerprinting: boolean;
- /** set true for allow user to repeat quiz */
- repeatable: boolean;
- /** set true for save statistic of incomplete quiz passing */
- note_prevented: boolean;
- /** set true for mail notification for each quiz passing */
- mail_notifications: boolean;
- /** set true for save statistics only for unique quiz passing */
- unique_answers: boolean;
- /** name of quiz. max 280 length */
- name: string;
- /** description of quiz */
- description: string;
- /** config of quiz. serialized json for rules of quiz flow */
- config: string;
- /** status of quiz. allow only '', 'draft', 'template', 'stop', 'start' */
- status: "draft" | "template" | "stop" | "start";
- /** limit is count of max quiz passing */
- limit: number;
- /** last time when quiz is valid. timestamp in seconds */
- due_to: number;
- /** seconds to pass quiz */
- time_of_passing: number;
- /** true if it is allowed for pause quiz */
- pausable: boolean;
- /** count of questions */
- question_cnt?: number;
- /** set true if squiz realize group functionality */
- super: boolean;
- /** group of new quiz */
- group_id: number;
-}
diff --git a/src/model/quiz/delete.ts b/src/model/quiz/delete.ts
deleted file mode 100644
index 3cc0717..0000000
--- a/src/model/quiz/delete.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-export interface DeleteQuizRequest {
- id: number;
-}
-
-export interface DeleteQuizResponse {
- deactivated: number;
-}
diff --git a/src/model/quiz/edit.ts b/src/model/quiz/edit.ts
deleted file mode 100644
index a548a38..0000000
--- a/src/model/quiz/edit.ts
+++ /dev/null
@@ -1,66 +0,0 @@
-import { Quiz } from "./quiz";
-
-
-export interface EditQuizRequest {
- /** id of question for update */
- id: number;
- /** set true for storing fingerprints */
- fp: boolean;
- /** set true for allow to repeat quiz after passing */
- rep: boolean;
- /** set true for store unfinished passing */
- note_prevented: boolean;
- /** set true if we should send passing result on every passing */
- mailing: boolean;
- /** set true if we allow only one user quiz passing */
- uniq: boolean;
- /** new name of the quiz */
- name?: string;
- /** new descriptions of the quiz */
- desc?: string;
- /** new config of the quiz */
- conf?: string;
- /** new status. only draft,template,stop,start allowed */
- status?: string;
- /** max amount of quiz passing */
- limit: number;
- /** max time of quiz passing */
- due_to: number;
- /** max time to pass quiz */
- time_of_passing: number;
- /** allow to pause quiz to user */
- pausable: boolean;
- /** count of questions */
- question_cnt?: number;
- /** set true if squiz realize group functionality */
- super?: boolean;
- /** group of new quiz */
- group_id?: number;
-}
-
-export interface EditQuizResponse {
- /** id of new version of question */
- updated: number;
-}
-
-export function quizToEditQuizRequest(quiz: Quiz): EditQuizRequest {
- return {
- id: quiz.backendId,
- fp: quiz.fingerprinting,
- rep: quiz.repeatable,
- note_prevented: quiz.note_prevented,
- mailing: quiz.mail_notifications,
- uniq: quiz.unique_answers,
- name: quiz.name,
- desc: quiz.description,
- conf: JSON.stringify(quiz.config),
- status: quiz.status,
- limit: quiz.limit,
- due_to: quiz.due_to,
- time_of_passing: quiz.time_of_passing,
- pausable: quiz.pausable,
- question_cnt: quiz.question_cnt,
- super: quiz.super,
- group_id: quiz.group_id,
- };
-}
diff --git a/src/model/quiz/get.ts b/src/model/quiz/get.ts
deleted file mode 100644
index 29988c7..0000000
--- a/src/model/quiz/get.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-export interface GetQuizRequest {
- quiz_id: string;
- limit: number;
- page: number;
- need_config: boolean;
-}
-
-export interface GetQuizResponse {
- cnt: number;
- settings: {
- fp: boolean;
- rep: boolean;
- name: string;
- cfg: string;
- lim: number;
- due: number;
- delay: number;
- pausable: boolean;
- };
- items: {
- id: number;
- title: string;
- desc: string;
- typ: string;
- req: boolean;
- p: number;
- c: string;
- }[];
-}
diff --git a/src/model/quiz/getList.ts b/src/model/quiz/getList.ts
deleted file mode 100644
index 3abed8a..0000000
--- a/src/model/quiz/getList.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { RawQuiz } from "./quiz";
-
-export interface GetQuizListRequest {
- /** max items on page */
- limit?: number;
- /** page number */
- offset?: number;
- /** start time of time period. timestamp in seconds */
- from?: number;
- /** end time of time period. timestamp in seconds */
- to?: number;
- /** string for fulltext search in titles of quizes */
- search?: string;
- /** allow only - draft, template, timeout, stop, start, offlimit */
- status?: "" | "draft" | "template" | "timeout" | "stop" | "start" | "offlimit";
- /** get deleted quizes */
- deleted?: boolean;
- /** get archived quizes */
- archived?: boolean;
- /** set true if squiz realize group functionality */
- super?: boolean;
- /** group of new quiz */
- group_id?: number;
-}
-
-export interface GetQuizListResponse {
- count: number;
- items: RawQuiz[];
-}
diff --git a/src/model/quiz/quiz.ts b/src/model/quiz/quiz.ts
deleted file mode 100644
index 0de02cd..0000000
--- a/src/model/quiz/quiz.ts
+++ /dev/null
@@ -1,133 +0,0 @@
-import { QuizConfig, defaultQuizConfig } from "@model/quizSettings";
-import { nanoid } from "nanoid";
-
-
-export interface Quiz {
- /** Stable id, generated on client */
- id: string;
- /** Id of created quiz */
- backendId: number;
- /** string id for customers */
- qid: string;
- /** true if quiz deleted */
- deleted: boolean;
- /** true if quiz archived */
- archived: boolean;
- /** set true for save deviceId */
- fingerprinting: boolean;
- /** set true for allow user to repeat quiz */
- repeatable: boolean;
- /** set true for save statistic of incomplete quiz passing */
- note_prevented: boolean;
- /** set true for mail notification for each quiz passing */
- mail_notifications: boolean;
- /** set true for save statistics only for unique quiz passing */
- unique_answers: boolean;
- /** name of quiz. max 280 length */
- name: string;
- /** description of quiz */
- description: string;
- /** quiz config*/
- config: QuizConfig;
- /** status of quiz. allow only '', 'draft', 'template', 'stop', 'start' */
- status: string;
- /** limit is count of max quiz passing */
- limit: number;
- /** last time when quiz is valid. timestamp in seconds */
- due_to: number;
- /** seconds to pass quiz */
- time_of_passing: number;
- /** true if it is allowed for pause quiz */
- pausable: boolean;
- /** version of quiz */
- version: number;
- /** version comment to version of quiz */
- version_comment: string;
- /** array of previous versions of quiz */
- parent_ids: number[];
- created_at: string;
- updated_at: string;
- /** count of questions */
- question_cnt: number;
- /** count passings */
- passed_count: number;
- /** average time of passing */
- average_time: number;
- /** set true if squiz realize group functionality */
- super: boolean;
- /** group of new quiz */
- group_id: number;
-}
-
-/** Type that comes from server */
-export interface RawQuiz {
- /** Id of created quiz */
- id: number;
- /** string id for customers */
- qid: string;
- /** true if quiz deleted */
- deleted: boolean;
- /** true if quiz archived */
- archived: boolean;
- /** set true for save deviceId */
- fingerprinting: boolean;
- /** set true for allow user to repeat quiz */
- repeatable: boolean;
- /** set true for save statistic of incomplete quiz passing */
- note_prevented: boolean;
- /** set true for mail notification for each quiz passing */
- mail_notifications: boolean;
- /** set true for save statistics only for unique quiz passing */
- unique_answers: boolean;
- /** name of quiz. max 280 length */
- name: string;
- /** description of quiz */
- description: string;
- /** config of quiz. serialized json for rules of quiz flow */
- config: string;
- /** status of quiz. allow only '', 'draft', 'template', 'stop', 'start' */
- status: string;
- /** limit is count of max quiz passing */
- limit: number;
- /** last time when quiz is valid. timestamp in seconds */
- due_to: number;
- /** seconds to pass quiz */
- time_of_passing: number;
- /** true if it is allowed for pause quiz */
- pausable: boolean;
- /** version of quiz */
- version: number;
- /** version comment to version of quiz */
- version_comment: string;
- /** array of previous versions of quiz */
- parent_ids: number[];
- created_at: string;
- updated_at: string;
- /** count of questions */
- question_cnt: number;
- /** count passings */
- passed_count: number;
- /** average time of passing */
- average_time: number;
- /** set true if squiz realize group functionality */
- super: boolean;
- /** group of new quiz */
- group_id: number;
-}
-
-export function rawQuizToQuiz(rawQuiz: RawQuiz): Quiz {
- let config = defaultQuizConfig;
-
- try {
- config = JSON.parse(rawQuiz.config);
- } catch (error) {
- console.warn("Cannot parse quiz config from string, using default config", error);
- }
-
- return {
- ...rawQuiz,
- config,
- backendId: rawQuiz.id,
- id: nanoid(),
- };
-}
diff --git a/src/model/quizSettings.ts b/src/model/quizSettings.ts
index 7be9e19..db37e5c 100644
--- a/src/model/quizSettings.ts
+++ b/src/model/quizSettings.ts
@@ -14,7 +14,7 @@ export const quizSetupSteps = [
// { stepperText: "Оценка графа карты вопросов", sidebarText: "Карта вопросов", sidebarIcon: QuestionsMapIcon },
{ stepperText: "Настройте форму контактов", sidebarText: "Форма контактов", sidebarIcon: ContactBookIcon },
{ stepperText: "Установите квиз", sidebarText: "Установка квиза", sidebarIcon: FlowArrowIcon },
- { stepperText: "Запустите рекламу", sidebarText: "Запуск рекламы", sidebarIcon: MegaphoneIcon },
+ // { stepperText: "Запустите рекламу", sidebarText: "Запуск рекламы", sidebarIcon: MegaphoneIcon },
] as const;
export const maxQuizSetupSteps = quizSetupSteps.length;
@@ -40,7 +40,7 @@ export interface QuizConfig {
theme: string,
reply: string,
replname: string,
- }
+ }
startpage: {
description: string;
button: string;
@@ -58,6 +58,16 @@ export interface QuizConfig {
cycle: boolean;
};
};
+ formContact: {
+ title: string;
+ desc: string;
+ name: FCField;
+ email: FCField;
+ phone: FCField;
+ text: FCField;
+ address: FCField;
+ button: string
+ };
info: {
phonenumber: string;
clickable: boolean;
@@ -68,6 +78,14 @@ export interface QuizConfig {
meta: string;
}
+type FCField = {
+ text: string
+ innerText: string
+ key: string
+ required: boolean
+ used: boolean
+}
+
export const defaultQuizConfig: QuizConfig = {
type: null,
noStartPage: false,
@@ -81,7 +99,7 @@ export const defaultQuizConfig: QuizConfig = {
theme: "",
reply: "",
replname: "",
- },
+ },
startpage: {
description: "",
button: "",
@@ -106,5 +124,45 @@ export const defaultQuizConfig: QuizConfig = {
site: "",
law: "",
},
+ formContact: {
+ title: "",
+ desc: "",
+ name: {
+ text: "",
+ innerText: "",
+ key: "",
+ required: false,
+ used: true
+ },
+ email: {
+ text: "",
+ innerText: "",
+ key: "",
+ required: false,
+ used: true
+ },
+ phone: {
+ text: "",
+ innerText: "",
+ key: "",
+ required: false,
+ used: true
+ },
+ text: {
+ text: "",
+ innerText: "",
+ key: "",
+ required: false,
+ used: false
+ },
+ address: {
+ text: "",
+ innerText: "",
+ key: "",
+ required: false,
+ used: false
+ },
+ button: ""
+ },
meta: "",
};
diff --git a/src/mui.d.ts b/src/mui.d.ts
old mode 100644
new mode 100755
diff --git a/src/pages/ViewPublicationPage/ApologyPage.tsx b/src/pages/ViewPublicationPage/ApologyPage.tsx
new file mode 100644
index 0000000..b9357d0
--- /dev/null
+++ b/src/pages/ViewPublicationPage/ApologyPage.tsx
@@ -0,0 +1,21 @@
+import { Box, Typography } from "@mui/material";
+
+export const ApologyPage = ({message}:{message: string}) => {
+ return (
+
+ {message || "что-то пошло не так"}
+
+
+
+ )
+}
\ No newline at end of file
diff --git a/src/pages/ViewPublicationPage/ContactForm.tsx b/src/pages/ViewPublicationPage/ContactForm.tsx
index d511f67..b47a93b 100644
--- a/src/pages/ViewPublicationPage/ContactForm.tsx
+++ b/src/pages/ViewPublicationPage/ContactForm.tsx
@@ -1,7 +1,13 @@
-import { Box, Typography, Button } from "@mui/material";
+import { Box, Typography, Button, Paper, TextField, Link, InputAdornment } from "@mui/material";
+import NameIcon from "@icons/ContactFormIcon/NameIcon";
+import EmailIcon from "@icons/ContactFormIcon/EmailIcon";
+import PhoneIcon from "@icons/ContactFormIcon/PhoneIcon";
+import TextIcon from "@icons/ContactFormIcon/TextIcon";
+import AddressIcon from "@icons/ContactFormIcon/AddressIcon";
-import { useCurrentQuiz } from "@root/quizes/hooks";
-import { useQuestionsStore } from "@root/questions/store";
+import CustomCheckbox from "@ui_kit/CustomCheckbox";
+import { useState } from "react";
+import { useQuestionsStore } from "@root/quizData/store";
import type { AnyTypedQuizQuestion } from "../../model/questionTypes/shared";
@@ -12,36 +18,158 @@ type ContactFormProps = {
setShowResultForm: (show: boolean) => void;
};
+const icons = [
+ { type: "name", icon: NameIcon, defaultText: "Введите имя", defaultTitle: "имя" },
+ { type: "email", icon: EmailIcon, defaultText: "Введите Email", defaultTitle: "Email" },
+ { type: "phone", icon: PhoneIcon, defaultText: "Введите номер телефона", defaultTitle: "номер телефона" },
+ { type: "text", icon: TextIcon, defaultText: "Введите фамилию", defaultTitle: "фамилию" },
+ { type: "address", icon: AddressIcon, defaultText: "Введите адрес", defaultTitle: "адрес" },
+]
+
export const ContactForm = ({
currentQuestion,
showResultForm,
setShowContactForm,
setShowResultForm,
}: ContactFormProps) => {
- const quiz = useCurrentQuiz();
- const { questions } = useQuestionsStore();
+ const { settings } = useQuestionsStore()
+
+ const [ready, setReady] = useState(false)
const followNextForm = () => {
setShowContactForm(false);
setShowResultForm(true);
};
- const resultQuestion = questions.find(
- (question) =>
- question.type === "result" &&
- question.content.rule.parentId === currentQuestion.content.id
- );
-
return (
-
- Форма контактов
- {!showResultForm &&
- resultQuestion &&
- quiz?.config.resultInfo.when === "after" && (
-
- )}
-
+
+
+
+
+
+ {settings.cfg.formContact.title || "Заполните форму, чтобы получить результаты теста"}
+
+
+ {
+ settings.cfg.formContact.desc &&
+
+ {settings.cfg.formContact.desc}
+
+ }
+
+
+
+
+
+
+
+
+
+
+ {
+ (
+
+ )}
+
+
+ { setReady(target.checked) }} checked={ready} />
+
+ С
+ Положением об обработке персональных данных
+ и
+ Политикой конфиденциальности
+ ознакомлен
+
+
+
+
+
+
);
};
+
+const Inputs = () => {
+ const { settings } = useQuestionsStore()
+
+ let someUsed:any = []
+
+ const Icons = icons.map((data) => {
+ //@ts-ignore
+ const FC:any = settings.cfg.formContact[data.type]
+ if (FC.used) someUsed.push()
+ return
+ })
+
+ if (someUsed.length) {
+ return <>{someUsed}>
+ } else {
+ return <>
+ {Icons[0]}
+ {Icons[1]}
+ {Icons[2]}
+ >
+ }
+}
+
+const CustomInput = ({ title, desc, Icon }: any) => {
+ return
+ {title}
+ ,
+ }}
+ />
+
+}
diff --git a/src/pages/ViewPublicationPage/Footer.tsx b/src/pages/ViewPublicationPage/Footer.tsx
index a6708f3..c4177af 100644
--- a/src/pages/ViewPublicationPage/Footer.tsx
+++ b/src/pages/ViewPublicationPage/Footer.tsx
@@ -1,15 +1,13 @@
import { useState, useEffect } from "react";
import { Box, Button, useTheme } from "@mui/material";
-import { useQuizViewStore } from "@root/quizView";
-import { useCurrentQuiz } from "@root/quizes/hooks";
-import { useQuestionsStore } from "@root/questions/store";
-
import type {
AnyTypedQuizQuestion,
QuizQuestionBase,
} from "../../model/questionTypes/shared";
-import { getQuestionByContentId } from "@root/questions/actions";
+import { useQuestionsStore } from "@root/quizData/store";
+import { getQuestionById } from "@root/quizData/actions";
+import { useQuizViewStore } from "@root/quizView/store";
import { enqueueSnackbar } from "notistack";
type FooterProps = {
@@ -25,23 +23,24 @@ export const Footer = ({
setShowContactForm,
setShowResultForm,
}: FooterProps) => {
- const [disablePreviousButton, setDisablePreviousButton] =
- useState(false);
- const [disableNextButton, setDisableNextButton] = useState(false);
- const quiz = useCurrentQuiz();
- const { answers } = useQuizViewStore();
- const questions = useQuestionsStore().questions as AnyTypedQuizQuestion[];
const theme = useTheme();
- const linear = !questions.find(
+
+ const { settings, items } = useQuestionsStore();
+ const { answers } = useQuizViewStore();
+
+ const [disablePreviousButton, setDisablePreviousButton] = useState(false);
+ const [disableNextButton, setDisableNextButton] = useState(false);
+
+ const linear = !items.find(
({ content }) => content.rule.parentId === "root"
);
useEffect(() => {
// Логика для аргумента disabled у кнопки "Назад"
if (linear) {
- const questionIndex = questions.findIndex(({ id }) => id === question.id);
+ const questionIndex = items.findIndex(({ id }) => id === question.id);
- const previousQuestion = questions[questionIndex - 1];
+ const previousQuestion = items[questionIndex - 1];
if (previousQuestion) {
setDisablePreviousButton(false);
@@ -58,7 +57,7 @@ export const Footer = ({
// Логика для аргумента disabled у кнопки "Далее"
const answer = answers.find(
- ({ questionId }) => questionId === question.content.id
+ ({ questionId }) => questionId === question.id
);
if ("required" in question.content && question.content.required && answer) {
@@ -85,7 +84,7 @@ export const Footer = ({
if (nextQuestionId) {
setDisableNextButton(false);
} else {
- const nextQuestion = getQuestionByContentId(
+ const nextQuestion = getQuestionById(
question.content.rule.default
);
@@ -95,13 +94,11 @@ export const Footer = ({
}
}, [question, answers]);
- const showResult = () => {
- const resultQuestion = questions.find(
- ({ type, content }) =>
- type === "result" && content.rule.parentId === question.content.id
- );
+ const showResult = (nextQuestion:any) => {
- if (quiz?.config.resultInfo.when !== "after" && resultQuestion) {
+ console.log(nextQuestion)
+
+ if (nextQuestion && settings.cfg.resultInfo.when === "before") {
setShowResultForm(true);
} else {
setShowContactForm(true);
@@ -111,7 +108,7 @@ export const Footer = ({
const getNextQuestionId = () => {
if (answers.length) {
const answer = answers.find(
- ({ questionId }) => questionId === question.content.id
+ ({ questionId }) => questionId === question.id
);
let readyBeNextQuestion = "";
@@ -155,9 +152,9 @@ export const Footer = ({
const followPreviousStep = () => {
if (linear) {
- const questionIndex = questions.findIndex(({ id }) => id === question.id);
+ const questionIndex = items.findIndex(({ id }) => id === question.id);
- const previousQuestion = questions[questionIndex - 1];
+ const previousQuestion = items[questionIndex - 1];
if (previousQuestion) {
setCurrentQuestion(previousQuestion);
@@ -167,7 +164,7 @@ export const Footer = ({
}
if (question?.content.rule.parentId !== "root") {
- const parent = getQuestionByContentId(question?.content.rule.parentId);
+ const parent = getQuestionById(question?.content.rule.parentId);
if (parent?.type) {
setCurrentQuestion(parent);
} else {
@@ -180,13 +177,14 @@ export const Footer = ({
const followNextStep = () => {
if (linear) {
- const questionIndex = questions.findIndex(({ id }) => id === question.id);
- const nextQuestion = questions[questionIndex + 1];
+ const questionIndex = items.findIndex(({ id }) => id === question.id);
+ const nextQuestion = items[questionIndex + 1];
+ console.log(nextQuestion)
if (nextQuestion && nextQuestion.type !== "result") {
setCurrentQuestion(nextQuestion);
} else {
- showResult();
+ showResult(nextQuestion);
}
return;
@@ -195,7 +193,7 @@ export const Footer = ({
const nextQuestionId = getNextQuestionId();
if (nextQuestionId) {
- const nextQuestion = getQuestionByContentId(nextQuestionId);
+ const nextQuestion = getQuestionById(nextQuestionId);
if (nextQuestion?.type && nextQuestion.type !== "result") {
setCurrentQuestion(nextQuestion);
@@ -204,13 +202,13 @@ export const Footer = ({
enqueueSnackbar("не могу получить последующий вопрос");
}
} else {
- const nextQuestion = getQuestionByContentId(
+ const nextQuestion = getQuestionById(
question.content.rule.default
);
if (nextQuestion?.type && nextQuestion.type !== "result") {
setCurrentQuestion(nextQuestion);
} else {
- showResult();
+ showResult(undefined);
}
}
};
@@ -260,7 +258,7 @@ export const Footer = ({
{/* */}
{/* Из
- {questions.length}
+ {items.length}
*/}