Skip to content

Commit

Permalink
Merge branch 'main' into fix-issue-886
Browse files Browse the repository at this point in the history
  • Loading branch information
BHS-Harish authored Aug 3, 2024
2 parents 8f0bcf2 + 934ae7f commit 8c6a551
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 31 deletions.
15 changes: 8 additions & 7 deletions frontend/src/pages/Broadcast/Component/Carousel/Carousel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ export function Carousel(props) {
const style = {
height: "13em",
backgroundSize: "cover",
backgroundPosition: "center",
backgroundBlendMode: "screen",
clipPath: "polygon(0 0, 100% 0, 100% 70%, 50% 100%, 0 70%)",
backgroundImage: `linear-gradient(45deg,rgba(255, 0, 90, 1) 0%,rgba(10, 24, 61, 1) 90%),url(${item.link})`,
backgroundImage: `linear-gradient(45deg,rgba(255, 0, 90, 1) 0%,
rgba(10, 24, 61, 1) 90%), url(${item.imageUrl[0]})`,
};
return style;
});
Expand All @@ -74,11 +75,11 @@ export function Carousel(props) {
const style = {
height: "13em",
backgroundSize: "cover",
backgroundPosition: "center",
backgroundBlendMode: "screen",
clipPath: "polygon(0 0, 100% 0, 100% 70%, 50% 100%, 0 70%)",
backgroundImage: `linear-gradient(45deg,
#4e4376 0%,
#2b5876 90%),url(${item.link})`,
#2b5876 90%),url(${item.imageUrl[0]})`,
};
return style;
});
Expand Down Expand Up @@ -149,13 +150,13 @@ export function Carousel(props) {
handleOpen(item.content, item.title, item.imageUrl[0], item?.link)
}
>
<div
<div
style={dark ? cardImageArrayDark[i] : cardImageArrayLight[i]}
></div>

<h3 className={style["card-head"]}>{item.title}</h3>
<div className={style["card-text"]}
dangerouslySetInnerHTML={{__html: DOMPurify.sanitize(truncatedContent(item.content, 250)),}} />
dangerouslySetInnerHTML={{__html: DOMPurify.sanitize(truncatedContent(item.content, 170)),}} />
</div>
))}
</OwlCarousel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

.slide-card {
position: relative;
min-height: 31em;
height: 31em;
min-width: 20em;
border-radius: 15px;
margin: 30px;
Expand Down Expand Up @@ -65,7 +65,6 @@
.card-text {
line-height: 1.4;
padding: 1em;
padding-top: 2em;
text-align: justify;
text-justify: distribute-all-lines;
font-size: 14px;
Expand Down
48 changes: 26 additions & 22 deletions frontend/src/pages/Q&A/Q&A.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,17 @@ function Ques(props) {
);

setCheckedState(updatedCheckedState);
formdata.tags.length = 0;
formdata.tags.push(checkedState);

const selectedTags = updatedCheckedState
.map((currentState, index) => {
if (currentState === true) {
return Tags[index].value;
}
return null;
})
.filter((item) => item !== null);

setFormData({ ...formdata, tags: selectedTags });
};

const schema = {
Expand Down Expand Up @@ -125,14 +134,15 @@ function Ques(props) {
}
};

const filterApprovedQuestions = (questions) => {
return questions.filter((question) => question.isApproved == true)
}

const [getQuestions, setQuestions] = useState([]);
const fetchQuestions = () => {
getAllQuestion(setToast).then((data) => {
setLoading(false);
data = data.map((item) => {
return { ...item, tags: item.tags[0] };
});
setQuestions(data);
setLoading(true);
setQuestions(filterApprovedQuestions(data));
});
};

Expand All @@ -147,6 +157,7 @@ function Ques(props) {
};

useEffect(() => {
setLoading(false)
fetchQuestions();
}, []);

Expand All @@ -168,21 +179,16 @@ function Ques(props) {
<p>{item.title}</p>
<p>{item.description}</p>
<div className="tags-container">
{tags.map((i, index) => {
if (i == true)
return (
<span className="tag-space" key={index}>
{i === true ? `#${Tags[index].value}` : ""}
</span>
);
})}
{item.tags.map((tag, index) => (
<span className="tag-space" key={index}>
#{tag}
</span>
))}
</div>
</div>
<div className="card-down">
<div>
<p>
Created At {new Date(item.createdAt).toLocaleString()}
</p>
<p>Created At {new Date(item.createdAt).toLocaleString()}</p>
</div>
<div>
<button
Expand All @@ -204,11 +210,9 @@ function Ques(props) {
setOpen(true)
}}>Answers</button>
</div>
);
})}
))}
</div>
)}

}
{toast.toastStatus && (
<SimpleToast
open={toast.toastStatus}
Expand Down

0 comments on commit 8c6a551

Please sign in to comment.