diff --git a/.husky/pre-commit b/.husky/pre-commit index 12ac302..017e2a1 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - yarn lint-staged --allow-empty diff --git a/lib/components/ViewPublicationPage/ResultForm.tsx b/lib/components/ViewPublicationPage/ResultForm.tsx index e5f01e4..cd620c6 100644 --- a/lib/components/ViewPublicationPage/ResultForm.tsx +++ b/lib/components/ViewPublicationPage/ResultForm.tsx @@ -10,12 +10,10 @@ import { useVkMetricsGoals } from "@/utils/hooks/metrics/useVkMetricsGoals"; import { useYandexMetricsGoals } from "@/utils/hooks/metrics/useYandexMetricsGoals"; import { DESIGN_LIST } from "@/utils/designList"; import { quizThemes } from "@utils/themes/Publication/themePublication"; - -import YoutubeEmbedIframe from "./tools/YoutubeEmbedIframe"; - import { NameplateLogo } from "@icons/NameplateLogo"; import type { QuizQuestionResult } from "@/model/questionTypes/result"; +import QuizVideo from "@/ui_kit/VideoIframe/VideoIframe"; type ResultFormProps = { resultQuestion: QuizQuestionResult; @@ -117,7 +115,7 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => { }} > {!resultQuestion?.content.useImage && resultQuestion.content.video && ( - { const theme = useTheme(); @@ -54,7 +53,7 @@ export const StartPageViewPublication = () => { /> ) : settings.cfg.startpage.background.type === "video" ? ( settings.cfg.startpage.background.video ? ( - - + Вопрос не выбран @@ -80,7 +86,10 @@ export default function ViewPublicationPage() { currentQuestion={currentQuestion} currentQuestionStepNumber={currentQuestionStepNumber} prevButton={ - + } nextButton={ } - questionSelect={} + questionSelect={ + + } /> ); break; } case "contactform": { - quizStepElement = ; + quizStepElement = ( + + ); break; } default: notReachable(currentQuizStep); } + const preloadLinks = new Set([ + ...extractImageLinksFromQuestion(currentQuestion), + ...extractImageLinksFromQuestion(nextQuestion), + ]); + return ( - {quizStepElement} + + + {Array.from(preloadLinks).map((link) => ( + + ))} + + {quizStepElement} + ); } diff --git a/lib/components/ViewPublicationPage/questions/File/UploadFile.tsx b/lib/components/ViewPublicationPage/questions/File/UploadFile.tsx index e9d0f2c..c7bb3d5 100644 --- a/lib/components/ViewPublicationPage/questions/File/UploadFile.tsx +++ b/lib/components/ViewPublicationPage/questions/File/UploadFile.tsx @@ -58,12 +58,10 @@ export const UploadFile = ({ currentQuestion, setModalWarningType, isSending, se }, qid: quizId, }); - + console.log(data); await sendAnswer({ questionId: currentQuestion.id, - body: `https://s3.timeweb.cloud/3c580be9-cf31f296-d055-49cf-b39e-30c7959dc17b/squizanswer/${quizId}/${ - currentQuestion.id - }/${data!.data.fileIDMap[currentQuestion.id]}`, + body: `${data!.data.fileIDMap[currentQuestion.id]}`, qid: quizId, preview, }); diff --git a/lib/components/ViewPublicationPage/questions/Page/index.tsx b/lib/components/ViewPublicationPage/questions/Page/index.tsx index 48e1b97..333ee41 100644 --- a/lib/components/ViewPublicationPage/questions/Page/index.tsx +++ b/lib/components/ViewPublicationPage/questions/Page/index.tsx @@ -1,8 +1,6 @@ import { Box, Typography, useTheme } from "@mui/material"; - -import YoutubeEmbedIframe from "@/components/ViewPublicationPage/tools/YoutubeEmbedIframe"; - import type { QuizQuestionPage } from "@model/questionTypes/page"; +import QuizVideo from "@/ui_kit/VideoIframe/VideoIframe"; type PageProps = { currentQuestion: QuizQuestionPage; @@ -35,32 +33,35 @@ export const Page = ({ currentQuestion }: PageProps) => { }} > {currentQuestion.content.useImage ? ( - - - + > + + + ) ) : ( - diff --git a/lib/components/ViewPublicationPage/tools/YoutubeEmbedIframe.tsx b/lib/components/ViewPublicationPage/tools/YoutubeEmbedIframe.tsx deleted file mode 100644 index 26d3864..0000000 --- a/lib/components/ViewPublicationPage/tools/YoutubeEmbedIframe.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import { Box, SxProps } from "@mui/material"; - -interface Props { - videoUrl: string; - containerSX?: SxProps; -} - -export default function YoutubeEmbedIframe({ videoUrl, containerSX }: Props) { - const extractYoutubeVideoId = - /(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/gi; - const videoId = extractYoutubeVideoId.exec(videoUrl)?.[1]; - // if (!videoId) return null; - - const embedUrl = `https://www.youtube.com/embed/${videoId}?controls=0&autoplay=1&modestbranding=0&showinfo=0&disablekb=1&mute=1&loop=1`; - // https://www.youtube.com/shorts/9VgqBPd6RPA - // https://www.youtube.com/watch?v=I2N8hTHhvGY - return ( - - - {/*