From f66b8e996faba6e8610035b814cc6617b6becf2b Mon Sep 17 00:00:00 2001 From: Shristi Gupta Date: Wed, 18 Oct 2023 00:48:53 +0530 Subject: [PATCH 01/21] feat: created qna session page with temperory id --- app/qna/session/id/page.tsx | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 app/qna/session/id/page.tsx diff --git a/app/qna/session/id/page.tsx b/app/qna/session/id/page.tsx new file mode 100644 index 0000000..01c08d9 --- /dev/null +++ b/app/qna/session/id/page.tsx @@ -0,0 +1,35 @@ +import PageContent from "@/components/layouts/page-content" +import ViewContainer from "@/components/layouts/view-container" +import { Button } from "@/components/ui/button" + + +const QNASession : React.FunctionComponent = () =>{ + console.log() + return( + + +
+
[Topic]
+
[question-list]
+
+
+
+
+
+

Remaining Time

+

[time]

+
+
+
+ +
+
[question]
+
+ + +
+
+
+ ) +} +export default QNASession \ No newline at end of file From 82dccfb63fa937705abbddb53faf25795e7d2cc4 Mon Sep 17 00:00:00 2001 From: Shristi Gupta Date: Wed, 18 Oct 2023 02:26:27 +0530 Subject: [PATCH 02/21] feat: created question interface and mock questions data --- app/qna/page.tsx | 1 + middleware/qna/qna-questions.ts | 16 ++++++++++++++++ mocks/qna-questions-mock.ts | 32 ++++++++++++++++++++++++++++++++ types/qna-que-card.d.ts | 5 +++++ 4 files changed, 54 insertions(+) create mode 100644 middleware/qna/qna-questions.ts create mode 100644 mocks/qna-questions-mock.ts create mode 100644 types/qna-que-card.d.ts diff --git a/app/qna/page.tsx b/app/qna/page.tsx index 8a3880f..11bfc86 100644 --- a/app/qna/page.tsx +++ b/app/qna/page.tsx @@ -33,6 +33,7 @@ import { fetchTopics } from '@/middleware/qna/sessions'; import { getTopicDepthLevels } from '@/common'; const TopicBasedQNA: React.FunctionComponent = () => { + const [recentQNASessions, setRecentQNASessions] = useState< Array >(fetchRecentQNASessions()); diff --git a/middleware/qna/qna-questions.ts b/middleware/qna/qna-questions.ts new file mode 100644 index 0000000..23a986e --- /dev/null +++ b/middleware/qna/qna-questions.ts @@ -0,0 +1,16 @@ +import { Environment } from '@/common/environment-variables'; +import { QnaMockQuestions } from '@/mocks/qna-questions-mock'; + +function fetchQnaQuestions(){ + switch (Environment.ENVIRONMENT_TYPE){ + case "development": + return QnaMockQuestions; + case "production": + //TODO Send topic-name and fetch questions-list with marks for each question via openAI + return []; + default: + return []; + } +} + +export {fetchQnaQuestions}; \ No newline at end of file diff --git a/mocks/qna-questions-mock.ts b/mocks/qna-questions-mock.ts new file mode 100644 index 0000000..9d52fd8 --- /dev/null +++ b/mocks/qna-questions-mock.ts @@ -0,0 +1,32 @@ + + +const QnaMockQuestions: Array = [ + { + question: "Define Diffing Algorithm", + score: 10, + questionId: "1" + }, + { + question: "Define Diffing Algorithm", + score: 10, + questionId: "2" + }, + { + question: "Define Diffing Algorithm", + score: 10, + questionId: "3" + }, + { + question: "Define Diffing Algorithm", + score: 10, + questionId: "4" + }, + { + question: "Define Diffing Algorithm", + score: 10, + questionId: "5" + } +] + + +export {QnaMockQuestions}; \ No newline at end of file diff --git a/types/qna-que-card.d.ts b/types/qna-que-card.d.ts new file mode 100644 index 0000000..465b9e5 --- /dev/null +++ b/types/qna-que-card.d.ts @@ -0,0 +1,5 @@ +declare interface QnaQueCardInterface { + question: string; + score: number; + questionId: string; + } \ No newline at end of file From e41cc88234028e561d1d451a86dcf5928309e520 Mon Sep 17 00:00:00 2001 From: Shristi Gupta Date: Wed, 18 Oct 2023 02:27:25 +0530 Subject: [PATCH 03/21] feat: created qna-question-card --- components/ui/qna-ques-card.tsx | 17 +++++++++++++++++ components/ui/recent-session.tsx | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 components/ui/qna-ques-card.tsx diff --git a/components/ui/qna-ques-card.tsx b/components/ui/qna-ques-card.tsx new file mode 100644 index 0000000..b1fe86b --- /dev/null +++ b/components/ui/qna-ques-card.tsx @@ -0,0 +1,17 @@ +import Link from "next/link"; +import { BoxCard } from "../layouts/box-card"; +import { cn } from "@/lib/utils"; + +const QnaQuesCard: React.FunctionComponent = ({question, questionId, score})=>{ + return( + + +
{question}
+
+{score} score
+
+ + ) +} + +export {QnaQuesCard}; \ No newline at end of file diff --git a/components/ui/recent-session.tsx b/components/ui/recent-session.tsx index fb08b7d..b352809 100644 --- a/components/ui/recent-session.tsx +++ b/components/ui/recent-session.tsx @@ -12,7 +12,7 @@ const RecentSession: React.FunctionComponent = ({ - + From 61a84d1573a60b6675efbeff4f00b9248dc8e184 Mon Sep 17 00:00:00 2001 From: Shristi Gupta Date: Wed, 18 Oct 2023 02:28:35 +0530 Subject: [PATCH 04/21] feat: rendered question-list --- app/qna/session/id/page.tsx | 9 +++---- .../sections/qna-questions-list/index.tsx | 26 +++++++++++++++++++ tsconfig.json | 2 +- 3 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 components/sections/qna-questions-list/index.tsx diff --git a/app/qna/session/id/page.tsx b/app/qna/session/id/page.tsx index 01c08d9..3b86ee8 100644 --- a/app/qna/session/id/page.tsx +++ b/app/qna/session/id/page.tsx @@ -1,17 +1,16 @@ import PageContent from "@/components/layouts/page-content" import ViewContainer from "@/components/layouts/view-container" import { Button } from "@/components/ui/button" +import { QnaQuestionsList } from "@/components/sections/qna-questions-list" +import { fetchQnaQuestions } from "@/middleware/qna/qna-questions" const QNASession : React.FunctionComponent = () =>{ - console.log() + return( -
-
[Topic]
-
[question-list]
-
+
diff --git a/components/sections/qna-questions-list/index.tsx b/components/sections/qna-questions-list/index.tsx new file mode 100644 index 0000000..925c2fc --- /dev/null +++ b/components/sections/qna-questions-list/index.tsx @@ -0,0 +1,26 @@ +import { QnaQuesCard } from "@/components/ui/qna-ques-card"; +import { fetchQnaQuestions } from "@/middleware/qna/qna-questions"; + +const QnaQuestionsList: React.FunctionComponent<{ + data: Array; + }> = ({ data }) => { + return( +
+
Frontend Engineering
+
+ {data.map((q, index) => { + return ( + + ); + })} +
+
+ ) +} + +export {QnaQuestionsList}; \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index c714696..b773f2a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,6 +22,6 @@ "@/*": ["./*"] } }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "components/sections/qna-ques-list"], "exclude": ["node_modules"] } From ec2bfb5b3731ec60a37f12888823c6bffe09b39c Mon Sep 17 00:00:00 2001 From: Shristi Gupta Date: Wed, 18 Oct 2023 02:39:04 +0530 Subject: [PATCH 05/21] fix: Link tab removed --- components/ui/qna-ques-card.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/components/ui/qna-ques-card.tsx b/components/ui/qna-ques-card.tsx index b1fe86b..fa51ba8 100644 --- a/components/ui/qna-ques-card.tsx +++ b/components/ui/qna-ques-card.tsx @@ -4,13 +4,11 @@ import { cn } from "@/lib/utils"; const QnaQuesCard: React.FunctionComponent = ({question, questionId, score})=>{ return( - - -
{question}
-
+{score} score
-
- + +
{question}
+
+{score} score
+
) } From 738ef59e13b1c2ebccf72c00dee8df47a09d107b Mon Sep 17 00:00:00 2001 From: Shristi Gupta Date: Mon, 23 Oct 2023 01:30:48 +0530 Subject: [PATCH 06/21] styles: qna-question-sections --- app/qna/session/id/page.tsx | 42 +++++++++++++------ .../sections/qna-questions-list/index.tsx | 4 +- components/ui/qna-ques-card.tsx | 6 +-- 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/app/qna/session/id/page.tsx b/app/qna/session/id/page.tsx index 3b86ee8..7d1c8ac 100644 --- a/app/qna/session/id/page.tsx +++ b/app/qna/session/id/page.tsx @@ -1,31 +1,47 @@ +'use client' import PageContent from "@/components/layouts/page-content" import ViewContainer from "@/components/layouts/view-container" import { Button } from "@/components/ui/button" import { QnaQuestionsList } from "@/components/sections/qna-questions-list" import { fetchQnaQuestions } from "@/middleware/qna/qna-questions" +import { Progress } from "@/components/ui/progress" +import { useState } from "react" +import { Input } from "@/components/ui/input" const QNASession : React.FunctionComponent = () =>{ + const [time, setTime] = useState("12:34") + return( - + -
-
-
-
-

Remaining Time

-

[time]

+
+
+
+
+
+

Remaining Time

+

{time} min

+
+
+ {/*
*/} + +
+ +
+
+
+

[Question]

+
+

Write your answer here

+
-
- +
-
[question]
-
- - +
diff --git a/components/sections/qna-questions-list/index.tsx b/components/sections/qna-questions-list/index.tsx index 925c2fc..cb60fb9 100644 --- a/components/sections/qna-questions-list/index.tsx +++ b/components/sections/qna-questions-list/index.tsx @@ -5,8 +5,8 @@ const QnaQuestionsList: React.FunctionComponent<{ data: Array; }> = ({ data }) => { return( -
-
Frontend Engineering
+
+
Frontend Engineering
{data.map((q, index) => { return ( diff --git a/components/ui/qna-ques-card.tsx b/components/ui/qna-ques-card.tsx index fa51ba8..5ae28c6 100644 --- a/components/ui/qna-ques-card.tsx +++ b/components/ui/qna-ques-card.tsx @@ -5,9 +5,9 @@ import { cn } from "@/lib/utils"; const QnaQuesCard: React.FunctionComponent = ({question, questionId, score})=>{ return( -
{question}
-
+{score} score
+

{question}

+ +{score} score
) } From 8a90d094d5f59e00c3cc4ce7ff30e62f6dc73834 Mon Sep 17 00:00:00 2001 From: Shristi Gupta Date: Mon, 23 Oct 2023 02:32:50 +0530 Subject: [PATCH 07/21] feat: included text-area --- app/qna/session/id/page.tsx | 14 +++++++------- components/ui/textarea.tsx | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 components/ui/textarea.tsx diff --git a/app/qna/session/id/page.tsx b/app/qna/session/id/page.tsx index 7d1c8ac..8168572 100644 --- a/app/qna/session/id/page.tsx +++ b/app/qna/session/id/page.tsx @@ -6,7 +6,8 @@ import { QnaQuestionsList } from "@/components/sections/qna-questions-list" import { fetchQnaQuestions } from "@/middleware/qna/qna-questions" import { Progress } from "@/components/ui/progress" import { useState } from "react" -import { Input } from "@/components/ui/input" +import { Textarea } from "@/components/ui/textarea" +import { Check } from 'lucide-react'; const QNASession : React.FunctionComponent = () =>{ @@ -26,22 +27,21 @@ const QNASession : React.FunctionComponent = () =>{

{time} min

- {/*
*/}
-
+

[Question]

-

Write your answer here

- +

Write your answer here

+