From 9c7a9882ed196e89da55494479ab84a7464a0870 Mon Sep 17 00:00:00 2001 From: Suvodip Date: Tue, 30 Jul 2024 20:59:12 +0530 Subject: [PATCH] s1 --- app/components/ContinueLearning.tsx | 2 +- app/components/KnowledgeQuests.tsx | 8 ++--- app/components/ProgressReview.tsx | 10 ++---- app/components/QuizzesScore.tsx | 2 +- app/components/TopPerformers.tsx | 18 +++++----- app/routes/sign-in.tsx | 54 +++++++++++++++++++++++++++++ 6 files changed, 72 insertions(+), 22 deletions(-) create mode 100644 app/routes/sign-in.tsx diff --git a/app/components/ContinueLearning.tsx b/app/components/ContinueLearning.tsx index efc3b51..ad9dbd3 100644 --- a/app/components/ContinueLearning.tsx +++ b/app/components/ContinueLearning.tsx @@ -41,7 +41,7 @@ export default function ContinueLearning() { return (
-

Continue Learning

+

Continue Learning

{courseData.map(data=>(
diff --git a/app/components/KnowledgeQuests.tsx b/app/components/KnowledgeQuests.tsx index 6f0342c..49b61f2 100644 --- a/app/components/KnowledgeQuests.tsx +++ b/app/components/KnowledgeQuests.tsx @@ -49,10 +49,10 @@ export default function KnowledgeQuests() {
-

{data.title}

-

{data.challenge}

-

{data.question}

-
+

{data.title}

+

{data.challenge}

+

{data.question}

+
diff --git a/app/components/ProgressReview.tsx b/app/components/ProgressReview.tsx index 05ba6ac..8e2c68f 100644 --- a/app/components/ProgressReview.tsx +++ b/app/components/ProgressReview.tsx @@ -41,7 +41,7 @@ export default function Index() { return res.json(); }) .then((data) => { - // console.log('Fetched data:', data); + console.log('Fetched data:', data); // Extract the modules array from the response if (data && Array.isArray(data.modules)) { setQuizModuleData(data.modules); @@ -93,11 +93,7 @@ export default function Index() {
{moduleData.quizzes.map((quizData) => ( -
showModal(quizData)} - className="flex flex-row justify-between place-items-center hover:bg-[#FFF4EA] duration-500 border-b-[1px] border-b-[#CFCFCF] p-6 cursor-pointer" - key={quizData.quizId} - > +
showModal(quizData)} className="flex flex-row justify-between place-items-center hover:bg-[#FFF4EA] duration-500 border-b-[1px] border-b-[#CFCFCF] p-6 cursor-pointer" key={quizData.quizId}>

#{quizData.quizId} {quizData.quizName} @@ -113,7 +109,7 @@ export default function Index() { {quizData.attendQuestion}/ {quizData.totalQuestion}

- +

))} diff --git a/app/components/QuizzesScore.tsx b/app/components/QuizzesScore.tsx index 99f2d7e..601a0cb 100644 --- a/app/components/QuizzesScore.tsx +++ b/app/components/QuizzesScore.tsx @@ -43,7 +43,7 @@ export default function quizScoreData() {

Quizzes score

- {quizData.slice(15).map((data => ( + {quizData.slice(0, 10).map((data => (

{data.quizType}

diff --git a/app/components/TopPerformers.tsx b/app/components/TopPerformers.tsx index 661e37a..6149c5a 100644 --- a/app/components/TopPerformers.tsx +++ b/app/components/TopPerformers.tsx @@ -49,34 +49,34 @@ export default function TopPerformers() { return (

- Top Performers + Top Performers

Knowledge Quest

- +

{secondHighestRank.name}

-

{secondHighestRank.score}

+

{secondHighestRank.score} / 50

- + - +

{highestRank.name}

-

{highestRank.score}

+

{highestRank.score} / 50

- +

{thirdHighestRank.name}

-

{thirdHighestRank.score}

+

{thirdHighestRank.score} / 50

@@ -89,7 +89,7 @@ export default function TopPerformers() {

{data.program}

- +

{data.points} Points

diff --git a/app/routes/sign-in.tsx b/app/routes/sign-in.tsx new file mode 100644 index 0000000..1581690 --- /dev/null +++ b/app/routes/sign-in.tsx @@ -0,0 +1,54 @@ +import { useState } from 'react'; +import { FormEvent } from 'react'; + +export default function SignIn() { + const [userName, setUserName] = useState(''); + const [password, setPassword] = useState(''); + + const handleSubmit = async (e: FormEvent) => { + e.preventDefault(); // Prevent the default form submission + + const data = { + userName, + password, + }; + try { + const response = await fetch('https://iimtt-api.s38.siliconpin.com/api/sign-in', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(data), + }); + + if (!response.ok) { + throw new Error('Network response was not ok'); + } + + const result = await response.json(); + console.log('Success:', result); + } catch (error) { + console.error('Error:', error); + } + }; + + return ( +
+
+
+
+ + setUserName(e.target.value)} /> +
+
+ + setPassword(e.target.value)}/> +
+ +
+ +
+
+
+ ); +}