From c7faa20002cd7568da7025a29eb27c74da541b9e Mon Sep 17 00:00:00 2001 From: Balaharisankar Lakshmanaperumal <114602603+BHS-Harish@users.noreply.github.com> Date: Tue, 30 Jul 2024 19:13:46 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=8D=80=20Bug:=20The=20Q&A=20option=20in?= =?UTF-8?q?=20nav=20bar=20fixed=20(#1088)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/Q&A/Q&A.jsx | 72 +++++++++++++++++++------------- frontend/src/pages/Q&A/Ques.scss | 13 ++++++ 2 files changed, 55 insertions(+), 30 deletions(-) diff --git a/frontend/src/pages/Q&A/Q&A.jsx b/frontend/src/pages/Q&A/Q&A.jsx index 686f1522..d9d2e1bb 100644 --- a/frontend/src/pages/Q&A/Q&A.jsx +++ b/frontend/src/pages/Q&A/Q&A.jsx @@ -123,10 +123,12 @@ function Ques(props) { }; const [getQuestions, setQuestions] = useState([]); - const fetchQuestions = () => { getAllQuestion(setToast).then((data) => { setLoading(false); + data = data.map((item) => { + return { ...item, tags: item.tags[0] }; + }); setQuestions(data); }); }; @@ -154,38 +156,48 @@ function Ques(props) { ) : (
- {getQuestions.map((item, key) => ( -
-
-

{item.title}

-

{item.description}

- {item.tags.map((i, key) => ( - - #{i} - - ))} -
-
-
-

Created At {new Date(item.createdAt).toLocaleString()}

+ {getQuestions?.map((item, key) => { + let tags = [...Object.values(item.tags)]; + return ( +
+
+

{item.title}

+

{item.description}

+
+ {tags.map((i, index) => { + if (i == true) + return ( + + {i === true ? `#${Tags[index].value}` : ""} + + ); + })} +
-
- - +
+
+

+ Created At {new Date(item.createdAt).toLocaleString()} +

+
+
+ + +
-
- ))} + ); + })}
)} diff --git a/frontend/src/pages/Q&A/Ques.scss b/frontend/src/pages/Q&A/Ques.scss index 943c3016..6b531ff6 100644 --- a/frontend/src/pages/Q&A/Ques.scss +++ b/frontend/src/pages/Q&A/Ques.scss @@ -16,6 +16,19 @@ align-content: center; } +.tags-container { + width: 100%; + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: flex-start; + gap: 10px; +} + +.tag-space { + width: fit-content; +} + .close-popup { color: black; background: #69a9dd;