diff --git a/client/package-lock.json b/client/package-lock.json
index 0246cf8..65e9880 100644
--- a/client/package-lock.json
+++ b/client/package-lock.json
@@ -2045,7 +2045,6 @@
},
"node_modules/@types/react-dom": {
"version": "18.3.1",
- "dev": true,
"license": "MIT",
"dependencies": {
"@types/react": "*"
diff --git a/client/src/App.jsx b/client/src/App.jsx
index 5a69abf..2a0844e 100644
--- a/client/src/App.jsx
+++ b/client/src/App.jsx
@@ -38,6 +38,7 @@ import "aos/dist/aos.css";
import Collab from "./component/Collab";
import CreateBlog from "./component/CreateBlog";
import UploadProject from "./component/UploadProject";
+import DiscussionForum from "./component/DiscussionForum";
const Layout = ({ children, mode, setProgress, toggleMode, showAlert }) => {
return (
@@ -146,6 +147,7 @@ function App() {
} />
} />
} />
+ } />
} />
diff --git a/client/src/component/DiscussionForum.jsx b/client/src/component/DiscussionForum.jsx
new file mode 100644
index 0000000..3da0732
--- /dev/null
+++ b/client/src/component/DiscussionForum.jsx
@@ -0,0 +1,156 @@
+import { useState, useEffect } from 'react';
+
+const DiscussionForum = (props) => {
+ const [questions, setQuestions] = useState([]);
+
+ // Fetch questions from localStorage
+ useEffect(() => {
+ const storedQuestions = localStorage.getItem('questions');
+ if (storedQuestions) {
+ setQuestions(JSON.parse(storedQuestions));
+ }
+ }, []);
+
+ // Save questions to localStorage
+ const saveQuestions = (updatedQuestions) => {
+ setQuestions(updatedQuestions);
+ localStorage.setItem('questions', JSON.stringify(updatedQuestions));
+ };
+
+ // Helper function to save a new question
+ const addQuestion = (content) => {
+ const newQuestion = {
+ id: Date.now().toString(),
+ content,
+ answered: false,
+ answer: '',
+ };
+
+ const updatedQuestions = [...questions, newQuestion];
+ saveQuestions(updatedQuestions);
+ };
+
+ // Helper function to add an answer to a question
+ const addAnswer = (questionId, answerContent) => {
+ const updatedQuestions = questions.map((question) =>
+ question.id === questionId
+ ? { ...question, answered: true, answer: answerContent }
+ : question
+ );
+ saveQuestions(updatedQuestions);
+ };
+
+ // Function to render the Question Card
+ const renderQuestionCard = (question) => {
+ return (
+
+
{question.content}
+ {question.answered ? (
+
+
Answer:
+
{question.answer}
+
+ ) : (
+
+ )}
+
+ );
+ };
+
+ // Function to render the Answer Form
+ const AnswerForm = ({ questionId }) => {
+ const [answer, setAnswer] = useState('');
+
+ const handleSubmit = (e) => {
+ e.preventDefault();
+ if (answer.trim()) {
+ addAnswer(questionId, answer);
+ setAnswer('');
+ }
+ };
+
+ return (
+
+ );
+ };
+
+ // Function to render the Question Form
+ const QuestionForm = () => {
+ const [newQuestion, setNewQuestion] = useState('');
+
+ const handleSubmit = (e) => {
+ e.preventDefault();
+ if (newQuestion.trim()) {
+ addQuestion(newQuestion);
+ setNewQuestion('');
+ }
+ };
+
+ return (
+
+ setNewQuestion(e.target.value)}
+ placeholder="Ask your question..."
+ className={`w-full p-4 border rounded-md ${props.mode === 'dark' ? 'bg-gray-600 text-gray-200' : 'bg-gray-100 text-gray-800'
+ } focus:outline-none focus:ring-2 focus:ring-gray-500 transition-all`}
+ />
+
+ Ask Question
+
+
+ );
+ };
+
+ return (
+
+
+ BITBOX Discussion Forum
+
+
+
+
+
+
Unanswered Questions
+
+ {questions
+ .filter((question) => !question.answered)
+ .map((question) => renderQuestionCard(question))}
+
+
+
+
+
+
Answered Questions
+
+ {questions
+ .filter((question) => question.answered)
+ .map((question) => renderQuestionCard(question))}
+
+
+
+ );
+};
+
+export default DiscussionForum;
diff --git a/client/src/component/faq.jsx b/client/src/component/faq.jsx
new file mode 100644
index 0000000..de47066
--- /dev/null
+++ b/client/src/component/faq.jsx
@@ -0,0 +1,55 @@
+// component/FAQ.jsx
+import { useState } from "react";
+import "../css/Faq.css";
+
+const FAQ = () => {
+ const [activeIndex, setActiveIndex] = useState(null);
+
+ const toggleAnswer = (index) => {
+ setActiveIndex(activeIndex === index ? null : index);
+ };
+
+ return (
+
+
Frequently Asked Questions
+ {faqData.map((item, index) => (
+
+
toggleAnswer(index)} className="faq-question">
+ {item.question}
+
+ {activeIndex === index &&
{item.answer}
}
+
+ ))}
+
+ );
+};
+
+const faqData = [
+ {
+ question: "What is BitBox?",
+ answer:
+ "BitBox is a user-friendly platform that simplifies version control and collaboration for developers.",
+ },
+ {
+ question: "How does BitBox enhance collaboration?",
+ answer:
+ "BitBox offers intuitive tools that enable both solo programmers and large teams to manage projects efficiently.",
+ },
+ {
+ question: "How do I get started with BitBox?",
+ answer:
+ "You can sign up for an account on BitBox and start managing your projects right away.",
+ },
+ {
+ question: "Is BitBox compatible with modern development workflows?",
+ answer:
+ "Yes, BitBox seamlessly integrates with modern development workflows, providing fast and reliable performance.",
+ },
+ {
+ question: "How can I contact support if I need help?",
+ answer:
+ "You can reach out to support through the 'Contact Us' page or by emailing support@example.com.",
+ },
+];
+
+export default FAQ;
diff --git a/package-lock.json b/package-lock.json
index b9c587d..8d9465c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,5 +1,5 @@
{
- "name": "Bitbox",
+ "name": "GSSOC_Bitbox",
"lockfileVersion": 3,
"requires": true,
"packages": {}