Skip to content

Commit

Permalink
pretier
Browse files Browse the repository at this point in the history
  • Loading branch information
Aditya-PS-05 committed Oct 27, 2024
1 parent 88a0aff commit 93447d3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 129 deletions.
66 changes: 1 addition & 65 deletions src/pages/challenges/challenge2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ const DataStructuresQuiz = () => {
}, [timeLeft]);

// Handle option selection
const handleOptionSelect = (option:string) => {
const handleOptionSelect = (option: string) => {
setSelectedOption(option);
if (option === questions[currentQuestionIndex].answer) {
setCorrectAnswers(correctAnswers + 1);
Expand All @@ -222,7 +222,6 @@ const DataStructuresQuiz = () => {
setCurrentQuestionIndex(currentQuestionIndex + 1);
setSelectedOption("");
}

};

// Function to finish the quiz
Expand Down Expand Up @@ -255,69 +254,6 @@ const DataStructuresQuiz = () => {
};

return (
// <Layout
// title="Data Structures Quiz"
// description="Test your knowledge of data structures with this quiz."
// >
// <div className="bg-gray-200 max-w-2xl mx-auto rounde-2xl my-10 rounded-3xl p-10">
// <h2 className="text-center">Data Structures Challenge-2</h2>
// {showResult ? (
// <div>
// <h2>
// Your Score: {correctAnswers} out of {questions.length}
// </h2>
// <h2>Time Spent: {formatTime(timeSpent)}</h2>{" "}
// {/* Show time spent here */}
// <div style={{ textAlign: "left", marginTop: "20px" }}> <h4 style={{ color: "black", marginBottom: "10px" }}>Review Your Answers:</h4>
// <ul>
// {questions.map((question, index) => (
// <li key={index} style={{ marginBottom: "15px" }}>
// <p><strong>{question.question}</strong></p>
// <p>
// Your Answer: <span style={{ color: userAnswers[index] === question.answer ? "green" : "red" }}>
// {userAnswers[index]}
// </span>
// </p>
// <p>Correct Answer: <span style={{ color: "green" }}>{question.answer}</span></p>
// </li>
// ))}
// </ul>
// </div>
// </div>
// ) : (
// <div>
// <h3 className="text-center">Time Left: {formatTime(timeLeft)}</h3>{" "}
// {/* Show running timer */}
// <div className="bg-white rounded-2xl p-4">
// <h3>{questions[currentQuestionIndex].question}</h3>
// <div>
// {questions[currentQuestionIndex].options.map(
// (option, index) => (
// <div
// key={index}
// className="text-left my-2 bg-white rounded-md p-3 w-full"
// style={{
// border: selectedOption === option ? "2px solid orange" : "1px solid #ddd",
// backgroundColor: selectedOption === option ? "rgba(255, 165, 0, 0.1)" : "white",
// cursor: "pointer",
// }}
// onClick={() => handleOptionSelect(option)}
// >
// {option}
// </div>
// )
// )}
// </div>
// <button className="mt-5 bg-gray-800 rounded-lg text-white border border-gray-800 p-3 disabled:bg-gray-500 disabled:border-gray-500 disabled:cursor-not-allowed" onClick={handleNextQuestion} disabled={!selectedOption}>
// Next Question
// </button>
// <button className="mt-5 bg-gray-100 border border-gray-800 rounded-lg text-gray-800 ml-2 p-3" onClick={handleSubmitQuiz}>Submit Quiz</button>
// </div>
// </div>
// )}
// </div>
// </Layout>

<Layout
title="Data Structures Quiz"
description="Test your knowledge of data structures with this quiz."
Expand Down
65 changes: 1 addition & 64 deletions src/pages/challenges/challenge3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ const DataStructuresQuiz = () => {
}, [timeLeft]);

// Handle option selection
const handleOptionSelect = (option:string) => {
const handleOptionSelect = (option: string) => {
setSelectedOption(option);
if (option === questions[currentQuestionIndex].answer) {
setCorrectAnswers(correctAnswers + 1);
Expand Down Expand Up @@ -340,69 +340,6 @@ const DataStructuresQuiz = () => {
};

return (
// <Layout
// title="Data Structures Quiz"
// description="Test your knowledge of data structures with this quiz."
// >
// <div className="bg-gray-200 max-w-2xl mx-auto rounde-2xl my-10 rounded-3xl p-10">
// <h2 className="text-center">Advanced Data Structures Challenge</h2>
// {showResult ? (
// <div>
// <h2>
// Your Score: {correctAnswers} out of {questions.length}
// </h2>
// <h2>Time Spent: {formatTime(timeSpent)}</h2>{" "}
// {/* Show time spent here */}
// <div style={{ textAlign: "left", marginTop: "20px" }}> <h4 style={{ color: "black", marginBottom: "10px" }}>Review Your Answers:</h4>
// <ul>
// {questions.map((question, index) => (
// <li key={index} style={{ marginBottom: "15px" }}>
// <p><strong>{question.question}</strong></p>
// <p>
// Your Answer: <span style={{ color: userAnswers[index] === question.answer ? "green" : "red" }}>
// {userAnswers[index]}
// </span>
// </p>
// <p>Correct Answer: <span style={{ color: "green" }}>{question.answer}</span></p>
// </li>
// ))}
// </ul>
// </div>
// </div>
// ) : (
// <div>
// <h3 className="text-center">Time Left: {formatTime(timeLeft)}</h3>{" "}
// {/* Show running timer */}
// <div className="bg-white rounded-2xl p-4">
// <h3>{questions[currentQuestionIndex].question}</h3>
// <div>
// {questions[currentQuestionIndex].options.map(
// (option, index) => (
// <div
// key={index}
// className="text-left my-2 bg-white rounded-md p-3 w-full"
// style={{
// border: selectedOption === option ? "2px solid orange" : "1px solid #ddd",
// backgroundColor: selectedOption === option ? "rgba(255, 165, 0, 0.1)" : "white",
// cursor: "pointer",
// }}
// onClick={() => handleOptionSelect(option)}
// >
// {option}
// </div>
// )
// )}
// </div>
// <button className="mt-5 bg-gray-800 rounded-lg text-white border border-gray-800 p-3 disabled:bg-gray-500 disabled:border-gray-500 disabled:cursor-not-allowed" onClick={handleNextQuestion} disabled={!selectedOption}>
// Next Question
// </button>
// <button className="mt-5 bg-gray-100 border border-gray-800 rounded-lg text-gray-800 ml-2 p-3" onClick={handleSubmitQuiz}>Submit Quiz</button>
// </div>
// </div>
// )}
// </div>
// </Layout>

<Layout
title="Data Structures Quiz"
description="Test your knowledge of data structures with this quiz."
Expand Down

0 comments on commit 93447d3

Please sign in to comment.