diff --git a/package.json b/package.json
index cd513276..64e4ba21 100755
--- a/package.json
+++ b/package.json
@@ -17,6 +17,7 @@
"@types/react": "^18.0.0",
"@types/react-dnd": "^3.0.2",
"@types/react-dom": "^18.0.0",
+ "emoji-mart": "^5.5.2",
"file-saver": "^2.0.5",
"html-to-image": "^1.11.11",
"jszip": "^3.10.1",
@@ -71,6 +72,8 @@
]
},
"devDependencies": {
+ "@emoji-mart/data": "^1.1.2",
+ "@emoji-mart/react": "^1.1.1",
"@types/react-beautiful-dnd": "^13.1.4",
"craco-alias": "^3.0.1"
}
diff --git a/src/assets/icons/BackArrowIcon.tsx b/src/assets/icons/BackArrowIcon.tsx
index b7c6bdf6..cbfef395 100755
--- a/src/assets/icons/BackArrowIcon.tsx
+++ b/src/assets/icons/BackArrowIcon.tsx
@@ -1,26 +1,26 @@
import { Box } from "@mui/material";
export default function BackArrowIcon({ color = "black" }: { color?: string }) {
- return (
-
-
-
- );
- }
\ No newline at end of file
+ return (
+
+
+
+ );
+}
diff --git a/src/assets/icons/Burger.tsx b/src/assets/icons/Burger.tsx
index 60748139..eb247987 100644
--- a/src/assets/icons/Burger.tsx
+++ b/src/assets/icons/Burger.tsx
@@ -6,4 +6,4 @@ export const Burger: FC> = (props) => (
-);
\ No newline at end of file
+);
diff --git a/src/assets/icons/ChartPieIcon.tsx b/src/assets/icons/ChartPieIcon.tsx
index f9dd4254..6671f740 100755
--- a/src/assets/icons/ChartPieIcon.tsx
+++ b/src/assets/icons/ChartPieIcon.tsx
@@ -1,30 +1,40 @@
import { Box } from "@mui/material";
-
interface Props {
- height: string;
- width: string;
- color: string;
+ height: string;
+ width: string;
+ color: string;
}
export default function ChartPieIcon({ height, width, color }: Props) {
-
- return (
-
-
-
- );
-}
\ No newline at end of file
+ return (
+
+
+
+ );
+}
diff --git a/src/assets/icons/questionsPage/addImage.tsx b/src/assets/icons/questionsPage/addImage.tsx
index 25285ee7..3842072d 100644
--- a/src/assets/icons/questionsPage/addImage.tsx
+++ b/src/assets/icons/questionsPage/addImage.tsx
@@ -17,6 +17,7 @@ const AddImage: FC = ({ onClick, sx }) => {
alignItems: "center",
justifyContent: "center",
cursor: "pointer",
+ ...sx,
}}
>
-);
\ No newline at end of file
+);
diff --git a/src/pages/startPage/Sidebar/icons/Pencil.tsx b/src/pages/startPage/Sidebar/icons/Pencil.tsx
index 10d6fa61..c2db708d 100644
--- a/src/pages/startPage/Sidebar/icons/Pencil.tsx
+++ b/src/pages/startPage/Sidebar/icons/Pencil.tsx
@@ -13,4 +13,4 @@ export const Pencil: FC> = (props) => (
-);
\ No newline at end of file
+);
diff --git a/src/pages/startPage/Sidebar/icons/People.tsx b/src/pages/startPage/Sidebar/icons/People.tsx
index 7a4566a5..d880126d 100644
--- a/src/pages/startPage/Sidebar/icons/People.tsx
+++ b/src/pages/startPage/Sidebar/icons/People.tsx
@@ -7,4 +7,4 @@ export const People: FC> = (props) => (
fill="currentColor"
/>
-);
\ No newline at end of file
+);
diff --git a/src/pages/startPage/Sidebar/icons/Question.tsx b/src/pages/startPage/Sidebar/icons/Question.tsx
index 5a743b3d..69989347 100644
--- a/src/pages/startPage/Sidebar/icons/Question.tsx
+++ b/src/pages/startPage/Sidebar/icons/Question.tsx
@@ -11,4 +11,4 @@ export const Question: FC> = (props) => (
/>
-);
\ No newline at end of file
+);
diff --git a/src/pages/startPage/Sidebar/icons/ReturnTime.tsx b/src/pages/startPage/Sidebar/icons/ReturnTime.tsx
index a50b89c5..3724be6e 100644
--- a/src/pages/startPage/Sidebar/icons/ReturnTime.tsx
+++ b/src/pages/startPage/Sidebar/icons/ReturnTime.tsx
@@ -10,4 +10,4 @@ export const ReturnTime: FC> = (props) => (
stroke-linejoin="round"
/>
-);
\ No newline at end of file
+);
diff --git a/src/pages/startPage/Sidebar/icons/Settings.tsx b/src/pages/startPage/Sidebar/icons/Settings.tsx
index 27796802..d96c590b 100644
--- a/src/pages/startPage/Sidebar/icons/Settings.tsx
+++ b/src/pages/startPage/Sidebar/icons/Settings.tsx
@@ -21,4 +21,4 @@ export const Settings: FC> = (props) => (
strokeLinejoin="round"
/>
-);
\ No newline at end of file
+);
diff --git a/src/pages/startPage/StartPage.tsx b/src/pages/startPage/StartPage.tsx
index 3764fe17..a4037374 100755
--- a/src/pages/startPage/StartPage.tsx
+++ b/src/pages/startPage/StartPage.tsx
@@ -1,6 +1,6 @@
import Stepper from "@ui_kit/Stepper";
import SwitchStepPages from "@ui_kit/switchStepPages";
-import React from "react";
+import React, { useState } from "react";
import PenaLogo from "@ui_kit/PenaLogo";
import { Box, Button, Container, FormControl, IconButton, TextField, useMediaQuery, useTheme } from "@mui/material";
import BackArrowIcon from "@icons/BackArrowIcon";
@@ -22,7 +22,7 @@ export default function StartPage() {
const isTablet = useMediaQuery(theme.breakpoints.down(1000));
const isMobile = useMediaQuery(theme.breakpoints.down(660));
- const [mobileSidebar, setMobileSidebar] = React.useState(false);
+ const [mobileSidebar, setMobileSidebar] = useState(false);
const handleNext = () => {
updateQuizesList(params, { step: listQuizes[params].step + 1 });
diff --git a/src/pages/startPage/StartPageSettings.tsx b/src/pages/startPage/StartPageSettings.tsx
index 113cd9b6..ec1239a1 100755
--- a/src/pages/startPage/StartPageSettings.tsx
+++ b/src/pages/startPage/StartPageSettings.tsx
@@ -68,7 +68,6 @@ export default function StartPageSettings({ handleNext }: HandleNext) {
const theme = useTheme();
const designType = listQuizes[params].startpage;
const StartPageClone = listQuizes[params];
- console.log(StartPageClone);
const [backgroundType, setBackgroundType] = useState(
listQuizes[params].config.startpage.background.type
);
@@ -616,7 +615,6 @@ export default function StartPageSettings({ handleNext }: HandleNext) {
label="Кликабельный"
checked={listQuizes[params].config.info.clickable}
handleChange={(e) => {
- console.log(e.target.checked);
let SPageClone = listQuizes[params].config;
SPageClone.info.clickable = e.target.checked;
updateQuizesList(params, { config: SPageClone });
diff --git a/src/pages/startPage/dropZone.tsx b/src/pages/startPage/dropZone.tsx
index 3a4f785c..d354b077 100644
--- a/src/pages/startPage/dropZone.tsx
+++ b/src/pages/startPage/dropZone.tsx
@@ -28,22 +28,18 @@ export default ({ text, sx, heightImg, widthImg }: Props) => {
const [ready, setReady] = useState(false);
const dragenterHC = () => {
- // console.log("onDragEnter")
setReady(true);
};
const dragexitHC = () => {
- // console.log("onDragExit")
setReady(false);
};
const dropHC = (event: React.DragEvent) => {
event.preventDefault();
- // console.log("onDrop")
setReady(false);
const file = event.dataTransfer.files[0];
- console.log(event.dataTransfer.files[0]);
if (file.size < 5242880) {
setData(URL.createObjectURL(file));
} else {
@@ -53,7 +49,6 @@ export default ({ text, sx, heightImg, widthImg }: Props) => {
const dragOverHC = (event: React.DragEvent) => {
event.preventDefault();
- // console.log("onDragOver")
};
return (
diff --git a/src/pages/startPage/dropfavicon.tsx b/src/pages/startPage/dropfavicon.tsx
index 2d67ae07..2eace103 100644
--- a/src/pages/startPage/dropfavicon.tsx
+++ b/src/pages/startPage/dropfavicon.tsx
@@ -146,14 +146,11 @@ export default ({ text, sx, heightImg, widthImg }: Props) => {
const [favList, setFavList] = useState([]);
useEffect(() => {
- console.log(favList);
if (favList.length === 18) {
- console.log("сейчас я сработаю");
const zip = new JSZip(); //создание зип архива
favList.forEach((uri, i) => {
- console.log(i);
const idx = uri.indexOf("base64,") + "base64,".length; //обработка строки картинки
const content = uri.substring(idx); //обработка строки картинки
zip.file(`fav${i}.jpg`, content, { base64: true }); //сохранение картинки в архив с именем "fav.jpg"
@@ -201,46 +198,26 @@ export default ({ text, sx, heightImg, widthImg }: Props) => {
const [ready, setReady] = useState(false);
const dragenterHC = () => {
- // console.log("onDragEnter")
setReady(true);
};
const dragexitHC = () => {
- // console.log("onDragExit")
setReady(false);
};
const dropHC = (event: React.DragEvent) => {
event.preventDefault();
- // console.log("onDrop")
setReady(false);
const file = event.dataTransfer.files[0];
- console.log(event.dataTransfer.files[0]);
if (file.size < 5242880) {
setData(URL.createObjectURL(file));
} else {
enqueueSnackbar("Размер картинки слишком велик");
}
- // try {
- // Resizer.imageFileResizer(
- // file,
- // 50,
- // 50,
- // "JPEG",
- // 100,
- // 0,
- // callback,
- // );
- //
- // } catch (err) {
- // console.log(err);
- // }
- //
};
const dragOverHC = (event: React.DragEvent) => {
event.preventDefault();
- // console.log("onDragOver")
};
return (
diff --git a/src/pages/startPage/stepOne.tsx b/src/pages/startPage/stepOne.tsx
index e8cc287a..bf13c9c0 100755
--- a/src/pages/startPage/stepOne.tsx
+++ b/src/pages/startPage/stepOne.tsx
@@ -13,10 +13,8 @@ export default function StepOne({ handleNext }: HandleNext) {
const theme = useTheme();
const params = Number(useParams().quizId);
- console.log(params)
const {listQuizes, updateQuizesList,} = quizStore()
- console.log(listQuizes)
return (
<>
= {
description: "",
type: "",
required: true,
- deleted: true,
+ deleted: false,
+ deleteTimeoutId: 0,
page: 0,
content: {
largeCheck: false,
@@ -115,12 +118,13 @@ export const DEFAULT_QUESTION: Omit = {
chooseRange: false,
required: false,
replText: "",
- ratingExpanded: false,
- ratingDescription: "",
+ ratingNegativeDescription: "",
+ ratingPositiveDescription: "",
variants: [
{
answer: "",
hints: "",
+ emoji: "",
},
],
hint: {
@@ -145,15 +149,35 @@ export const DEFAULT_QUESTION: Omit = {
expanded: false,
};
+let isFirstPartialize = true;
+
export const questionStore = create()(
persist(
() => ({
listQuestions: {},
openedModalSettings: "",
}),
-
{
name: "question",
+ partialize: (state: QuestionStore) => {
+ if (isFirstPartialize) {
+ isFirstPartialize = false;
+
+ Object.keys(state.listQuestions).forEach((quizId) => {
+ [...state.listQuestions[quizId]].forEach(({ id, deleted }) => {
+ if (deleted) {
+ const removedItemIndex = state.listQuestions[quizId].findIndex(
+ (item) => item.id === id
+ );
+
+ state.listQuestions[quizId].splice(removedItemIndex, 1);
+ }
+ });
+ });
+ }
+
+ return state;
+ },
}
)
);
@@ -220,11 +244,18 @@ export const copyQuestion = (quizId: number, copiedQuestionIndex: number) => {
questionStore.setState({ listQuestions });
};
+export const removeQuestionForce = (quizId: number, removedId: number) => {
+ const questionListClone = { ...questionStore.getState()["listQuestions"] };
+ const removedItemIndex = questionListClone[quizId].findIndex(
+ ({ id }) => id === removedId
+ );
+ questionListClone[quizId].splice(removedItemIndex, 1);
+ questionStore.setState({ listQuestions: questionListClone });
+};
+
export const removeQuestion = (quizId: number, index: number) => {
const questionListClone = { ...questionStore.getState()["listQuestions"] };
-
- questionListClone[quizId].splice(index, 1);
-
+ questionListClone[quizId][index].deleted = true;
questionStore.setState({ listQuestions: questionListClone });
};
diff --git a/src/ui_kit/EmojiPicker.tsx b/src/ui_kit/EmojiPicker.tsx
new file mode 100644
index 00000000..50714d45
--- /dev/null
+++ b/src/ui_kit/EmojiPicker.tsx
@@ -0,0 +1,26 @@
+import EmojiPickerOriginal from "@emoji-mart/react";
+import { Box } from "@mui/material";
+
+type Emoji = {
+ emoticons: string[];
+ id: string;
+ keywords: string[];
+ name: string;
+ native: string;
+ shortcodes: string;
+ unified: string;
+};
+
+type EmojiPickerProps = {
+ onEmojiSelect: (emoji: Emoji) => void;
+};
+
+export const EmojiPicker = ({ onEmojiSelect }: EmojiPickerProps) => (
+
+
+
+);
diff --git a/src/ui_kit/Modal/CropModal.tsx b/src/ui_kit/Modal/CropModal.tsx
index 5c521398..6949edc1 100644
--- a/src/ui_kit/Modal/CropModal.tsx
+++ b/src/ui_kit/Modal/CropModal.tsx
@@ -155,9 +155,6 @@ export const CropModal: FC = ({ opened, onClose, picture }) => {
const aspect = imageWidth / imageHeight;
- console.log(aspect);
-
- console.log(width);
if (aspect <= 1.333) {
setWidth(240);
diff --git a/src/ui_kit/Sidebar.tsx b/src/ui_kit/Sidebar.tsx
index 0664f2e2..c84968b8 100755
--- a/src/ui_kit/Sidebar.tsx
+++ b/src/ui_kit/Sidebar.tsx
@@ -15,139 +15,143 @@ import LayoutIcon from "../assets/icons/LayoutIcon";
import MenuItem from "./MenuItem";
const createQuizMenuItems = [
- [LayoutIcon, "Стартовая страница"],
- [QuestionIcon, "Вопросы"],
- [ChartPieIcon, "Результаты"],
- [ContactBookIcon, "Форма контактов"],
- [FlowArrowIcon, "Установка квиза"],
- [MegaphoneIcon, "Запуск рекламы"],
+ [LayoutIcon, "Стартовая страница"],
+ [QuestionIcon, "Вопросы"],
+ [ChartPieIcon, "Результаты"],
+ [ContactBookIcon, "Форма контактов"],
+ [FlowArrowIcon, "Установка квиза"],
+ [MegaphoneIcon, "Запуск рекламы"],
] as const;
const quizSettingsMenuItems = [
- [TagIcon, "Дополнения"],
- [PencilCircleIcon, "Дизайн"],
- [PuzzlePieceIcon, "Интеграции"],
- [GearIcon, "Настройки"],
+ [TagIcon, "Дополнения"],
+ [PencilCircleIcon, "Дизайн"],
+ [PuzzlePieceIcon, "Интеграции"],
+ [GearIcon, "Настройки"],
] as const;
-
export default function Sidebar() {
- const theme = useTheme();
- const [isMenuCollapsed, setIsMenuCollapsed] = useState(false);
- const [activeMenuItemIndex, setActiveMenuItemIndex] = useState(0);
- const [progress, setProgress] = useState(1 / 6);
+ const theme = useTheme();
+ const [isMenuCollapsed, setIsMenuCollapsed] = useState(false);
+ const [activeMenuItemIndex, setActiveMenuItemIndex] = useState(0);
+ const [progress, setProgress] = useState(1 / 6);
- const handleMenuCollapseToggle = () => setIsMenuCollapsed(prev => !prev);
- return (
-
-
-
- {!isMenuCollapsed &&
- Создание квиза
- }
-
-
-
-
-
- {createQuizMenuItems.map((menuItem, index) => {
- const Icon = menuItem[0];
- return (
-
- {!isMenuCollapsed &&
- Настройки квиза
- }
-
- {quizSettingsMenuItems.map((menuItem, index) => {
- const Icon = menuItem[0];
- const totalIndex = index + createQuizMenuItems.length;
- const isActive = activeMenuItemIndex === totalIndex;
- return (
-
-
-
- )
-}
\ No newline at end of file
+ const handleMenuCollapseToggle = () => setIsMenuCollapsed((prev) => !prev);
+ return (
+
+
+ {!isMenuCollapsed && (
+
+ Создание квиза
+
+ )}
+
+
+
+
+
+ {createQuizMenuItems.map((menuItem, index) => {
+ const Icon = menuItem[0];
+ return (
+
+ {!isMenuCollapsed && (
+
+ Настройки квиза
+
+ )}
+
+ {quizSettingsMenuItems.map((menuItem, index) => {
+ const Icon = menuItem[0];
+ const totalIndex = index + createQuizMenuItems.length;
+ const isActive = activeMenuItemIndex === totalIndex;
+ return (
+
+
+ );
+}
diff --git a/src/ui_kit/reactImageFileResizer.ts b/src/ui_kit/reactImageFileResizer.ts
index 0c2e8ebf..7b4b8498 100644
--- a/src/ui_kit/reactImageFileResizer.ts
+++ b/src/ui_kit/reactImageFileResizer.ts
@@ -51,7 +51,6 @@ class Resizer {
Yoffset = Math.round((size - height) / 2)
}
- console.log(height, width)
ctx.drawImage(image, Xoffset, Yoffset, width, height);
diff --git a/yarn.lock b/yarn.lock
index aaaf157b..87ce3a16 100755
--- a/yarn.lock
+++ b/yarn.lock
@@ -1218,6 +1218,16 @@
resolved "https://registry.npmjs.org/@csstools/selector-specificity/-/selector-specificity-2.0.2.tgz"
integrity sha512-IkpVW/ehM1hWKln4fCA3NzJU8KwD+kIOvPZA4cqxoJHtE21CCzjyp+Kxbu0i5I4tBNOlXPL9mjwnWlL0VEG4Fg==
+"@emoji-mart/data@^1.1.2":
+ version "1.1.2"
+ resolved "https://registry.yarnpkg.com/@emoji-mart/data/-/data-1.1.2.tgz#777c976f8f143df47cbb23a7077c9ca9fe5fc513"
+ integrity sha512-1HP8BxD2azjqWJvxIaWAMyTySeZY0Osr83ukYjltPVkNXeJvTz7yDrPLBtnrD5uqJ3tg4CcLuuBW09wahqL/fg==
+
+"@emoji-mart/react@^1.1.1":
+ version "1.1.1"
+ resolved "https://registry.yarnpkg.com/@emoji-mart/react/-/react-1.1.1.tgz#ddad52f93a25baf31c5383c3e7e4c6e05554312a"
+ integrity sha512-NMlFNeWgv1//uPsvLxvGQoIerPuVdXwK/EUek8OOkJ6wVOWPUizRBJU0hDqWZCOROVpfBgCemaC3m6jDOXi03g==
+
"@emotion/babel-plugin@^11.10.5":
version "11.10.5"
resolved "https://registry.npmjs.org/@emotion/babel-plugin/-/babel-plugin-11.10.5.tgz"
@@ -4163,6 +4173,11 @@ emittery@^0.8.1:
resolved "https://registry.npmjs.org/emittery/-/emittery-0.8.1.tgz"
integrity sha512-uDfvUjVrfGJJhymx/kz6prltenw1u7WrCg1oa94zYY8xxVpLLUu045LAT0dhDZdXG58/EpPL/5kA180fQ/qudg==
+emoji-mart@^5.5.2:
+ version "5.5.2"
+ resolved "https://registry.yarnpkg.com/emoji-mart/-/emoji-mart-5.5.2.tgz#3ddbaf053139cf4aa217650078bc1c50ca8381af"
+ integrity sha512-Sqc/nso4cjxhOwWJsp9xkVm8OF5c+mJLZJFoFfzRuKO+yWiN7K8c96xmtughYb0d/fZ8UC6cLIQ/p4BR6Pv3/A==
+
emoji-regex@^8.0.0:
version "8.0.0"
resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz"