diff --git a/src/App.tsx b/src/App.tsx index 4e14a611..8fd30e9b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -20,7 +20,7 @@ import { Restore } from "./pages/auth/Restore"; import SigninDialog from "./pages/auth/Signin"; import SignupDialog from "./pages/auth/Signup"; import { InfoPrivilege } from "./pages/InfoPrivilege"; -import AmoTokenExpiredDialog from "./pages/IntegrationsPage/IntegrationsModal/AmoTokenExpiredDialog"; +import AmoTokenExpiredDialog from "./pages/IntegrationsPage/IntegrationsModal/Amo/AmoTokenExpiredDialog"; import Landing from "./pages/Landing/Landing"; import Main from "./pages/main"; diff --git a/src/api/integration.ts b/src/api/integration.ts index c2ec31ff..179a1378 100644 --- a/src/api/integration.ts +++ b/src/api/integration.ts @@ -1,4 +1,4 @@ -import { QuestionKeys } from "@/pages/IntegrationsPage/IntegrationsModal/types"; +import { QuestionKeys } from "@/pages/IntegrationsPage/IntegrationsModal/Amo/types"; import { makeRequest } from "@api/makeRequest"; import { parseAxiosError } from "@utils/parse-error"; import useSWR from "swr"; diff --git a/src/api/statistic.ts b/src/api/statistic.ts index f9e13396..1fd3c245 100644 --- a/src/api/statistic.ts +++ b/src/api/statistic.ts @@ -105,7 +105,6 @@ export const getGraphics = async ( withCredentials: true, }); - console.log(questionsResponse) return [questionsResponse]; } catch (nativeError) { const [error] = parseAxiosError(nativeError); diff --git a/src/components/CustomRadioGroup/CustomRadioGroup.tsx b/src/components/CustomRadioGroup/CustomRadioGroup.tsx index db3fdafc..b64c056b 100644 --- a/src/components/CustomRadioGroup/CustomRadioGroup.tsx +++ b/src/components/CustomRadioGroup/CustomRadioGroup.tsx @@ -1,8 +1,8 @@ import * as React from "react"; import { FC, useMemo } from "react"; import CheckboxIcon from "@icons/Checkbox"; -import { SelectChangeEvent, Typography, useTheme, Box, FormControlLabel, RadioGroup, Radio } from "@mui/material"; -import { MinifiedData, TagKeys } from "@/pages/IntegrationsPage/IntegrationsModal/types"; +import { SelectChangeEvent, Typography, useTheme, Box, FormControlLabel, RadioGroup, Radio, useMediaQuery } from "@mui/material"; +import { MinifiedData, TagKeys } from "@/pages/IntegrationsPage/IntegrationsModal/Amo/types"; type CustomRadioGroupProps = { items: MinifiedData[] | []; @@ -20,22 +20,19 @@ export const CustomRadioGroup: FC = ({ activeScope, }) => { const theme = useTheme(); + const isMobile = useMediaQuery(theme.breakpoints.down(600)); - const currentItem = useMemo(() => { - if (selectedItemId !== null && selectedItemId.length > 0) { - return items.find((item) => item.id === selectedItemId) || null; - } - return null; - }, [selectedItemId, items]); + const currentItem = + (selectedItemId !== null && selectedItemId.length > 0) ? + items.find((item) => item.id === selectedItemId) || null + : + null; - const filteredItems = useMemo(() => { - let newArray = items; - if (activeScope !== undefined) - newArray = newArray.filter((item) => { + const filteredItems = + (activeScope !== undefined) ? + items.filter((item) => { return item.entity === activeScope; - }); - return newArray; - }, items); + }) : items const onScroll = React.useCallback((e: React.UIEvent) => { const scrollHeight = e.currentTarget.scrollHeight; @@ -48,9 +45,9 @@ export const CustomRadioGroup: FC = ({ } }, []); - const formControlLabels = useMemo(() => { - if (filteredItems.length !== 0) { - return filteredItems.map((item) => ( + const formControlLabels = + (filteredItems.length !== 0) ? + filteredItems.map((item) => ( = ({ backgroundColor: currentItem?.id === item.id ? theme.palette.background.default : theme.palette.common.white, "&.MuiFormControlLabel-root > .MuiTypography-root": { - width: "200px", + width: isMobile ? "150px" : "200px", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" @@ -86,9 +83,9 @@ export const CustomRadioGroup: FC = ({ label={item.title} labelPlacement={"start"} /> - )); - } - return ( + )) + : + ( = ({ > Нет элементов - ); - }, [filteredItems, selectedItemId]); + ) return ( = ({ isModalOpen, handleClo const isTablet = useMediaQuery(theme.breakpoints.down(1000)); const { questions } = useQuestions(); - console.log("КВЕШЕНЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫААААААААААААА") - console.log(questions) const minifiedQuestions = useMemo( () => questions @@ -79,7 +77,7 @@ export const AmoCRMModal: FC = ({ isModalOpen, handleClo [quiz] ); - const [step, setStep] = useState(0); + const [step, setStep] = useState(4); const [isSettingsBlock, setIsSettingsBlock] = useState(false); const [isTryRemoveAccount, setIsTryRemoveAccount] = useState(false); const [openDelete, setOpenDelete] = useState(null); @@ -118,6 +116,7 @@ export const AmoCRMModal: FC = ({ isModalOpen, handleClo questions, }); + const handleAddTagQuestion = useCallback( (scope: QuestionKeys | TagKeys, id: string, type: "question" | "tag") => { if (!scope || !id) return; @@ -157,8 +156,6 @@ export const AmoCRMModal: FC = ({ isModalOpen, handleClo } if (openDelete.type === "question") { - console.log("delete id ", openDelete.id) - console.log("selectedQuestions ", selectedQuestions[openDelete.scope as QuestionKeys]) let newArray = selectedQuestions newArray[openDelete.scope as QuestionKeys] = newArray[openDelete.scope as QuestionKeys].filter(e => e.id !== openDelete.id) // let index = -1 @@ -170,7 +167,6 @@ export const AmoCRMModal: FC = ({ isModalOpen, handleClo // ...prevState, // [openDelete.scope]: newArray, // })); - console.log("результат ебаный", newArray) setSelectedQuestions(newArray); setSelectedCurrentFields(selectedCurrentFields.filter(e => e.id !== openDelete.id)); @@ -216,7 +212,6 @@ export const AmoCRMModal: FC = ({ isModalOpen, handleClo selectedCurrentFields.forEach((data) => { if (data.entity === "Contact") { - console.log(data) FieldsRule.Contact.ContactRuleMap[data.id] = Number(data.amoId) } else { FieldsRule[data.entity].QuestionID[data.id] = Number(data.amoId) || 0 @@ -229,8 +224,6 @@ export const AmoCRMModal: FC = ({ isModalOpen, handleClo } body.FieldsRule = FieldsRule; - console.log(body) - if (firstRules) { setIntegrationRules(quiz.backendId.toString(), body); } else { @@ -338,6 +331,7 @@ export const AmoCRMModal: FC = ({ isModalOpen, handleClo arrayOfPipelinesSteps, arrayOfUsers, arrayOfTags, + arrayOfFields, selectedPipeline, selectedPipelineStep, selectedDealUser, @@ -347,7 +341,6 @@ export const AmoCRMModal: FC = ({ isModalOpen, handleClo arrayOfPipelinesSteps, arrayOfUsers, minifiedQuestions, - arrayOfTags, selectedCurrentFields, ] ); diff --git a/src/pages/IntegrationsPage/IntegrationsModal/AmoLogin/AmoLogin.tsx b/src/pages/IntegrationsPage/IntegrationsModal/Amo/AmoLogin/AmoLogin.tsx similarity index 98% rename from src/pages/IntegrationsPage/IntegrationsModal/AmoLogin/AmoLogin.tsx rename to src/pages/IntegrationsPage/IntegrationsModal/Amo/AmoLogin/AmoLogin.tsx index 7772f82a..92bf2ec4 100644 --- a/src/pages/IntegrationsPage/IntegrationsModal/AmoLogin/AmoLogin.tsx +++ b/src/pages/IntegrationsPage/IntegrationsModal/Amo/AmoLogin/AmoLogin.tsx @@ -1,6 +1,6 @@ import { Box, Typography, useMediaQuery, useTheme } from "@mui/material"; import { FC } from "react"; -import { AmoButton } from "../../../../components/AmoButton/AmoButton"; +import { AmoButton } from "../../../../../components/AmoButton/AmoButton"; import { connectAmo } from "@api/integration"; type IntegrationStep1Props = { diff --git a/src/pages/IntegrationsPage/IntegrationsModal/AmoModalTitle/AmoModalTitle.tsx b/src/pages/IntegrationsPage/IntegrationsModal/Amo/AmoModalTitle/AmoModalTitle.tsx similarity index 100% rename from src/pages/IntegrationsPage/IntegrationsModal/AmoModalTitle/AmoModalTitle.tsx rename to src/pages/IntegrationsPage/IntegrationsModal/Amo/AmoModalTitle/AmoModalTitle.tsx diff --git a/src/pages/IntegrationsPage/IntegrationsModal/AmoQuestions/AmoQuestions.tsx b/src/pages/IntegrationsPage/IntegrationsModal/Amo/AmoQuestions/AmoQuestions.tsx similarity index 65% rename from src/pages/IntegrationsPage/IntegrationsModal/AmoQuestions/AmoQuestions.tsx rename to src/pages/IntegrationsPage/IntegrationsModal/Amo/AmoQuestions/AmoQuestions.tsx index 8175907b..1de7493a 100644 --- a/src/pages/IntegrationsPage/IntegrationsModal/AmoQuestions/AmoQuestions.tsx +++ b/src/pages/IntegrationsPage/IntegrationsModal/Amo/AmoQuestions/AmoQuestions.tsx @@ -1,10 +1,11 @@ -import { FC, useMemo, useState } from "react"; +import { FC, useEffect, useMemo, useState } from "react"; import { ItemsSelectionView } from "./ItemsSelectionView/ItemsSelectionView"; import { ItemDetailsView } from "./ItemDetailsView/ItemDetailsView"; import { Box } from "@mui/material"; import { MinifiedData, QuestionKeys, SelectedQuestions, TagKeys, TagQuestionHC } from "../types"; import { EntitiesQuestions } from "./EntitiesQuestions"; import { diffArr } from "../AmoCRMModal"; +import { DataConstrictor } from "../Components/DataConstrictor"; type Props = { selectedCurrentFields: MinifiedData[] | []; @@ -41,10 +42,6 @@ export const AmoQuestions: FC = ({ FieldsAllowedFC, setSelectedCurrentFields }) => { - console.log("selectedCurrentFields") - console.log(selectedCurrentFields) - console.log("selectedQuestions") - console.log(selectedQuestions) const [isSelection, setIsSelection] = useState(false); const [activeScope, setActiveScope] = useState(null); const [selectedQuestion, setSelectedQuestion] = useState(null); @@ -58,9 +55,9 @@ export const AmoQuestions: FC = ({ handleAddQuestion(activeScope, selectedQuestion, "question"); }; const handleAddCurrentField = () => { - if (activeScope === null || selectedField === null || selectedQuestion === null || + if (activeScope === null || selectedField === null || selectedQuestion === null || selectedCurrentFields.some(e => (e.id === selectedQuestion) && e.entity === activeScope) - ) return; + ) return; setActiveScope(null); //Убедимся что такой ФК не добавлялось const newArray = selectedCurrentFields @@ -69,24 +66,19 @@ export const AmoQuestions: FC = ({ if (e.subTitle === selectedQuestion) index = i }) if (index !== -1) newArray.splice(index, 1); - console.log(newArray) newArray.push({ id: selectedQuestion, title: questionsItems.find(e => e.id === selectedQuestion)?.title || FCTranslate[selectedQuestion], entity: activeScope, amoId: selectedField, }) - console.log(newArray) setSelectedCurrentFields(newArray); }; const handleAdd = () => { - console.log(activeScope, selectedQuestion) if (isCurrentFields) { - console.log("добавляю текущее поле") handleAddCurrentField() } else { - console.log("добавляю новое поле") handleAddNewField() } } @@ -99,7 +91,7 @@ export const AmoQuestions: FC = ({ }); }; const SCFworld = (() => { -const obj = { + const obj = { Lead: [], Company: [], Customer: [], @@ -112,11 +104,36 @@ const obj = { }) return obj })() - - - console.log("SCFworld") - console.log(SCFworld) + const [sortedFieldsAllowedFC, setSortedFieldsAllowedFC] = useState(FieldsAllowedFC); + const [sortedFieldsItems, setSortedFieldsItems] = useState(fieldsItems); + const [sortedquestionsItems, setSortedquestionsItems] = useState(questionsItems); + + console.log("допущенные ФОРМА КОНТАКТОВ") + console.log(FieldsAllowedFC) + console.log("фильтрованные") + console.log(sortedFieldsAllowedFC) + console.log("") + console.log("допущенные вапросы") + console.log(questionsItems) + console.log("фильтрованные") + console.log(sortedquestionsItems) + + + const startConstrictor = (substr: string) => { + const a = FieldsAllowedFC.filter((mData) => mData.title.startsWith(substr)) + const b = fieldsItems.filter((mData) => mData.title.startsWith(substr)) + const c = questionsItems.filter((mData) => mData.title.startsWith(substr)) + setSortedFieldsAllowedFC(a); + setSortedFieldsItems(b); + setSortedquestionsItems(c); + } + + useEffect(() => { + setSortedFieldsAllowedFC(FieldsAllowedFC); + setSortedFieldsItems(fieldsItems); + setSortedquestionsItems(questionsItems); + }, [activeScope]) return ( {isSelection && activeScope !== null ? ( - { - setActiveScope(null); - setIsSelection(false); - }} - onLargeBtnClick={() => { - handleAdd(); - setActiveScope(null); - setIsSelection(false); - }} - activeScope={activeScope} - setIsCurrentFields={setIsCurrentFields} - isCurrentFields={isCurrentFields} - /> + <> + + + {/* табличка */} + + { + setActiveScope(null); + setIsSelection(false); + }} + onLargeBtnClick={() => { + handleAdd(); + setActiveScope(null); + setIsSelection(false); + }} + activeScope={activeScope} + setIsCurrentFields={setIsCurrentFields} + isCurrentFields={isCurrentFields} + /> + // Здесь выбираем элемент в табличку // void; + handleScroll: () => void; +}; + +export const CurrentFieldSelect: FC = ({ items, selectedItemId, setSelectedItem, handleScroll }) => { + const theme = useTheme(); + const isMobile = useMediaQuery(theme.breakpoints.down(600)); + + const ref = useRef(null); + const [opened, setOpened] = useState(false); + + const toggleOpened = useCallback(() => { + setOpened((isOpened) => !isOpened); + }, []); + + const onScroll = useCallback((e: React.UIEvent) => { + const scrollHeight = e.currentTarget.scrollHeight; + const scrollTop = e.currentTarget.scrollTop; + const clientHeight = e.currentTarget.clientHeight; + const scrolledToBottom = scrollTop / (scrollHeight - clientHeight) > 0.9; + + if (scrolledToBottom) { + handleScroll(); + } + }, []); + + const currentItem = items.find((item) => item.id === selectedItemId) || null + + return ( + + + + {currentItem?.title || "Выберите поле"} + + check + + {opened && + { }} + activeScope={undefined} + /> + } + + ); +}; diff --git a/src/pages/IntegrationsPage/IntegrationsModal/AmoQuestions/CurrentFields.tsx b/src/pages/IntegrationsPage/IntegrationsModal/Amo/AmoQuestions/CurrentFields.tsx similarity index 98% rename from src/pages/IntegrationsPage/IntegrationsModal/AmoQuestions/CurrentFields.tsx rename to src/pages/IntegrationsPage/IntegrationsModal/Amo/AmoQuestions/CurrentFields.tsx index cbb10bee..2f75ae5a 100644 --- a/src/pages/IntegrationsPage/IntegrationsModal/AmoQuestions/CurrentFields.tsx +++ b/src/pages/IntegrationsPage/IntegrationsModal/Amo/AmoQuestions/CurrentFields.tsx @@ -2,7 +2,7 @@ import { CustomRadioGroup } from "@/components/CustomRadioGroup/CustomRadioGroup import {Box, Typography, useMediaQuery, useTheme} from "@mui/material" import { MinifiedData } from "../types"; import {CustomSelect} from "@/components/CustomSelect/CustomSelect"; -import {CurrentFieldSelect} from "@/pages/IntegrationsPage/IntegrationsModal/AmoQuestions/CurrentFieldSelectMobile"; +import {CurrentFieldSelect} from "@/pages/IntegrationsPage/IntegrationsModal/Amo/AmoQuestions/CurrentFieldSelectMobile"; interface Props { items: MinifiedData[]; diff --git a/src/pages/IntegrationsPage/IntegrationsModal/AmoQuestions/EntitiesQuestions.tsx b/src/pages/IntegrationsPage/IntegrationsModal/Amo/AmoQuestions/EntitiesQuestions.tsx similarity index 93% rename from src/pages/IntegrationsPage/IntegrationsModal/AmoQuestions/EntitiesQuestions.tsx rename to src/pages/IntegrationsPage/IntegrationsModal/Amo/AmoQuestions/EntitiesQuestions.tsx index 89ee68a1..673bce17 100644 --- a/src/pages/IntegrationsPage/IntegrationsModal/AmoQuestions/EntitiesQuestions.tsx +++ b/src/pages/IntegrationsPage/IntegrationsModal/Amo/AmoQuestions/EntitiesQuestions.tsx @@ -41,6 +41,13 @@ export const EntitiesQuestions: FC = ({ }) => { const theme = useTheme(); const isMobile = useMediaQuery(theme.breakpoints.down(600)); + console.log("--------------") + console.log("EntitiesQuestions") + console.log("вопросы") + console.log(items) + console.log("ФК") + console.log(FieldsAllowedFC) + console.log("------------------------------") return ( = ({ flexGrow: 1, width: "100%", height: "346px", + overflow: "auto" }} > diff --git a/src/pages/IntegrationsPage/IntegrationsModal/AmoQuestions/Item/AnswerItem/AnswerItem.tsx b/src/pages/IntegrationsPage/IntegrationsModal/Amo/AmoQuestions/Item/AnswerItem/AnswerItem.tsx similarity index 100% rename from src/pages/IntegrationsPage/IntegrationsModal/AmoQuestions/Item/AnswerItem/AnswerItem.tsx rename to src/pages/IntegrationsPage/IntegrationsModal/Amo/AmoQuestions/Item/AnswerItem/AnswerItem.tsx diff --git a/src/pages/IntegrationsPage/IntegrationsModal/AmoQuestions/Item/IconBtnAdd/IconBtnAdd.tsx b/src/pages/IntegrationsPage/IntegrationsModal/Amo/AmoQuestions/Item/IconBtnAdd/IconBtnAdd.tsx similarity index 100% rename from src/pages/IntegrationsPage/IntegrationsModal/AmoQuestions/Item/IconBtnAdd/IconBtnAdd.tsx rename to src/pages/IntegrationsPage/IntegrationsModal/Amo/AmoQuestions/Item/IconBtnAdd/IconBtnAdd.tsx diff --git a/src/pages/IntegrationsPage/IntegrationsModal/AmoQuestions/Item/Item.tsx b/src/pages/IntegrationsPage/IntegrationsModal/Amo/AmoQuestions/Item/Item.tsx similarity index 100% rename from src/pages/IntegrationsPage/IntegrationsModal/AmoQuestions/Item/Item.tsx rename to src/pages/IntegrationsPage/IntegrationsModal/Amo/AmoQuestions/Item/Item.tsx diff --git a/src/pages/IntegrationsPage/IntegrationsModal/AmoQuestions/ItemDetailsView/ItemDetailsView.tsx b/src/pages/IntegrationsPage/IntegrationsModal/Amo/AmoQuestions/ItemDetailsView/ItemDetailsView.tsx similarity index 93% rename from src/pages/IntegrationsPage/IntegrationsModal/AmoQuestions/ItemDetailsView/ItemDetailsView.tsx rename to src/pages/IntegrationsPage/IntegrationsModal/Amo/AmoQuestions/ItemDetailsView/ItemDetailsView.tsx index dbb25e3f..86e6c10d 100644 --- a/src/pages/IntegrationsPage/IntegrationsModal/AmoQuestions/ItemDetailsView/ItemDetailsView.tsx +++ b/src/pages/IntegrationsPage/IntegrationsModal/Amo/AmoQuestions/ItemDetailsView/ItemDetailsView.tsx @@ -25,12 +25,7 @@ export const ItemDetailsView: FC = ({ setActiveScope, deleteHC, }) => { - console.log(selectedQuestions) const theme = useTheme(); - console.log("items") - console.log(items) - console.log("selectedQuestions") - console.log(selectedQuestions) return ( = ({ handlePrevStep, handleNextStep, }) => { + const [sortedTagsItems, setSortedTagsItems] = useState(tagsItems); + const [isSelection, setIsSelection] = useState(false); const [activeScope, setActiveScope] = useState(null); const [selectedTag, setSelectedTag] = useState(null); @@ -39,6 +42,10 @@ export const AmoTags: FC = ({ type: "tag", }); }; + const startConstrictor = (substr: string) => { + const a = tagsItems.filter((mData) => mData.title.startsWith(substr)) + setSortedTagsItems(a); + } return ( = ({ > {isSelection && activeScope !== null ? ( // Здесь выбираем элемент в табличку - { - setActiveScope(null); - setIsSelection(false); - }} - onLargeBtnClick={() => { - handleAdd(); - setActiveScope(null); - setIsSelection(false); - }} - /> + <> + + { + setActiveScope(null); + setIsSelection(false); + }} + onLargeBtnClick={() => { + handleAdd(); + setActiveScope(null); + setIsSelection(false); + }} + /> + ) : ( // Табличка = ({ }) => { const theme = useTheme(); + const isMobile = useMediaQuery(theme.breakpoints.down(600)); + return ( = ({ padding: "10px", boxShadow: "0 0 20px rgba(0, 0, 0, 0.15)", display: "flex", + flexDirection: isMobile ? "column" : "row", }} > void +} + +export const DataConstrictor = ({ + isError, + constrictor, + +}: Props) => { + const theme = useTheme(); + const isMobile = useMediaQuery(theme.breakpoints.down(600)); + + const [text, setText] = useState("") + const errCalc = isError && text.length > 0 + + const debouncedTestHC = useDebouncedCallback( + (value: string) => { + constrictor(value) + }, + 700 + ); + + return 0 + ? + { + setText("") + constrictor("") + }} + > + + + : + null + } + onChange={({ target }) => { + setText(target.value) + debouncedTestHC(target.value) + }} + /> +} \ No newline at end of file diff --git a/src/pages/IntegrationsPage/IntegrationsModal/DealPerformers/DealPerformers.tsx b/src/pages/IntegrationsPage/IntegrationsModal/Amo/DealPerformers/DealPerformers.tsx similarity index 94% rename from src/pages/IntegrationsPage/IntegrationsModal/DealPerformers/DealPerformers.tsx rename to src/pages/IntegrationsPage/IntegrationsModal/Amo/DealPerformers/DealPerformers.tsx index 6e90ddc6..43198363 100644 --- a/src/pages/IntegrationsPage/IntegrationsModal/DealPerformers/DealPerformers.tsx +++ b/src/pages/IntegrationsPage/IntegrationsModal/Amo/DealPerformers/DealPerformers.tsx @@ -1,7 +1,7 @@ import { Box, useMediaQuery, useTheme } from "@mui/material"; import { FC } from "react"; import { StepButtonsBlock } from "../StepButtonsBlock/StepButtonsBlock"; -import { CustomSelect } from "../../../../components/CustomSelect/CustomSelect"; +import { CustomSelect } from "../../../../../components/CustomSelect/CustomSelect"; import { MinifiedData } from "../types"; type Props = { diff --git a/src/pages/IntegrationsPage/IntegrationsModal/PipelineSteps/PipelineSteps.tsx b/src/pages/IntegrationsPage/IntegrationsModal/Amo/PipelineSteps/PipelineSteps.tsx similarity index 91% rename from src/pages/IntegrationsPage/IntegrationsModal/PipelineSteps/PipelineSteps.tsx rename to src/pages/IntegrationsPage/IntegrationsModal/Amo/PipelineSteps/PipelineSteps.tsx index cc009a46..3a7b55fc 100644 --- a/src/pages/IntegrationsPage/IntegrationsModal/PipelineSteps/PipelineSteps.tsx +++ b/src/pages/IntegrationsPage/IntegrationsModal/Amo/PipelineSteps/PipelineSteps.tsx @@ -1,8 +1,8 @@ import { Box, useMediaQuery, useTheme } from "@mui/material"; import { FC } from "react"; import { StepButtonsBlock } from "../StepButtonsBlock/StepButtonsBlock"; -import { CustomSelect } from "../../../../components/CustomSelect/CustomSelect"; -import { CustomRadioGroup } from "../../../../components/CustomRadioGroup/CustomRadioGroup"; +import { CustomSelect } from "../../../../../components/CustomSelect/CustomSelect"; +import { CustomRadioGroup } from "../../../../../components/CustomRadioGroup/CustomRadioGroup"; import { MinifiedData } from "../types"; type Props = { diff --git a/src/pages/IntegrationsPage/IntegrationsModal/Pipelines/Pipelines.tsx b/src/pages/IntegrationsPage/IntegrationsModal/Amo/Pipelines/Pipelines.tsx similarity index 91% rename from src/pages/IntegrationsPage/IntegrationsModal/Pipelines/Pipelines.tsx rename to src/pages/IntegrationsPage/IntegrationsModal/Amo/Pipelines/Pipelines.tsx index 8953a065..46026217 100644 --- a/src/pages/IntegrationsPage/IntegrationsModal/Pipelines/Pipelines.tsx +++ b/src/pages/IntegrationsPage/IntegrationsModal/Amo/Pipelines/Pipelines.tsx @@ -1,8 +1,8 @@ import { Box, useMediaQuery, useTheme } from "@mui/material"; import { FC } from "react"; import { StepButtonsBlock } from "../StepButtonsBlock/StepButtonsBlock"; -import { CustomSelect } from "../../../../components/CustomSelect/CustomSelect"; -import { CustomRadioGroup } from "../../../../components/CustomRadioGroup/CustomRadioGroup"; +import { CustomSelect } from "../../../../../components/CustomSelect/CustomSelect"; +import { CustomRadioGroup } from "../../../../../components/CustomRadioGroup/CustomRadioGroup"; import { MinifiedData } from "../types"; type Props = { diff --git a/src/pages/IntegrationsPage/IntegrationsModal/SettingsBlock/AmoSettingsBlock.tsx b/src/pages/IntegrationsPage/IntegrationsModal/Amo/SettingsBlock/AmoSettingsBlock.tsx similarity index 100% rename from src/pages/IntegrationsPage/IntegrationsModal/SettingsBlock/AmoSettingsBlock.tsx rename to src/pages/IntegrationsPage/IntegrationsModal/Amo/SettingsBlock/AmoSettingsBlock.tsx diff --git a/src/pages/IntegrationsPage/IntegrationsModal/SettingsBlock/SettingItem/ResponsiblePerson/ResponsiblePerson.tsx b/src/pages/IntegrationsPage/IntegrationsModal/Amo/SettingsBlock/SettingItem/ResponsiblePerson/ResponsiblePerson.tsx similarity index 100% rename from src/pages/IntegrationsPage/IntegrationsModal/SettingsBlock/SettingItem/ResponsiblePerson/ResponsiblePerson.tsx rename to src/pages/IntegrationsPage/IntegrationsModal/Amo/SettingsBlock/SettingItem/ResponsiblePerson/ResponsiblePerson.tsx diff --git a/src/pages/IntegrationsPage/IntegrationsModal/SettingsBlock/SettingItem/SelectedParameter/SelectedParameter.tsx b/src/pages/IntegrationsPage/IntegrationsModal/Amo/SettingsBlock/SettingItem/SelectedParameter/SelectedParameter.tsx similarity index 100% rename from src/pages/IntegrationsPage/IntegrationsModal/SettingsBlock/SettingItem/SelectedParameter/SelectedParameter.tsx rename to src/pages/IntegrationsPage/IntegrationsModal/Amo/SettingsBlock/SettingItem/SelectedParameter/SelectedParameter.tsx diff --git a/src/pages/IntegrationsPage/IntegrationsModal/SettingsBlock/SettingItem/SettingItem.tsx b/src/pages/IntegrationsPage/IntegrationsModal/Amo/SettingsBlock/SettingItem/SettingItem.tsx similarity index 100% rename from src/pages/IntegrationsPage/IntegrationsModal/SettingsBlock/SettingItem/SettingItem.tsx rename to src/pages/IntegrationsPage/IntegrationsModal/Amo/SettingsBlock/SettingItem/SettingItem.tsx diff --git a/src/pages/IntegrationsPage/IntegrationsModal/SettingsBlock/SettingItem/SettingItemHeader/SettingItemHeader.tsx b/src/pages/IntegrationsPage/IntegrationsModal/Amo/SettingsBlock/SettingItem/SettingItemHeader/SettingItemHeader.tsx similarity index 100% rename from src/pages/IntegrationsPage/IntegrationsModal/SettingsBlock/SettingItem/SettingItemHeader/SettingItemHeader.tsx rename to src/pages/IntegrationsPage/IntegrationsModal/Amo/SettingsBlock/SettingItem/SettingItemHeader/SettingItemHeader.tsx diff --git a/src/pages/IntegrationsPage/IntegrationsModal/StepButtonsBlock/StepButtonsBlock.tsx b/src/pages/IntegrationsPage/IntegrationsModal/Amo/StepButtonsBlock/StepButtonsBlock.tsx similarity index 100% rename from src/pages/IntegrationsPage/IntegrationsModal/StepButtonsBlock/StepButtonsBlock.tsx rename to src/pages/IntegrationsPage/IntegrationsModal/Amo/StepButtonsBlock/StepButtonsBlock.tsx diff --git a/src/pages/IntegrationsPage/IntegrationsModal/types.ts b/src/pages/IntegrationsPage/IntegrationsModal/Amo/types.ts similarity index 100% rename from src/pages/IntegrationsPage/IntegrationsModal/types.ts rename to src/pages/IntegrationsPage/IntegrationsModal/Amo/types.ts diff --git a/src/pages/IntegrationsPage/IntegrationsModal/useAmoIntegration.ts b/src/pages/IntegrationsPage/IntegrationsModal/Amo/useAmoIntegration.ts similarity index 98% rename from src/pages/IntegrationsPage/IntegrationsModal/useAmoIntegration.ts rename to src/pages/IntegrationsPage/IntegrationsModal/Amo/useAmoIntegration.ts index b48e5b4d..e20b272d 100644 --- a/src/pages/IntegrationsPage/IntegrationsModal/useAmoIntegration.ts +++ b/src/pages/IntegrationsPage/IntegrationsModal/Amo/useAmoIntegration.ts @@ -14,7 +14,7 @@ import { } from "@/api/integration"; import { AnyTypedQuizQuestion } from "@frontend/squzanswerer"; -const SIZE = 175; +const SIZE = 275; interface Props { isModalOpen: boolean; @@ -101,8 +101,6 @@ export const useAmoIntegration = ({ isModalOpen, isTryRemoveAccount, quizID, que if (gottenList !== null) { Object.keys(gottenList.QuestionID).forEach((qId) => { - console.log(qId) - console.log(questions) const q = questions.find(e=>e.backendId === Number(qId)) || {} gottenQuestions[key as QuestionKeys].push({ id: qId, @@ -126,7 +124,6 @@ export const useAmoIntegration = ({ isModalOpen, isTryRemoveAccount, quizID, que amoId: MAP[key].toString(), }) } - console.log(list) setSelectedCurrentFields(list) } } diff --git a/src/pages/IntegrationsPage/IntegrationsModal/AmoQuestions/CurrentFieldSelectMobile.tsx b/src/pages/IntegrationsPage/IntegrationsModal/AmoQuestions/CurrentFieldSelectMobile.tsx deleted file mode 100644 index c5901120..00000000 --- a/src/pages/IntegrationsPage/IntegrationsModal/AmoQuestions/CurrentFieldSelectMobile.tsx +++ /dev/null @@ -1,189 +0,0 @@ -import * as React from "react"; -import { FC, useCallback, useMemo, useRef, useState } from "react"; -import { Avatar, MenuItem, Select, SelectChangeEvent, Typography, useMediaQuery, useTheme, Box } from "@mui/material"; -import arrow_down from "@icons/arrow_down.svg"; -import { MinifiedData } from "@/pages/IntegrationsPage/IntegrationsModal/types"; - -type CustomSelectProps = { - items: MinifiedData[] | []; - selectedItemId: string | null; - setSelectedItem: (value: string | null) => void; - handleScroll: () => void; -}; - -export const CurrentFieldSelect: FC = ({ items, selectedItemId, setSelectedItem, handleScroll }) => { - const theme = useTheme(); - const isMobile = useMediaQuery(theme.breakpoints.down(600)); - - const ref = useRef(null); - const [opened, setOpened] = useState(false); - - const toggleOpened = useCallback(() => { - setOpened((isOpened) => !isOpened); - }, []); - - const onScroll = useCallback((e: React.UIEvent) => { - const scrollHeight = e.currentTarget.scrollHeight; - const scrollTop = e.currentTarget.scrollTop; - const clientHeight = e.currentTarget.clientHeight; - const scrolledToBottom = scrollTop / (scrollHeight - clientHeight) > 0.9; - - if (scrolledToBottom) { - handleScroll(); - } - }, []); - - const currentItem = useMemo(() => items.find((item) => item.id === selectedItemId) || null, [selectedItemId, items]); - - const menuItems = useMemo(() => { - if (items.length !== 0) { - return items.map((item) => ( - - - - {item.title} - - - {item.subTitle} - - - - - )); - } - return ( - - нет данных - - ); - }, [items, selectedItemId]); - - return ( - - { - if (ref.current !== null) ref.current?.click(); - }} - > - - {currentItem?.title || "Выберите поле"} - - check - - - - ); -}; diff --git a/src/pages/IntegrationsPage/PartnersBoard/PartnersBoard.tsx b/src/pages/IntegrationsPage/PartnersBoard/PartnersBoard.tsx index da684628..9834371e 100644 --- a/src/pages/IntegrationsPage/PartnersBoard/PartnersBoard.tsx +++ b/src/pages/IntegrationsPage/PartnersBoard/PartnersBoard.tsx @@ -16,7 +16,7 @@ const AnalyticsModal = lazy(() => ); const AmoCRMModal = lazy(() => - import("../IntegrationsModal/AmoCRMModal").then((module) => ({ + import("../IntegrationsModal/Amo/AmoCRMModal").then((module) => ({ default: module.AmoCRMModal, })) ); diff --git a/src/pages/QuizAnswersPage/CardAnswer.tsx b/src/pages/QuizAnswersPage/CardAnswer.tsx index e422cce3..07c72a77 100644 --- a/src/pages/QuizAnswersPage/CardAnswer.tsx +++ b/src/pages/QuizAnswersPage/CardAnswer.tsx @@ -297,8 +297,6 @@ export const CardAnswer: FC = ({ }} > {resultsAnswer.map((answer, id) => { - // console.log(answer) - // console.log(answer.content) let titleQuestion; let typeOuestion; let typeQuestionFile; @@ -308,7 +306,6 @@ export const CardAnswer: FC = ({ let idAnswer = answer.question_id; //айди вопроса у ответа for (i in quest) { if (quest[i].backendId === idAnswer) { - console.log(quest[i]) titleQuestion = quest[i].title; typeOuestion = quest[i].type; typeQuestionFile = quest[i].content.type; diff --git a/src/pages/Tariffs/Tariffs.tsx b/src/pages/Tariffs/Tariffs.tsx index 8444779c..13f27f50 100644 --- a/src/pages/Tariffs/Tariffs.tsx +++ b/src/pages/Tariffs/Tariffs.tsx @@ -134,18 +134,14 @@ function TariffPage() { //Если нам хватает денежек - покупаем тариф const [data, payError] = await cartApi.pay(); - console.log(payError) if (payError || !data) { //если денег не хватило if (payError?.includes("insufficient funds") || payError?.includes("Payment Required")) { let cashDif = Number(payError.split(":")[1]); - console.log(payError) - console.log(cashDif) var link = document.createElement("a"); link.href = `https://${isTestServer ? "s" : ""}hub.pena.digital/quizpayment?action=squizpay&dif=${cashDif}&data=${token}&userid=${userId}`; document.body.appendChild(link); - console.log(link) link.click(); return; } @@ -439,11 +435,7 @@ const outCart = (cart: string[]) => { } let saveCart = JSON.parse(localStorage.getItem("saveCart") || "[]") || []; - console.log("saveCart") - console.log(saveCart) if (!Array.isArray(saveCart)) saveCart = [] - console.log("saveCart") - console.log(saveCart) saveCart = saveCart.push(id); localStorage.setItem("saveCart", JSON.stringify(saveCart)); }); diff --git a/src/pages/createQuize/CreateButtons.tsx b/src/pages/createQuize/CreateButtons.tsx index 04e919cb..915b6856 100644 --- a/src/pages/createQuize/CreateButtons.tsx +++ b/src/pages/createQuize/CreateButtons.tsx @@ -9,7 +9,6 @@ export default function CreateButtons({ mt }: string) { const navigate = useNavigate(); const theme = useTheme(); const user = useUserStore(); - console.log(user) const isMobile = useMediaQuery(theme.breakpoints.down(500)); return ( diff --git a/src/pages/startPage/EditPage.tsx b/src/pages/startPage/EditPage.tsx index c05c4def..a24d5b70 100755 --- a/src/pages/startPage/EditPage.tsx +++ b/src/pages/startPage/EditPage.tsx @@ -21,7 +21,7 @@ import { AnyTypedQuizQuestion } from "@frontend/squzanswerer"; import { ModalInfoWhyCantCreate } from "./ModalInfoWhyCantCreate"; import { ConfirmLeaveModal } from "./ConfirmLeaveModal"; import { checkQuestionHint } from "@utils/checkQuestionHint"; -import AmoTokenExpiredDialog from "../IntegrationsPage/IntegrationsModal/AmoTokenExpiredDialog"; +import AmoTokenExpiredDialog from "../IntegrationsPage/IntegrationsModal/Amo/AmoTokenExpiredDialog"; import { useAmoAccount } from "@/api/integration"; interface Props { diff --git a/src/ui_kit/Header/Avatar.tsx b/src/ui_kit/Header/Avatar.tsx deleted file mode 100755 index 069f7668..00000000 --- a/src/ui_kit/Header/Avatar.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { Avatar, Box, SxProps, Theme, Typography } from "@mui/material"; - -interface Props { - sx: SxProps; -} -export default function CustomAvatar({ sx }: Props) { - return ( - - - AA - - - - - - - - - - ); -} diff --git a/src/ui_kit/Header/NavMenuItem.tsx b/src/ui_kit/Header/NavMenuItem.tsx deleted file mode 100755 index d602c3c8..00000000 --- a/src/ui_kit/Header/NavMenuItem.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { Link, Typography, useTheme } from "@mui/material"; - -interface Props { - text: string; - isActive?: boolean; - onClick?: () => void; - href?: string; -} - -export default function NavMenuItem({ - href, - onClick, - text, - isActive = false, -}: Props) { - const theme = useTheme(); - - return ( - - я есть навбар меню итем - - {text} - - - ); -} diff --git a/src/ui_kit/Header/NavbarCollapsed.tsx b/src/ui_kit/Header/NavbarCollapsed.tsx deleted file mode 100755 index cce4ddb2..00000000 --- a/src/ui_kit/Header/NavbarCollapsed.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import { IconButton, useTheme } from "@mui/material"; -import SectionWrapper from "../SectionWrapper"; -import MenuIcon from "@mui/icons-material/Menu"; -import PenaLogo from "@ui_kit/PenaLogo"; - -interface Props { - isLoggedIn: boolean; -} - -export default function NavbarCollapsed({ isLoggedIn }: Props) { - const theme = useTheme(); - - return ( - - я подписан как навбар коллапсед - - - - - - ); -}