Skip to content

Commit

Permalink
Merge branch 'main' into feature/ai-enhancement
Browse files Browse the repository at this point in the history
Signed-off-by: Sezal Lagwal <[email protected]>
  • Loading branch information
sezallagwal authored Oct 28, 2024
2 parents 6b0de66 + 7842d22 commit f824996
Show file tree
Hide file tree
Showing 34 changed files with 750 additions and 640 deletions.
39 changes: 11 additions & 28 deletions client/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { useAtom } from "jotai";
import { modeAtom } from "./atom/Atom";
import { useEffect, useState } from "react";
import "./App.css";
import "./index.css";
Expand Down Expand Up @@ -29,31 +31,20 @@ import ScrollTop from "./component/ScrollTop";
import EditProfile from "./component/EditProfile";
import Contributors from "./component/Contributors";
import Discussion from "./component/Discussion";
import { useAtom } from "jotai";
import { modeAtom } from "./atom/Atom";
import ForgotPassword from "./component/ForgotPassword";
import ResetPassword from "./component/ResetPassword";
import VerifyEmail from "./component/Verify";
import NotFound from "./component/NotFound";
import ProgressBar from "./component/ProgressBar/ProgressBar";
// import ProtectedRoute from '../../client/src/component/ProtectedRoute'
import AOS from 'aos';
import 'aos/dist/aos.css';
import Ai from "./component/AI";
import FAQ from "./component/FAQ"; // Import the FAQ component

// Main Layout Component

const Layout = ({ children, mode, setProgress, toggleMode, showAlert }) => {

// Define routes where the footer or navbar should not be shown
// const hideNavbarRoutes = ["/login", "/signup", "/forgot-password"];
// const hideFooterRoutes = ["/login", "/signup", "/forgot-password"];

return (
<div className="h-full w-full">
{/* Conditionally render the Navbar */}
{/* {!hideNavbarRoutes.includes(location.pathname) && ( */}

{/* Naming Convention of Navbar */}
<Navbar
title='BITBOX'
home='Home'
Expand All @@ -66,15 +57,8 @@ const Layout = ({ children, mode, setProgress, toggleMode, showAlert }) => {
mode={mode}
toggleMode={toggleMode}
/>
{/* )} */}

{/* Main content */}
{children}

{/* Conditionally render the Footer */}
{/* {!hideFooterRoutes.includes(location.pathname) && ( */}
<Footer mode={mode} setProgress={setProgress} setAlert={showAlert} />
{/* )} */}
</div>
);
};
Expand All @@ -90,7 +74,7 @@ function App() {
};

const [progress, setProgress] = useState(0);
const [islogged, setloggedin] = useState(false)
const [islogged, setloggedin] = useState(false);

useEffect(() => {
const savedMode = localStorage.getItem("mode");
Expand Down Expand Up @@ -129,7 +113,7 @@ function App() {

useEffect(() => {
AOS.init();
}, [])
}, []);

return (
<div className="h-full w-screen">
Expand All @@ -147,8 +131,7 @@ function App() {
<ProgressBar mode={mode} />
<ScrollTop />

{/* Wrap everything inside the Layout component */}
<Layout mode={mode} setProgress={setProgress} toggleMode={toggleMode} showAlert={showAlert} >
<Layout mode={mode} setProgress={setProgress} toggleMode={toggleMode} showAlert={showAlert}>
<Routes>
<Route exact path='/' element={<Home mode={mode} setProgress={setProgress} showAlert={showAlert} />} />
<Route exact path="/discussion" element={<Discussion mode={mode} setProgress={setProgress} showAlert={showAlert} />} />
Expand All @@ -162,21 +145,21 @@ function App() {
<Route exact path='/contributors' element={<Contributors mode={mode} setProgress={setProgress} showAlert={showAlert} />} />
<Route exact path="/login" element={<Login mode={mode} setProgress={setProgress} showAlert={showAlert} loggedin={islogged} setloggedin={setloggedin} />} />
<Route exact path='/signup' element={<Signup mode={mode} setProgress={setProgress} showAlert={showAlert} />} />
<Route exact path='/Forgot-Password' element={<ForgotPassword mode={mode} setProgress={setProgress} showAlert={showAlert} />} />
<Route exact path='/forgot-password' element={<ForgotPassword mode={mode} setProgress={setProgress} showAlert={showAlert} />} />
<Route exact path='/reset-password' element={<ResetPassword mode={mode} setProgress={setProgress} showAlert={showAlert} />} />
<Route exact path='/codeofconduct' element={<CodeOfConduct mode={mode} setProgress={setProgress} showAlert={showAlert} />} />
<Route exact path='/feedback' element={<Feedback mode={mode} setProgress={setProgress} showAlert={showAlert} />} />
<Route exact path='/contactus' element={<ContactUs mode={mode} setProgress={setProgress} showAlert={showAlert} />} />
<Route exact path='/privacypolicy' element={<PrivacyPolicy mode={mode} setProgress={setProgress} showAlert={showAlert} />} />
<Route exact path='/termofuse' element={<TermOfUse mode={mode} setProgress={setProgress} showAlert={showAlert} />} />
<Route exact path='/contributors' element={<Contributors mode={mode} setProgress={setProgress} showAlert={showAlert} />} />
<Route exact path='/verify/:token' element={<VerifyEmail />} />
<Route exact path='/FAQ' element={<FAQ />} /> {/* Add this line */}
<Route exact path='/*' element={<NotFound />} />
</Routes>
</Layout>
</Router>
</ProfileState>
</ProjectState>
</div >
</div>
);
}

Expand Down
11 changes: 1 addition & 10 deletions client/src/component/Community.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useContext, useRef, useState, useEffect } from "react";
import projectContext from "../context/projectContext";
import profileContext from "../context/profileContext";
import CommunityCard from "./CommunityCard";
import axios from "axios";
import PropTypes from "prop-types";
import Skeleton from "@mui/material/Skeleton"; // Import Material UI Skeleton
import "../css/Community.css";
Expand All @@ -20,7 +19,6 @@ import commentModalImg from "../assets/images/Modal Image/comment.png";
import ShareModalImg from "../assets/images/Modal Image/Share.png";

const Community = (props) => {
const VITE_SERVER_PORT = import.meta.env.VITE_SERVER_PORT || 'https://bitbox-uxbo.onrender.com';
const [loading, setLoading] = useState(true); // State to track loading
const [project, setProject] = useState({
id: "",
Expand All @@ -36,6 +34,7 @@ const Community = (props) => {
const { globalProjects, getGlobalProjects } = context;
const userProfileContext = useContext(profileContext);
const { userProfile, getUserProfile } = userProfileContext;
// eslint-disable-next-line
const [image, setImage] = useState();

// Fetch projects on component mount
Expand All @@ -56,14 +55,6 @@ const Community = (props) => {
// eslint-disable-next-line
}, []);

// Avatar Profile Image
useEffect(() => {
axios
.get(`${VITE_SERVER_PORT}/getAvatarImage`)
.then((res) => setImage(res.data[res.data.length - 1].image)) // Fetch the last uploaded image
.catch((err) => console.log(err));
});

const showDetailProject = (currentProject) => {
refDetails.current.click();
setProject({
Expand Down
2 changes: 0 additions & 2 deletions client/src/component/Contributors.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ StatCard.propTypes = {


export default function Contributor(props) {
console.log(props)
const [contributors, setContributors] = useState([]);
const [repoStats, setRepoStats] = useState({
stars: 0,
Expand All @@ -152,7 +151,6 @@ export default function Contributor(props) {

allContributors = [...allContributors, ...contributorsData];
setContributors(allContributors);
console.log(allContributors)

const repoResponse = await fetch(
'https://api.github.com/repos/Bitbox-Connect/Bitbox',
Expand Down
14 changes: 2 additions & 12 deletions client/src/component/EditProfile.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import { useContext, useEffect, useState } from "react";
import { useState } from "react";
import PropTypes from "prop-types";
import { Button } from "react-bootstrap";
import axios from "axios";
import profileContext from "../context/profileContext";
import userDummyImg from "../assets/images/User/User.png";

// CSS
import "../css/EditProfile.css";

const EditProfile = (props) => {
const VITE_SERVER_PORT =
import.meta.env.VITE_SERVER_PORT || "https://bitbox-uxbo.onrender.com";
const userProfileContext = useContext(profileContext);
const { updateUserProfile } = userProfileContext;

const [profile, setProfile] = useState({
name: "",
Expand Down Expand Up @@ -92,14 +90,6 @@ const EditProfile = (props) => {
const [file, setFile] = useState();
const [image, setImage] = useState();

useEffect(() => {
// Fetch initial image when component mounts
axios
.get(`{host}/getAvatarImage`)
.then((res) => setImage(res.data[res.data.length - 1].image)) // Fetch the last uploaded image
.catch((err) => console.log(err));
}, []);

return (
<div>
<div className="editprofile-main-container">
Expand Down
73 changes: 73 additions & 0 deletions client/src/component/FAQ.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/* component/FAQ.css */

.faq-container {
margin-top: 100px;
margin-bottom: 40px;
padding: 20px;
border-radius: 25px;
border: 2px solid #ccc;
background-color: #f9f9f9;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

h1 {
text-align: center;
margin-bottom: 20px;
font-family: 'Arial', sans-serif;
color: #333;
font-size: 24px; /* Decreased size */
}

.faq-item {
position: relative;
margin-bottom: 15px;
padding: 10px;
border: 2px solid #ddd;
border-radius: 20px;
background-color: #fff;
transition: background-color 0.3s, box-shadow 0.3s;
}

.faq-item:hover {
background-color: #157aac;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.faq-question {
font-size: 18px;
color: #333;
cursor: pointer;
margin: 0;
transition: color 0.3s;
}

.faq-question:hover {
color: #e9e0e0; /* Change color on hover */
}

.faq-answer {
font-size: 16px;
color: #ffffff;
margin-top: 10px;
cursor: pointer;
padding: 5px 0;
transition: max-height 0.3s ease, opacity 0.3s ease;
display: flex; /* Use flexbox */
align-items: center; /* Center vertically */
justify-content: center; /* Center horizontally */
height: 40px; /* Set a height to create a consistent layout */
left: 20px; /* Maintain your left positioning */
}


.num {
position: absolute;
top: 10px; /* Adjusted positioning */
left: -25px; /* Position for the number bubble */
border-radius: 50%;
background-color: #0fa2eb;
color: white;
padding: 5px 10px;
font-weight: bold;
}

51 changes: 51 additions & 0 deletions client/src/component/FAQ.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// component/FAQ.jsx
import React, { useState } from 'react';
import './FAQ.css'; // Import the CSS file for styling

const FAQ = () => {
const [activeIndex, setActiveIndex] = useState(null);

const toggleAnswer = (index) => {
setActiveIndex(activeIndex === index ? null : index);
};

return (
<div className="faq-container">
<h1>Frequently Asked Questions</h1>
{faqData.map((item, index) => (
<div key={index} className="faq-item">
<h2 onClick={() => toggleAnswer(index)} className="faq-question">
{item.question}
</h2>
{activeIndex === index && <p className="faq-answer">{item.answer}</p>}
</div>
))}
</div>
);
};

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 [email protected].",
},
];


export default FAQ;
4 changes: 4 additions & 0 deletions client/src/component/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ const Footer = (props) => {
<li className='nav-item'>
<Link to='/blog'>Blog</Link>
</li>
<li className='nav-item'>
<Link to='/FAQ'>FAQ</Link>
</li>

</ul>
</div>

Expand Down
21 changes: 21 additions & 0 deletions client/src/component/Footers/FAQ.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// component/FAQ.jsx
import React from 'react';

const FAQ = () => {
return (
<div className="faq-container">
<h1>Frequently Asked Questions</h1>
<div className="faq-item">
<h2>Question 1: What is this project about?</h2>
<p>Answer: This project is designed to help users...</p>
</div>
<div className="faq-item">
<h2>Question 2: How do I get started?</h2>
<p>Answer: To get started, you can...</p>
</div>
{/* Add more FAQ items as needed */}
</div>
);
};

export default FAQ;
Loading

0 comments on commit f824996

Please sign in to comment.