From 5258d3f390618f09fcc6b8bcce39ecb6d4c74134 Mon Sep 17 00:00:00 2001 From: Eduard-Constantin Ibinceanu Date: Fri, 23 Feb 2024 18:14:33 +0000 Subject: [PATCH 1/3] Remove question image from practice mode --- app/practice/page.tsx | 9 ++------- components/QuizForm.tsx | 15 ++------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/app/practice/page.tsx b/app/practice/page.tsx index b2234f1..8847140 100644 --- a/app/practice/page.tsx +++ b/app/practice/page.tsx @@ -1,6 +1,6 @@ "use client"; -import { useState, useEffect } from "react"; +import { useState } from "react"; import { gql, useQuery } from "@apollo/client"; import type { NextPage } from "next"; import QuizForm from "@azure-fundamentals/components/QuizForm"; @@ -32,13 +32,9 @@ const questionsQuery = gql` const Practice: NextPage<{ searchParams: { url: string; name: string } }> = ({ searchParams, }) => { - const [currentQuestionIndex, setCurrentQuestionIndex] = useState(1); - const [windowWidth, setWindowWidth] = useState(0); const { url } = searchParams; + const [currentQuestionIndex, setCurrentQuestionIndex] = useState(1); const editedUrl = url.substring(0, url.lastIndexOf("/") + 1); - useEffect(() => { - setWindowWidth(window.innerWidth); - }, []); const { loading, error, data } = useQuery(questionQuery, { variables: { id: currentQuestionIndex - 1, link: url }, @@ -64,7 +60,6 @@ const Practice: NextPage<{ searchParams: { url: string; name: string } }> = ({ return (
void; currentQuestionIndex: number; totalQuestions: number; - windowWidth: number; link: string; }; @@ -21,7 +20,6 @@ const QuizForm: FC = ({ handleNextQuestion, currentQuestionIndex, totalQuestions, - windowWidth, link, }) => { const { register, handleSubmit, reset } = useForm(); @@ -57,7 +55,6 @@ const QuizForm: FC = ({ if (isLoading) return

Loading...

; const { question, options, images } = questionSet!; - const imgUrl: string = `/api/og?question=${question}&width=${windowWidth}`; const noOfAnswers = options.filter((el) => el.isAnswer === true).length; return ( @@ -147,16 +144,8 @@ const QuizForm: FC = ({
- question - {images && ( +

{question}

+ {images.length !== 0 && (